summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvitiko98 <[email protected]>2021-06-08 18:42:34 -0400
committervitiko98 <[email protected]>2021-06-08 18:42:34 -0400
commit5b1f4799014f9e8a91e1bd037a86db585c5423e8 (patch)
tree9300e9624a2777f19b784f41b5bb0813c5bf7773
parent90ba573ebe9f3660a0aa61f81a0a885df5468213 (diff)
downloadbazarr-5b1f4799014f9e8a91e1bd037a86db585c5423e8.tar.gz
bazarr-5b1f4799014f9e8a91e1bd037a86db585c5423e8.zip
Fix Sucha provider: AttributeError and wrong matches
-rw-r--r--libs/subliminal_patch/providers/sucha.py9
1 files 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(