Path replacement bug under Linux

This commit is contained in:
Louis Vézina 2017-11-27 20:53:53 -05:00
parent bc4bc4f045
commit a67f7f0060
2 changed files with 6 additions and 7 deletions

View file

@ -38,10 +38,9 @@ def path_replace(path):
elif path.startswith('/'):
path = path.replace('\\', '/')
break
return path.encode('utf8')
return path
def path_replace_reverse(path):
print path
for path_mapping in path_mappings:
if path_mapping[1] in path:
path = path.replace(path_mapping[1], path_mapping[0])
@ -50,5 +49,4 @@ def path_replace_reverse(path):
elif path.startswith('/'):
path = path.replace('\\', '/')
break
print path
return path.encode('utf8')
return path

View file

@ -8,6 +8,7 @@ from subliminal import *
import pycountry
import sqlite3
import ast
import sys
from get_general_settings import *
@ -109,7 +110,7 @@ def full_scan_subtitles():
c_db.close()
for episode in episodes:
store_subtitles(path_replace(episode[0]).encode('string_escape'))
store_subtitles(path_replace(episode[0]).encode(sys.getfilesystemencoding()))
def series_scan_subtitles(no):
conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
@ -118,7 +119,7 @@ def series_scan_subtitles(no):
c_db.close()
for episode in episodes:
store_subtitles(path_replace(episode[0]).encode('string_escape'))
store_subtitles(path_replace(episode[0]).encode(sys.getfilesystemencoding()))
list_missing_subtitles(no)
@ -129,4 +130,4 @@ def new_scan_subtitles():
c_db.close()
for episode in episodes:
store_subtitles(path_replace(episode[0]).encode('string_escape'))
store_subtitles(path_replace(episode[0]).encode(sys.getfilesystemencoding()))