Fixed use original format when uploading subtitles. #1955

pull/1967/head
morpheus65535 2 years ago
parent 8348b6c0dc
commit 65c0e6b823

@ -51,19 +51,6 @@ def manual_upload_subtitle(path, language, forced, hi, title, scene_name, media_
if forced:
lang_obj = Language.rebuild(lang_obj, forced=True)
sub = Subtitle(
lang_obj,
mods=get_array_from(settings.general.subzero_mods)
)
sub.content = subtitle.read()
if not sub.is_valid():
logging.exception('BAZARR Invalid subtitle file: ' + subtitle.filename)
sub.mods = None
if settings.general.getboolean('utf8_encode'):
sub.set_encoding("utf-8")
if media_type == 'series':
episode_metadata = TableEpisodes.select(TableEpisodes.sonarrSeriesId,
TableEpisodes.sonarrEpisodeId,
@ -88,6 +75,20 @@ def manual_upload_subtitle(path, language, forced, hi, title, scene_name, media_
else:
use_original_format = False
sub = Subtitle(
lang_obj,
mods=get_array_from(settings.general.subzero_mods),
original_format=use_original_format
)
sub.content = subtitle.read()
if not sub.is_valid():
logging.exception('BAZARR Invalid subtitle file: ' + subtitle.filename)
sub.mods = None
if settings.general.getboolean('utf8_encode'):
sub.set_encoding("utf-8")
try:
sub.format = (get_format_identifier(os.path.splitext(subtitle.filename)[1]),)
except Exception:

Loading…
Cancel
Save