Added a validation to confirm if media file exists during initial sync before trying to search for subtitles. #2866

This commit is contained in:
morpheus65535 2025-04-03 22:15:46 -04:00
parent 78c44f9662
commit 63a3622615
2 changed files with 16 additions and 6 deletions

View file

@ -339,6 +339,11 @@ def update_one_movie(movie_id, action, defer_search=False):
f'BAZARR searching for missing subtitles is deferred until scheduled task execution for this movie: '
f'{path_mappings.path_replace_movie(movie["path"])}')
else:
logging.debug(
f'BAZARR downloading missing subtitles for this movie: {path_mappings.path_replace_movie(movie["path"])}')
movies_download_subtitles(movie_id)
mapped_movie_path = path_mappings.path_replace_movie(movie["path"])
if os.path.exists(mapped_movie_path):
logging.debug(f'BAZARR downloading missing subtitles for this movie: {mapped_movie_path}')
movies_download_subtitles(movie_id)
else:
logging.debug(f'BAZARR cannot find this file yet (Radarr may be slow to import movie between disks?). '
f'Searching for missing subtitles is deferred until scheduled task execution for this movie: '
f'{mapped_movie_path}')

View file

@ -264,6 +264,11 @@ def sync_one_episode(episode_id, defer_search=False):
f'BAZARR searching for missing subtitles is deferred until scheduled task execution for this episode: '
f'{path_mappings.path_replace(episode["path"])}')
else:
logging.debug(
f'BAZARR downloading missing subtitles for this episode: {path_mappings.path_replace(episode["path"])}')
episode_download_subtitles(episode_id, send_progress=True)
mapped_episode_path = path_mappings.path_replace(episode["path"])
if os.path.exists(mapped_episode_path):
logging.debug(f'BAZARR downloading missing subtitles for this episode: {mapped_episode_path}')
episode_download_subtitles(episode_id, send_progress=True)
else:
logging.debug(f'BAZARR cannot find this file yet (Sonarr may be slow to import episode between disks?). '
f'Searching for missing subtitles is deferred until scheduled task execution for this episode'
f': {mapped_episode_path}')