Path replacement bug under Linux

pull/26/head
Louis Vézina 7 years ago
parent bc4bc4f045
commit a67f7f0060

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

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

Loading…
Cancel
Save