diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py index 5057eb9b1..0eff91856 100644 --- a/libs/subliminal_patch/core.py +++ b/libs/subliminal_patch/core.py @@ -627,7 +627,7 @@ def _search_external_subtitles(path, languages=None, only_one=False, scandir_gen try: language = Language.fromietf(language_code) language.forced = forced - except ValueError: + except (ValueError, LanguageReverseError): logger.error('Cannot parse language code %r', language_code) language_code = None except IndexError: diff --git a/libs/subliminal_patch/providers/addic7ed.py b/libs/subliminal_patch/providers/addic7ed.py index 86e1a810a..f24a35634 100644 --- a/libs/subliminal_patch/providers/addic7ed.py +++ b/libs/subliminal_patch/providers/addic7ed.py @@ -178,14 +178,13 @@ class Addic7edProvider(_Addic7edProvider): :rtype: int """ show_id = None - show_ids = {sanitize(series).lower(), sanitize(series.replace(".", "")).lower()} - logger.debug("Trying show ids: %s", show_ids) - for series_sanitized in show_ids: - if not ignore_cache: - show_ids = self._get_show_ids() - else: - show_ids = self._get_show_ids.refresh(self) + ids_to_look_for = {sanitize(series).lower(), sanitize(series.replace(".", "")).lower()} + show_ids = self._get_show_ids() + if ignore_cache or not show_ids: + show_ids = self._get_show_ids.refresh(self) + logger.debug("Trying show ids: %s", ids_to_look_for) + for series_sanitized in ids_to_look_for: # attempt with country if not show_id and country_code: logger.debug('Getting show id with country') @@ -265,6 +264,9 @@ class Addic7edProvider(_Addic7edProvider): logger.debug('Found %d show ids', len(show_ids)) + if not show_ids: + raise Exception("Addic7ed: No show IDs found!") + return show_ids @region.cache_on_arguments(expiration_time=SHOW_EXPIRATION_TIME) @@ -364,7 +366,7 @@ class Addic7edProvider(_Addic7edProvider): # ignore incomplete subtitles status = cells[5].text - if status != 'Completed': + if "%" in status: logger.debug('Ignoring subtitle with status %s', status) continue