1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 01:27:07 +00:00
This commit is contained in:
morpheus65535 2020-10-23 22:49:15 -04:00
parent 467dc39b87
commit acbc91f100

View file

@ -86,10 +86,15 @@ def store_subtitles(original_path, reversed_path):
[str("pb:forced"), path_mappings.path_replace_reverse(subtitle_path)]) [str("pb:forced"), path_mappings.path_replace_reverse(subtitle_path)])
elif not language: elif not language:
continue continue
elif str(language.basename) != 'und': elif str(language) != 'und':
logging.debug("BAZARR external subtitles detected: " + str(language.basename)) if language.forced:
actual_subtitles.append([str(language.basename + (':hi' if language.hi else '')), language_str = str(language)
path_mappings.path_replace_reverse(subtitle_path)]) elif language.hi:
language_str = str(language) + ':hi'
else:
language_str = str(language)
logging.debug("BAZARR external subtitles detected: " + language_str)
actual_subtitles.append([language_str, path_mappings.path_replace_reverse(subtitle_path)])
database.execute("UPDATE table_episodes SET subtitles=? WHERE path=?", database.execute("UPDATE table_episodes SET subtitles=? WHERE path=?",
(str(actual_subtitles), original_path)) (str(actual_subtitles), original_path))
@ -170,9 +175,14 @@ def store_subtitles_movie(original_path, reversed_path):
elif not language: elif not language:
continue continue
elif str(language.basename) != 'und': elif str(language.basename) != 'und':
logging.debug("BAZARR external subtitles detected: " + str(language.basename)) if language.forced:
actual_subtitles.append([str(language) + (':hi' if language.hi else ''), language_str = str(language)
path_mappings.path_replace_reverse_movie(subtitle_path)]) elif language.hi:
language_str = str(language) + ':hi'
else:
language_str = str(language)
logging.debug("BAZARR external subtitles detected: " + language_str)
actual_subtitles.append([language_str, path_mappings.path_replace_reverse_movie(subtitle_path)])
database.execute("UPDATE table_movies SET subtitles=? WHERE path=?", database.execute("UPDATE table_movies SET subtitles=? WHERE path=?",
(str(actual_subtitles), original_path)) (str(actual_subtitles), original_path))
@ -457,8 +467,12 @@ def guess_external_subtitles(dest_folder, subtitles):
except: except:
pass pass
# Skip HI detection if forced
if language.forced:
pass
# Detect hearing-impaired external subtitles not identified in filename # Detect hearing-impaired external subtitles not identified in filename
if not subtitles[subtitle].hi: elif not subtitles[subtitle].hi:
subtitle_path = os.path.join(dest_folder, subtitle) subtitle_path = os.path.join(dest_folder, subtitle)
# to improve performance, skip detection of files larger that 1M # to improve performance, skip detection of files larger that 1M