Fixed anidb refiner episode not found (#2581)

pull/2579/head v1.4.4-beta.24
Anderson Shindy Oki 4 months ago committed by GitHub
parent b4195934c1
commit cb415531d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -83,9 +83,9 @@ class AniDBClient(object):
for index, anime_info in enumerate(animes): for index, anime_info in enumerate(animes):
anime, episode_offset = anime_info anime, episode_offset = anime_info
anidb_id = int(anime.attrib.get('anidbid'))
if episode > episode_offset: if episode > episode_offset:
anidb_id = anidb_id anidb_id = int(anime.attrib.get('anidbid'))
offset = episode_offset offset = episode_offset
return anidb_id, episode - offset return anidb_id, episode - offset
@ -101,7 +101,12 @@ class AniDBClient(object):
episodes = etree.fromstring(self.get_episodes(series_id)) 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) @region.cache_on_arguments(expiration_time=REFINER_EXPIRATION_TIME)
def get_episodes(self, series_id): def get_episodes(self, series_id):

Loading…
Cancel
Save