diff options
author | Anderson Shindy Oki <[email protected]> | 2024-07-16 11:52:26 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2024-07-16 11:52:26 +0900 |
commit | cb415531d8082e13a744c7a0fc34aefa87f758c5 (patch) | |
tree | 4b54fd1cac04c7847ec4c225398d046227635148 | |
parent | b4195934c1fd5ff97acf07d7fbd82f52e272c520 (diff) | |
download | bazarr-1.4.4-beta.24.tar.gz bazarr-1.4.4-beta.24.zip |
Fixed anidb refiner episode not found (#2581)v1.4.4-beta.24
-rw-r--r-- | bazarr/subtitles/refiners/anidb.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bazarr/subtitles/refiners/anidb.py b/bazarr/subtitles/refiners/anidb.py index f3c61916a..36ed05786 100644 --- a/bazarr/subtitles/refiners/anidb.py +++ b/bazarr/subtitles/refiners/anidb.py @@ -83,9 +83,9 @@ class AniDBClient(object): for index, anime_info in enumerate(animes): anime, episode_offset = anime_info - anidb_id = int(anime.attrib.get('anidbid')) + if episode > episode_offset: - anidb_id = anidb_id + anidb_id = int(anime.attrib.get('anidbid')) offset = episode_offset return anidb_id, episode - offset @@ -101,7 +101,12 @@ class AniDBClient(object): episodes = etree.fromstring(self.get_episodes(series_id)) - return series_id, int(episodes.find(f".//episode[epno='{episode_no}']").attrib.get('id')) + episode = episodes.find(f".//episode[epno='{episode_no}']") + + if not episode: + return series_id, None + + return series_id, int(episode.attrib.get('id')) @region.cache_on_arguments(expiration_time=REFINER_EXPIRATION_TIME) def get_episodes(self, series_id): |