From da434f49b99b72b29f43e10c0b771550b1d2a45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Fri, 2 Oct 2020 16:14:00 -0400 Subject: [PATCH] Fix for subfolder wrongly implemented in store_subtitles --- bazarr/helper.py | 3 ++- bazarr/list_subtitles.py | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bazarr/helper.py b/bazarr/helper.py index feca4f230..73ad6f869 100644 --- a/bazarr/helper.py +++ b/bazarr/helper.py @@ -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 diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py index 63ac0a1b6..c2b8c30ab 100644 --- a/bazarr/list_subtitles.py +++ b/bazarr/list_subtitles.py @@ -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