summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAnderson Shindy Oki <[email protected]>2024-07-26 09:09:40 +0900
committerGitHub <[email protected]>2024-07-26 09:09:40 +0900
commit2658638f384aac50a47d6fe5c0264171ae9bcb16 (patch)
treef1143243f655afac301a3fe7fd1c532396df9ba3
parentb304f6f1efecdfa5b258138029b54460267e8032 (diff)
downloadbazarr-2658638f384aac50a47d6fe5c0264171ae9bcb16.tar.gz
bazarr-2658638f384aac50a47d6fe5c0264171ae9bcb16.zip
Fixed anidb refinement for sonarr specials (#2590)v1.4.4-beta.26
-rw-r--r--bazarr/subtitles/refiners/anidb.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bazarr/subtitles/refiners/anidb.py b/bazarr/subtitles/refiners/anidb.py
index 36ed05786..c680bba5a 100644
--- a/bazarr/subtitles/refiners/anidb.py
+++ b/bazarr/subtitles/refiners/anidb.py
@@ -84,6 +84,22 @@ class AniDBClient(object):
for index, anime_info in enumerate(animes):
anime, episode_offset = anime_info
+ mapping_list = anime.find('mapping-list')
+
+ # Handle mapping list for Specials
+ if mapping_list:
+ for mapping in mapping_list.findall("mapping"):
+ # Mapping values are usually like ;1-1;2-1;3-1;
+ for episode_ref in mapping.text.split(';'):
+ if not episode_ref:
+ continue
+
+ anidb_episode, tvdb_episode = map(int, episode_ref.split('-'))
+ if tvdb_episode == episode:
+ anidb_id = int(anime.attrib.get('anidbid'))
+
+ return anidb_id, anidb_episode
+
if episode > episode_offset:
anidb_id = int(anime.attrib.get('anidbid'))
offset = episode_offset