mirror of
https://github.com/morpheus65535/bazarr.git
synced 2024-11-10 17:13:35 +08:00
Fixed use original format when uploading subtitles. #1955
This commit is contained in:
parent
8348b6c0dc
commit
65c0e6b823
1 changed files with 14 additions and 13 deletions
|
@ -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…
Reference in a new issue