From 5b1f4799014f9e8a91e1bd037a86db585c5423e8 Mon Sep 17 00:00:00 2001 From: vitiko98 Date: Tue, 8 Jun 2021 18:42:34 -0400 Subject: [PATCH] Fix Sucha provider: AttributeError and wrong matches --- libs/subliminal_patch/providers/sucha.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/subliminal_patch/providers/sucha.py b/libs/subliminal_patch/providers/sucha.py index 18d965067..52121bec6 100644 --- a/libs/subliminal_patch/providers/sucha.py +++ b/libs/subliminal_patch/providers/sucha.py @@ -99,14 +99,15 @@ class SuchaProvider(Provider): result.raise_for_status() results = result.json() + if isinstance(result, dict): + logger.debug("No subtitles found") + return [] + subtitles = [] for item in results: matches = set() title = item.get("title", "").lower() alt_title = item.get("alt_title", title).lower() - if not title: - logger.debug("No subtitles found") - return [] if any(video.title.lower() in item for item in (title, alt_title)): matches.add("title") @@ -117,7 +118,7 @@ class SuchaProvider(Provider): if is_episode and any( q["query"].lower() in item for item in (title, alt_title) ): - matches.update("title", "series", "season", "episode", "year") + matches.update(("title", "series", "season", "episode", "year")) subtitles.append( SuchaSubtitle(