From f8b9726ad1572f08fad6280a5f9d1b6fa2b117d5 Mon Sep 17 00:00:00 2001 From: Anderson Oki Date: Thu, 25 Apr 2024 09:21:52 +0900 Subject: [PATCH] Fix animetosho provider empty subtitle name --- custom_libs/subliminal_patch/providers/animetosho.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_libs/subliminal_patch/providers/animetosho.py b/custom_libs/subliminal_patch/providers/animetosho.py index 25b1ea95b..f242c420f 100644 --- a/custom_libs/subliminal_patch/providers/animetosho.py +++ b/custom_libs/subliminal_patch/providers/animetosho.py @@ -141,8 +141,9 @@ class AnimeToshoProvider(Provider, ProviderSubtitleArchiveMixin): lang = Language.fromalpha3b(subtitle_file['info']['lang']) # For Portuguese and Portuguese Brazilian they both share the same code, the name is the only - # identifier AnimeTosho provides. - if lang.alpha3 == 'por' and subtitle_file['info']['name'].lower().find('brazil'): + # identifier AnimeTosho provides. Also, some subtitles does not have name, in this case it could + # be a false negative but there is nothing we can use to guarantee it is PT-BR, we rather skip it. + if lang.alpha3 == 'por' and subtitle_file['info'].get('name', '').lower().find('brazil'): lang = Language('por', 'BR') subtitle = self.subtitle_class(