Fix for .vtt files not being recognized as valid external subtitles.

This commit is contained in:
Louis Vézina 2020-07-26 13:42:41 -04:00
parent 9759425aa5
commit 13238b1218

View file

@ -5,9 +5,7 @@ import os
import logging import logging
import ast import ast
from guess_language import guess_language from guess_language import guess_language
import subliminal_patch from subliminal_patch import core, search_external_subtitles
from subliminal import core
from subliminal_patch import search_external_subtitles
from subzero.language import Language from subzero.language import Language
from database import database from database import database
@ -54,7 +52,7 @@ def store_subtitles(original_path, reversed_path):
brazilian_portuguese_forced = [".pt-br.forced", ".pob.forced", "pb.forced"] brazilian_portuguese_forced = [".pt-br.forced", ".pob.forced", "pb.forced"]
try: try:
dest_folder = get_subtitle_destination_folder() dest_folder = get_subtitle_destination_folder()
subliminal_patch.core.CUSTOM_PATHS = [dest_folder] if dest_folder else [] core.CUSTOM_PATHS = [dest_folder] if dest_folder else []
subtitles = search_external_subtitles(reversed_path, languages=get_language_set(), subtitles = search_external_subtitles(reversed_path, languages=get_language_set(),
only_one=settings.general.getboolean('single_language')) only_one=settings.general.getboolean('single_language'))
subtitles = guess_external_subtitles(get_subtitle_destination_folder() or os.path.dirname(reversed_path), subtitles) subtitles = guess_external_subtitles(get_subtitle_destination_folder() or os.path.dirname(reversed_path), subtitles)
@ -130,7 +128,7 @@ def store_subtitles_movie(original_path, reversed_path):
brazilian_portuguese_forced = [".pt-br.forced", ".pob.forced", "pb.forced"] brazilian_portuguese_forced = [".pt-br.forced", ".pob.forced", "pb.forced"]
try: try:
dest_folder = get_subtitle_destination_folder() or '' dest_folder = get_subtitle_destination_folder() or ''
subliminal_patch.core.CUSTOM_PATHS = [dest_folder] if dest_folder else [] core.CUSTOM_PATHS = [dest_folder] if dest_folder else []
subtitles = search_external_subtitles(reversed_path, languages=get_language_set()) 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) subtitles = guess_external_subtitles(get_subtitle_destination_folder() or os.path.dirname(reversed_path), subtitles)
except Exception as e: except Exception as e: