Fix issue with show subfolder in subtitles path

pull/427/head
Halali 6 years ago
parent d9d0942d50
commit 7d8b9d812a

@ -139,7 +139,7 @@ def store_subtitles_movie(file):
else:
logging.debug("BAZARR This file isn't an .mkv file.")
dest_folder = get_subtitle_destination_folder()
dest_folder = get_subtitle_destination_folder() or ''
subliminal_patch.core.CUSTOM_PATHS = [dest_folder] if dest_folder else []
brazilian_portuguese = [".pt-br", ".pob", "pb"]
try:
@ -153,15 +153,15 @@ def store_subtitles_movie(file):
if str(os.path.splitext(subtitle)[0]).lower().endswith(tuple(brazilian_portuguese)) is True:
logging.debug("BAZARR external subtitles detected: " + "pb")
actual_subtitles.append(
[str("pb"), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle))])
[str("pb"), path_replace_reverse_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle))])
elif str(language) != 'und':
logging.debug("BAZARR external subtitles detected: " + str(language))
actual_subtitles.append(
[str(language), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle))])
[str(language), path_replace_reverse_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle))])
else:
if os.path.splitext(subtitle)[1] != ".sub":
logging.debug("BAZARR falling back to file content analysis to detect language.")
with open(path_replace_movie(os.path.join(os.path.dirname(file), subtitle)), 'r') as f:
with open(path_replace_movie(os.path.join(os.path.dirname(file), dest_folder, subtitle)), 'r') as f:
text = list(islice(f, 100))
text = ' '.join(text)
encoding = UnicodeDammit(text)
@ -179,7 +179,7 @@ def store_subtitles_movie(file):
"BAZARR external subtitles detected and analysis guessed this language: " + str(
detected_language))
actual_subtitles.append([str(detected_language), path_replace_reverse_movie(
os.path.join(os.path.dirname(file), subtitle))])
os.path.join(os.path.dirname(file), dest_folder, subtitle))])
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c_db = conn_db.cursor()

@ -1307,6 +1307,9 @@ def save_settings():
settings.general.path_mappings_movie = text_type(settings_general_pathmapping_movie)
settings.general.page_size = text_type(settings_page_size)
settings.general.subfolder = text_type(settings_subfolder)
if settings.general.subfolder == 'current':
settings.general.subfolder_custom = ''
else:
settings.general.subfolder_custom = text_type(settings_subfolder_custom)
settings.general.upgrade_subs = text_type(settings_upgrade_subs)
settings.general.days_to_upgrade_subs = text_type(settings_days_to_upgrade_subs)

Loading…
Cancel
Save