Fix for subfolder wrongly implemented in store_subtitles

This commit is contained in:
Louis Vézina 2020-10-02 16:14:00 -04:00
parent 5d68247c2d
commit da434f49b9
2 changed files with 16 additions and 3 deletions

View File

@ -117,7 +117,8 @@ def pp_replace(pp_command, episode, subtitles, language, language_code2, languag
def get_subtitle_destination_folder():
fld_custom = str(settings.general.subfolder_custom).strip() if settings.general.subfolder_custom else None
fld_custom = str(settings.general.subfolder_custom).strip() if (settings.general.subfolder_custom and
settings.general.subfolder != 'current') else None
return fld_custom

View File

@ -63,7 +63,13 @@ def store_subtitles(original_path, reversed_path):
core.CUSTOM_PATHS = [dest_folder] if dest_folder else []
subtitles = search_external_subtitles(reversed_path, languages=get_language_set(),
only_one=settings.general.getboolean('single_language'))
subtitles = guess_external_subtitles(get_subtitle_destination_folder() or os.path.dirname(reversed_path), subtitles)
full_dest_folder_path = os.path.dirname(reversed_path)
if dest_folder:
if settings.general.subfolder == "absolute":
full_dest_folder_path = dest_folder
elif settings.general.subfolder == "relative":
full_dest_folder_path = os.path.join(os.path.dirname(reversed_path), dest_folder)
subtitles = guess_external_subtitles(full_dest_folder_path, subtitles)
except Exception as e:
logging.exception("BAZARR unable to index external subtitles.")
pass
@ -142,7 +148,13 @@ def store_subtitles_movie(original_path, reversed_path):
dest_folder = get_subtitle_destination_folder() or ''
core.CUSTOM_PATHS = [dest_folder] if dest_folder else []
subtitles = search_external_subtitles(reversed_path, languages=get_language_set())
subtitles = guess_external_subtitles(get_subtitle_destination_folder() or os.path.dirname(reversed_path), subtitles)
full_dest_folder_path = os.path.dirname(reversed_path)
if dest_folder:
if settings.general.subfolder == "absolute":
full_dest_folder_path = dest_folder
elif settings.general.subfolder == "relative":
full_dest_folder_path = os.path.join(os.path.dirname(reversed_path), dest_folder)
subtitles = guess_external_subtitles(full_dest_folder_path, subtitles)
except Exception as e:
logging.exception("BAZARR unable to index external subtitles.")
pass