Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed file extension when automatically searching for a subtitles and use original format is enabled #2711

Merged
merged 4 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions bazarr/subtitles/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from subliminal_patch.score import ComputeScore

from app.config import settings, get_scores, get_array_from
from app.database import TableEpisodes, TableMovies, database, select
from app.database import TableEpisodes, TableMovies, database, select, get_profiles_list
from utilities.path_mappings import path_mappings
from utilities.helper import get_target_folder, force_unicode
from languages.get_languages import alpha3_from_alpha2
Expand Down Expand Up @@ -41,6 +41,8 @@ def generate_subtitles(path, languages, audio_language, sceneName, title, media_
providers = pool.providers

language_set = _get_language_obj(languages=languages)
profile = get_profiles_list(profile_id=profile_id)
original_format = profile['originalFormat']
hi_required = "force HI" if any([x.hi for x in language_set]) else False
also_forced = any([x.forced for x in language_set])
forced_required = all([x.forced for x in language_set])
Expand Down Expand Up @@ -82,6 +84,8 @@ def generate_subtitles(path, languages, audio_language, sceneName, title, media_
subtitle_formats = set()
for s in subtitles:
s.mods = subz_mods
if original_format in (1, "1", "True", True):
s.use_original_format = True
subtitle_formats.add(s.format)

try:
Expand All @@ -100,7 +104,7 @@ def generate_subtitles(path, languages, audio_language, sceneName, title, media_
tags=None, # fixme
directory=fld,
chmod=chmod,
formats=tuple(subtitle_formats),
formats=subtitle_formats,
path_decoder=force_unicode
)
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion bazarr/subtitles/manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def manual_download_subtitle(path, audio_language, hi, forced, subtitle, provide
subtitle.language.forced = True
else:
subtitle.language.forced = False
if use_original_format in ("1", "True"):
if use_original_format in (1, "1", "True", True):
anderson-oki marked this conversation as resolved.
Show resolved Hide resolved
subtitle.use_original_format = True

subtitle.mods = get_array_from(settings.general.subzero_mods)
Expand Down