Fixed issue with non-existent episode or movie when indexing embedded subtitles. #1606

pull/1611/head v1.0.1-beta.12
morpheus65535 3 years ago
parent b53f8ad80a
commit 6f17100ca4

@ -18,6 +18,7 @@ from helper import path_mappings, get_subtitle_destination_folder
from embedded_subs_reader import embedded_subs_reader
from event_handler import event_stream, show_progress, hide_progress
from charamel import Detector
from peewee import DoesNotExist
gc.enable()
@ -36,6 +37,10 @@ def store_subtitles(original_path, reversed_path, use_cache=True):
.where(TableEpisodes.path == original_path)\
.dicts()\
.get()
except DoesNotExist:
logging.exception(f"BAZARR error when trying to select this episode from database: {reversed_path}")
else:
try:
subtitle_languages = embedded_subs_reader(reversed_path,
file_size=item['file_size'],
episode_file_id=item['episode_file_id'],
@ -62,7 +67,9 @@ def store_subtitles(original_path, reversed_path, use_cache=True):
logging.debug("BAZARR unable to index this unrecognized language: %s (%s)", subtitle_language, error)
except Exception as e:
logging.exception(
"BAZARR error when trying to analyze this %s file: %s" % (os.path.splitext(reversed_path)[1], reversed_path))
"BAZARR error when trying to analyze this %s file: %s" % (os.path.splitext(reversed_path)[1],
reversed_path))
pass
try:
dest_folder = get_subtitle_destination_folder()
core.CUSTOM_PATHS = [dest_folder] if dest_folder else []
@ -130,6 +137,10 @@ def store_subtitles_movie(original_path, reversed_path, use_cache=True):
.where(TableMovies.path == original_path)\
.dicts()\
.get()
except DoesNotExist:
logging.exception(f"BAZARR error when trying to select this movie from database: {reversed_path}")
else:
try:
subtitle_languages = embedded_subs_reader(reversed_path,
file_size=item['file_size'],
movie_file_id=item['movie_file_id'],
@ -157,7 +168,8 @@ def store_subtitles_movie(original_path, reversed_path, use_cache=True):
pass
except Exception:
logging.exception(
"BAZARR error when trying to analyze this %s file: %s" % (os.path.splitext(reversed_path)[1], reversed_path))
"BAZARR error when trying to analyze this %s file: %s" % (os.path.splitext(reversed_path)[1],
reversed_path))
pass
try:

Loading…
Cancel
Save