From c492de8b670e11c7c5a33e57dd10dca04093c18e Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 25 Sep 2022 08:38:27 -0400 Subject: [PATCH] Fixed episodes subtitles search when notified of import by Sonarr v3 SignalR feed. #1946 --- bazarr/app/signalr_client.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bazarr/app/signalr_client.py b/bazarr/app/signalr_client.py index 1f64ac479..0d3693841 100644 --- a/bazarr/app/signalr_client.py +++ b/bazarr/app/signalr_client.py @@ -18,6 +18,7 @@ from sonarr.sync.series import update_series, update_one_series from radarr.sync.movies import update_movies, update_one_movie from sonarr.info import get_sonarr_info, url_sonarr from radarr.info import url_radarr +from .database import TableShows from .config import settings from .scheduler import scheduler @@ -236,8 +237,17 @@ def dispatcher(data): series_title = data['body']['resource']['title'] series_year = data['body']['resource']['year'] elif topic == 'episode': - series_title = data['body']['resource']['series']['title'] - series_year = data['body']['resource']['series']['year'] + if 'series' in data['body']['resource']: + series_title = data['body']['resource']['series']['title'] + series_year = data['body']['resource']['series']['year'] + else: + series_metadata = TableShows.select(TableShows.title, TableShows.year)\ + .where(TableShows.sonarrSeriesId == data['body']['resource']['seriesId'])\ + .dicts()\ + .get_or_none() + if series_metadata: + series_title = series_metadata['title'] + series_year = series_metadata['year'] episode_title = data['body']['resource']['title'] season_number = data['body']['resource']['seasonNumber'] episode_number = data['body']['resource']['episodeNumber']