Hama.bundle icon indicating copy to clipboard operation
Hama.bundle copied to clipboard

Multiple TVDB episodes mapped to the same anidb episode

Open KurtzPT opened this issue 2 years ago • 30 comments

So I found an issue that probably is happening to a bunch of other shows where episodes are being mapped to two different seasons at the same time on TVDB.

Example:

File to test it: [!] file: "/media/Ani-Test/Sword Art Online Alicization (2018) [anidb-13493]/Sword Art Online Alicization - 03.mkv"

Some logs:

--- AniDBTVDBMap -------------------------------------------------------------------------------------------------------------------------------------------- [+] AniDBid: 13493, TVDBid: 259640, defaulttvdbseason: 3, offset: 0, TMDBid: , IMDBid: , name: Sword Art Online: Alicization - season: [ 0], [ 0], range: [000-000], offset: 0, text: 1-24;2-25 ----- ------ 13493 259640 [ ] collection: TVDBid '259640' is part of collection: '['Sword Art Online Collection']', related_anime_list: ['8692', '10022', '10376', '11681', '13493', '14796', '15146'] [ ] studio: --- return -------------------------------------------------------------------------------------------------------------------------------------------------- AniDB_id: '13493', AniDB_id2: '13493', AniDBid: '13493', TVDB_id: '', TVDB_id2: '259640', TVDBid: '259640' mappingList: { 'defaulttvdbseason': '3', 'defaulttvdbseason_a': False, 'episodeoffset': '0', 'name': 'Sword Art Online: Alicization', 'possible_anidb3': False, 's1e1_mapped': False, 'season_map': {'13493': {'max': '3', 'min': '3'}}, 'TVDB': {'s0e24': ('0', '1', '13493'), 's0e25': ('0', '2', '13493'), 's3': {'13493': '0'}}, 'tvdbcount': 1}

Episodes match:

[X] s1e3 s01e003 anidbid: xxxxxxx air_date: 2012-07-22 abs_number: 3, title: The Red-Nosed Reindeer and

[X] s3e3 s01e003 anidbid: 13493 air_date: 2018-10-21 abs_number: 53, title: The End Mountains


ASS Logs:

============================================================================================================================================================= Call: "Plex", path: "Sword Art Online Alicization (2018) [anidb-13493]", folder_show: "Sword Art Online Alicization (2018) [anidb-13493]", dirs (0), files (1) ============================================================================================================================================================= Forced ID (series folder) - source: "anidb", id: "13493" "Sword Art Online Alicization (2018) [anidb-13493]" s01e 3 "Word Search" "" "Sword Art Online Alicization - 03.mkv" =============================================================================================================================================================

This is an issue because in this example it sometimes sets thumbs from the season 1 episode as the default thumb (while downloading the correct season 3 episode thumb).

KurtzPT avatar Jan 29 '22 22:01 KurtzPT

To add to this, I have had the same issue alongside the main posters for the series all being the same when using sorting by anidb. e.g. Folder structure: Sword Art Online [anidb-8692] Sword Art Online II [anidb-10376] Sword Art Online: Alicization [anidb-13493]

All three of these will grab the same TVDB poster for the show and set it as the main poster, however after looking at the downloaded posters, it seems the correct posters are being downloaded, but just not set as the main poster. This seems to be a related issue with the thumbnails where "Sword Art Online: Alicization [anidb-13493]" is using thumbnails from the show "Sword Art Online [anidb-8692]" even though it downloads the correct thumbnails but just doesn't seem to default it.

ZyFinity avatar Feb 03 '22 03:02 ZyFinity

Issue is tvdb to anidb. Episode mapping as both tvdb épisode point to the same episode in the end: [X] s1e3 s01e003 anidbid: xxxxxxx air_date: 2012-07-22 abs_number: 3, title: The Red-Nosed Reindeer and [X] s3e3 s01e003 anidbid: 13493 air_date: 2018-10-21 abs_number: 53, title: The End Mountains

@ZiFinity not same issue. Check in hama logs at the end the series poster selected and it's priority but pretty sure AniDB is not first in metqdqtq source order in settings be side the quality is often crap and TheTVDB poster can't differentiate series at that level...

ZeroQI avatar Feb 03 '22 08:02 ZeroQI

Oh, can't hama differentiate by grabbing the poster under the anidb show to tvdb season mapping as tvdb seasons have posters? I thought hama was supposed to do this?

ZyFinity avatar Feb 03 '22 09:02 ZyFinity

Issue is tvdb to abide. Episode mapping as both tvdb épisode point to the same episode in the end: [X] s1e3 s01e003 anidbid: xxxxxxx air_date: 2012-07-22 abs_number: 3, title: The Red-Nosed Reindeer and [X] s3e3 s01e003 anidbid: 13493 air_date: 2018-10-21 abs_number: 53, title: The End Mountains

Mapping from anidb to tvdb comes from the anime-list file and if you check that file mapping what you are saying is not correct:

<anime anidbid="13493" tvdbid="259640" defaulttvdbseason="3" episodeoffset="" tmdbid="" imdbid="">
    <name>Sword Art Online: Alicization</name>
    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;1-24;2-25;</mapping>
    </mapping-list>
  </anime>

As you can see above, defaulttvdbseason is set to 3 so episode number 1 mapped to anidb-13493 should always go to s03e01 and NEVER s01e01.

KurtzPT avatar Feb 03 '22 09:02 KurtzPT

@KurtzPT Wait, why would it even convert to Season 3? Unless I'm missing something, anidb is meant to keep AniDB's mapping, which is only 1 "season" for regular episodes. If you want to convert to TVDB seasons anidb2 is the go-to (per https://github.com/ZeroQI/Absolute-Series-Scanner#forcing-the-movieseries-id - SAO is even the used example)

BrutuZ avatar Feb 07 '22 00:02 BrutuZ

@KurtzPT Wait, why would it even convert to Season 3? Unless I'm missing something, anidb is meant to keep AniDB's mapping, which is only 1 "season" for regular episodes. If you want to convert to TVDB seasons anidb2 is the go-to (per https://github.com/ZeroQI/Absolute-Series-Scanner#forcing-the-movieseries-id - SAO is even the used example)

You didn't understand my point, when I mentioned season 3 I wasn't referring the season in Plex but instead I was referring where hama should grab the Metadata on tvdb.

So if I use anidb mode, everything on Plex is season 1, but the Metadata is grabbed from anidb and the associated episodes on tvdb (which in this case they are on season 3 in the tvdb website)

But it's clear there's a bug in the agent because it maps all episodes to two different seasons on tvdb, when the mapping file only defines season 3 as the correct mapping.

KurtzPT avatar Feb 07 '22 01:02 KurtzPT

To add, this isn't just with SAO, It's happening with other shows that are also on the mapping file.

ZyFinity avatar Feb 07 '22 05:02 ZyFinity

To add, this isn't just with SAO, It's happening with other shows that are also on the mapping file.

Hence the 'another mapping' starting the bug report title... Bug report is a duplicate of another issue https://github.com/ZeroQI/Hama.bundle/issues/496

The function that maps TheTVDB to AniDB ep number has flaws

  • To be fixed. Bug located in this function: https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/AnimeLists.py#L299
  • failsafe to not allow multiple mappings to the same ep. Failsafe to be implimented after this function call: https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/TheTVDBv2.py#L171

ZeroQI avatar Feb 07 '22 09:02 ZeroQI

To add, this isn't just with SAO, It's happening with other shows that are also on the mapping file.

Hence the 'another mapping' starting the bug report title... Bug report is a duplicate of another issue #496

The function that maps TheTVDB to AniDB ep number has flaws

  • To be fixed. Bug located in this function: https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/AnimeLists.py#L299
  • failsafe to not allow multiple mappings to the same ep. Failsafe to be implimented after this function call: https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/TheTVDBv2.py#L171

I found that issue before, but since the title of that issue says "same season" I wasn't sure if it was the proper place, since my example is basically episodes mapped to multiple seasons.

KurtzPT avatar Feb 07 '22 10:02 KurtzPT

Different thetvdb episodes mapped to same episode, shouldn't happen and same function is at fault

I haven't been using plex for years, NAS is shutdown and in Ireland, am in France with work laptop, will not reproduce issues. I can try coding without tests like i usually do, here is my attempt at a failsafe to not allow multiple mappings to the same ep.

Failsafe to be implemented after this function call, should remove bad mappings n the meantime and limit bad metadata: https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/TheTVDBv2.py#L171:

        if Dict(mappingList, 'defaulttvdbseason_a'):  season, episode          = '1', str(abs_number)
        else:
               season_, episode_, anidbid_ = AnimeLists.anidb_ep(mappingList, season, episode)
               if Dict(TheTVDB_dict, 'seasons', season_, 'episodes', episode_):  season, episode, anidbid = '0',      '0',      ''
               else:                                                             season, episode, anidbid = season_', episode_, anidbid_

or maybe simpler and better: :

        if Dict(mappingList, 'defaulttvdbseason_a'):  season, episode          = '1', str(abs_number)
        else:
               season, episode, anidbid = AnimeLists.anidb_ep(mappingList, season, episode)
               if Dict(TheTVDB_dict, 'seasons', season, 'episodes', episode):  continue  #ep and season tuple already mapped, we skip as a failsafe to prevent bad metadata 

If somebody can test (KurtsPT?) and see if the mapping to the same valid ep is resolved, then i need to fix the initial issue but need logs to see the mapping before/after and figure out the actual fix.

Edit: Work in progress of the mapping debugging

Mapping issue located in function: https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/AnimeLists.py#L299

  • [X] s1e3 tvdb => s01e003 anidbid
  • [X] s3e3 tvdb=> s01e003 anidbidis
  • ScudLee XML anime mapping:
 <anime anidbid="13493" tvdbid="259640" defaulttvdbseason="3" episodeoffset="" tmdbid="" imdbid="">
    <name>Sword Art Online: Alicization</name>
    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;1-24;2-25;</mapping>
    </mapping-list>
  </anime>
  • mappingList: { 'defaulttvdbseason': '3', 'defaulttvdbseason_a': False, 'episodeoffset': '0', 'name': 'Sword Art Online: Alicization', 'possible_anidb3': False, 's1e1_mapped': False, 'season_map': {'13493': {'max': '3', 'min': '3'}}, 'TVDB': {'s0e24': ('0', '1', '13493'), 's0e25': ('0', '2', '13493'), 's3': {'13493': '0'}}, 'tvdbcount': 1}
  • season 1 episode 3 should map to nothing (s01e03 wrongly currently), while season 3 episode 3 should map to season 1 episode 3
  • would be good to enable debug and give me the text output of anidb_ep(mappingList, season, episode) for the correct and impacted episodes
### Translate TVDB numbering into AniDB numbering ###
def anidb_ep(mappingList, season, episode):
  debug = False
  if debug:  Log.Info('[?] (#1) season: {}, episode: {}'.format(season, episode))

  # <mapping-list> <mapping anidbseason="0" tvdbseason="0">;1-5;2-6;</mapping>
  # <mapping-list> <mapping anidbseason="1" tvdbseason="5" start="13" end="24" offset="-12"/>
  ep_mapping = Dict(mappingList, 'TVDB', 's'+season+'e'+episode.split('-')[0])
  if ep_mapping:
    if debug:  Log.Info('[?] (#2) Exact mapping: {}'.format(ep_mapping))
    return ep_mapping[0], ep_mapping[1], ep_mapping[2]            #Lvl 3 & 2 direct ep mapping (ep or season with start-end range)
  
  # <mapping-list> <mapping anidbseason="1" tvdbseason="5" offset="-12"/>
  anidbid_list = Dict(mappingList, 'TVDB', 's'+season, default={})
  if debug:  Log.Info('[?] (#3) s{}: {}'.format(season, anidbid_list))
  for offset, anidbid in sorted(zip(anidbid_list.values(), anidbid_list.keys()), key=lambda x: common.natural_sort_key(x[0]), reverse=True):  #reverse value&index and sort per offset
    if debug:  Log.Info("[?] (#3) - offset: {}, anidbid: {}, int(episode.split('-')[0]): {}".format(offset, anidbid, int(episode.split('-')[0])))
    if int(episode.split('-')[0])> int(offset):  return '1', str(int(episode.split('-')[0])-int(offset)), anidbid   #Lvl 1 - defaulttvdbseason + offset
  
  # <anime anidbid="23" tvdbid="76885" defaulttvdbseason="1" episodeoffset="" tmdbid="" imdbid="">
  defaulttvdbseason, episodeoffset, s1e1_mapped = Dict(mappingList, 'defaulttvdbseason'), Dict(mappingList, 'episodeoffset'), Dict(mappingList, 's1e1_mapped')
  if debug:  Log.Info('[?] (#4) defaulttvdbseason: {}, episodeoffset: {}, s1e1_mapped: {}'.format(defaulttvdbseason, episodeoffset, s1e1_mapped))
  if season==defaulttvdbseason and not s1e1_mapped:
    return '1', str(int(episode)-int(episodeoffset)), ''
  
  # Map season 0 episodes directly to tvdb season 0 episodes
  # On condition of being the only anidb id mapped to the tvdbid, its set to season 1, and has no special mappings
  tvdbcount, s1_mapping = Dict(mappingList, 'tvdbcount', default=0), Dict(mappingList, 'TVDB', 's1')
  if debug:  Log.Info('[?] (#5) defaulttvdbseason: {}, episodeoffset: {}, s1e1_mapped: {}'.format(defaulttvdbseason, episodeoffset, s1e1_mapped))
  if season=="0" and tvdbcount==1 and s1_mapping: # Confirm only one entry and its 's1'
    for item in Dict(mappingList, 'TVDB'): # Also that there are no s0 mappings
      if item.startswith("s0"):
        if debug:  Log.Info('[?] (#5) Found: {}'.format(item))
        break
    else:  return season, episode, list(Dict(mappingList, 'TVDB', 's1').keys())[0]
  
  return season, episode, 'xxxxxxx'

ZeroQI avatar Feb 07 '22 10:02 ZeroQI

I can try out and test later today and report back.

KurtzPT avatar Feb 07 '22 10:02 KurtzPT

  • would be good to enable debug and give me the text output of anidb_ep(mappingList, season, episode) for the correct and impacted episodes, with that i can manage without reproducing and hopefully fix

ZeroQI avatar Feb 07 '22 10:02 ZeroQI

Alright tried out the 1st version:

image

It didn't work. It matches everything to season 1 ONLY.

--- AniDBTVDBMap --------------------------------------------------------------------------------------------------------------------------------------------
[+] AniDBid: 13493, TVDBid: 259640, defaulttvdbseason:    3, offset:   0, TMDBid:        , IMDBid:           , name: Sword Art Online: Alicization
    - season: [ 0],           [ 0], range:       [000-000], offset:   0, text: 1-24;2-25
             -----          ------
             13493          259640
[ ] collection: TVDBid '259640' is part of collection: '['Sword Art Online Collection']', related_anime_list: ['8692', '10022', '10376', '11681', '13493', '14796', '15146']
[ ] studio: 
--- return --------------------------------------------------------------------------------------------------------------------------------------------------
AniDB_id: '13493', AniDB_id2: '13493', AniDBid: '13493', TVDB_id: '', TVDB_id2: '259640', TVDBid: '259640'
mappingList: {
  'defaulttvdbseason': '3',
  'defaulttvdbseason_a': False,
  'episodeoffset': '0',
  'name': 'Sword Art Online: Alicization',
  'possible_anidb3': False,
  's1e1_mapped': False,
  'season_map': {'13493': {'max': '3', 'min': '3'}},
  'TVDB': {'s0e24': ('0', '1', '13493'), 's0e25': ('0', '2', '13493'), 's3': {'13493': '0'}},
  'tvdbcount': 1}
AnimeLists_dict: {
  'collections': ['Sword Art Online Collection']}
=== tvdb4.GetMetadata() =====================================================================================================================================
not tvdb4 mode
=== TheTVDB.GetMetadata() ===================================================================================================================================
TVDBid: '259640', IMDbid: '', language_series : ['jap', 'en'], language_episodes: ['en', 'jap']
--- series --------------------------------------------------------------------------------------------------------------------------------------------------
common.LoadFile() - File cached locally - Filename: 'TheTVDB/json/259640/series_jap.json', Age: '13.88 days', Limit: '6 days', url: 'https://api.thetvdb.com/series/259640?jap'
common.SaveFile() - CachePath: '/config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems', file: 'TheTVDB/json/259640/series_jap.json'
[ ] language_rank: 2
[ ] title: Sword Art Online
[ ] original_title: Sword Art Online
common.LoadFile() - File cached locally - Filename: 'TheTVDB/json/259640/series_en.json', Age: '13.88 days', Limit: '6 days', url: 'https://api.thetvdb.com/series/259640?en'
common.SaveFile() - CachePath: '/config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems', file: 'TheTVDB/json/259640/series_en.json'
[ ] language_rank: 2
[ ] title: Sword Art Online
[ ] original_title: Sword Art Online
[ ] IMDbid: tt2250192
[ ] zap2itId: 
[ ] content_rating: TV-14
[ ] originally_available_at: 2012-07-08
[ ] studio: Tokyo MX
[ ] rating: 7.9
[ ] status: Ended
[ ] genres: ['Action', 'Adventure', 'Animation', 'Anime', 'Fantasy', 'Romance', 'Science Fiction', 'Thriller']
[ ] duration: 1500000
--- actors --------------------------------------------------------------------------------------------------------------------------------------------------
common.LoadFile() - File cached locally - Filename: 'TheTVDB/json/259640/actors_en.json', Age: '13.88 days', Limit: '6 days', url: 'https://api.thetvdb.com/series/259640/actors'
common.SaveFile() - CachePath: '/config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems', file: 'TheTVDB/json/259640/actors_en.json'
[ ] role: Silica                                            , name: Rina Hidaka         , photo: 
[ ] role: Kirigaya Kazuto                                   , name: Yoshitsugu Matsuoka , photo: 
[ ] role: Heathcliff                                        , name: Tooru Ookawa        , photo: 
[ ] role: Ryoutarou "Klein" Tsuboi                          , name: Hiroaki Hirata      , photo: 
[ ] role: Rika "Lisbeth" Shinozaki                          , name: Ayahi Takagaki      , photo: 
[ ] role: Administrator                                     , name: Maaya Sakamoto      , photo: 
[ ] role: Andrew Gilbert "Agil" Mills                       , name: Hiroki Yasumoto     , photo: 
[ ] role: Shinkawa Kyouji                                   , name: Natsuki Hanae       , photo: 
[ ] role: Konno Yuuki                                       , name: Aoi Yuuki           , photo: 
[ ] role: Shinichi Nagata                                   , name: Murase Ayumu        , photo: 
[ ] role: KIRIKALVO                                         , name: Kouichi Yamadera    , photo: 
[ ] role: Sugō Nobuyuki                                     , name: Takehito Koyasu     , photo: 
[ ] role: Yui                                               , name: Kanae Itou          , photo: 
[ ] role: Eugeo                                             , name: Nobunaga Shimazaki  , photo: 
[ ] role: Kirigaya Suguha                                   , name: Ayana Taketatsu     , photo: 
[ ] role: Alice                                             , name: Ai Kayano           , photo: 
[ ] role: Shino "Sinon" Asada                               , name: Miyuki Sawashiro    , photo: 
[ ] role: Sachi                                             , name: Saori Hayami        , photo: 
[ ] role: Yuuki Asuna                                       , name: Haruka Tomatsu      , photo: 
--- episodes ------------------------------------------------------------------------------------------------------------------------------------------------
common.LoadFile() - File cached locally - Filename: 'TheTVDB/json/259640/episodes_page1_en.json', Age: '13.88 days', Limit: '6 days', url: 'https://api.thetvdb.com/series/259640/episodes?page=1'
common.SaveFile() - CachePath: '/config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems', file: 'TheTVDB/json/259640/episodes_page1_en.json'
common.LoadFile() - File cached locally - Filename: 'TheTVDB/json/259640/episodes_page2_en.json', Age: '13.88 days', Limit: '6 days', url: 'https://api.thetvdb.com/series/259640/episodes?page=2'
common.SaveFile() - CachePath: '/config/Library/Application Support/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems', file: 'TheTVDB/json/259640/episodes_page2_en.json'
[ ]    s0e1 s00e001 anidbid: xxxxxxx air_date: 2012-10-24
[ ]    s0e2 s00e002 anidbid: xxxxxxx air_date: 2012-12-03
[ ]    s0e3 s00e003 anidbid: xxxxxxx air_date: 2012-12-26
[ ]    s0e4 s00e004 anidbid: xxxxxxx air_date: 2013-01-23
[ ]    s0e5 s00e005 anidbid: xxxxxxx air_date: 2013-02-27
[ ]    s0e6 s00e006 anidbid: xxxxxxx air_date: 2013-03-27
[ ]    s0e7 s00e007 anidbid: xxxxxxx air_date: 2013-04-24
[ ]    s0e8 s00e008 anidbid: xxxxxxx air_date: 2013-05-22
[ ]    s0e9 s00e009 anidbid: xxxxxxx air_date: 2013-06-26
[ ]   s0e10 s00e010 anidbid: xxxxxxx air_date: 2013-12-31
[ ]   s0e11 s00e011 anidbid: xxxxxxx air_date: 2014-12-23
[ ]   s0e12 s00e012 anidbid: xxxxxxx air_date: 2014-10-11
[ ]   s0e13 s00e013 anidbid: xxxxxxx air_date: 2014-10-22
[ ]   s0e14 s00e014 anidbid: xxxxxxx air_date: 2014-11-26
[ ]   s0e15 s00e015 anidbid: xxxxxxx air_date: 2014-12-24
[ ]   s0e16 s00e016 anidbid: xxxxxxx air_date: 2015-01-28
[ ]   s0e17 s00e017 anidbid: xxxxxxx air_date: 2015-02-25
[ ]   s0e18 s00e018 anidbid: xxxxxxx air_date: 2015-03-25
[ ]   s0e19 s00e019 anidbid: xxxxxxx air_date: 2015-04-22
[ ]   s0e20 s00e020 anidbid: xxxxxxx air_date: 2015-05-27
[ ]   s0e21 s00e021 anidbid: xxxxxxx air_date: 2015-06-24
[ ]   s0e22 s00e022 anidbid: xxxxxxx air_date: 2017-02-18
[ ]   s0e23 s00e023 anidbid: xxxxxxx air_date: 2017-09-27
[ ]   s0e24 s00e001 anidbid:   13493 air_date: 2019-02-17
[ ]   s0e25 s00e002 anidbid:   13493 air_date: 2019-10-06
[ ]   s0e26 s00e026 anidbid: xxxxxxx air_date: 2020-04-19
[ ]   s0e27 s00e027 anidbid: xxxxxxx air_date: 2021-10-30
[X]    s1e1 s01e001 anidbid: xxxxxxx air_date: 2012-07-08 abs_number: 1, title: The World of Swords

KurtzPT avatar Feb 07 '22 20:02 KurtzPT

@ZeroQI I set debug on Info.plist file, not sure if you have what you wanted above.

KurtzPT avatar Feb 07 '22 20:02 KurtzPT

I edited out that anidb_ep method to force debug and here's a snipped of s01e01 using the solution 1:

[X]    s1e1 s01e001 anidbid: xxxxxxx air_date: 2012-07-08 abs_number: 1, title: The World of Swords
 - [1] title:   [en] The World of Swords
[?] (#1) season: 1, episode: 2
[?] (#3) s1: {}
[?] (#4) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[?] (#5) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False

And s03e01:

[?] (#1) season: 3, episode: 1
[?] (#3) s3: {'13493': '0'}
[?] (#3) - offset: 0, anidbid: 13493, int(episode.split('-')[0]): 1
[ ]    s3e1 s00e000 anidbid:         air_date: 2018-10-07

KurtzPT avatar Feb 07 '22 21:02 KurtzPT

Second solution: image

Still the same as the 1st solution:

[?] (#1) season: 1, episode: 1
[?] (#3) s1: {}
[?] (#4) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[?] (#5) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[X]    s1e1 s01e001 anidbid: xxxxxxx air_date: 2012-07-08 abs_number: 1, title: The World of Swords
 - [1] title:   [en] The World of Swords
[?] (#1) season: 1, episode: 2
[?] (#3) s1: {}
[?] (#4) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[?] (#5) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[X]    s1e2 s01e002 anidbid: xxxxxxx air_date: 2012-07-15 abs_number: 2, title: Beater
 - [1] title:   [en] Beater
[?] (#1) season: 1, episode: 3
[?] (#3) s1: {}
[?] (#4) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[?] (#5) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[X]    s1e3 s01e003 anidbid: xxxxxxx air_date: 2012-07-22 abs_number: 3, title: The Red-Nosed Reindeer
 - [1] title:   [en] The Red-Nosed Reindeer
[?] (#1) season: 1, episode: 4
[?] (#3) s1: {}
[?] (#4) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[?] (#5) defaulttvdbseason: 3, episodeoffset: 0, s1e1_mapped: False
[X]    s1e4 s01e004 anidbid: xxxxxxx air_date: 2012-07-29 abs_number: 4, title: The Black Swordsman
 - [1] title:   [en] The Black Swordsman
[?] (#1) season: 3, episode: 1
[?] (#3) s3: {'13493': '0'}
[?] (#3) - offset: 0, anidbid: 13493, int(episode.split('-')[0]): 1
[?] (#1) season: 3, episode: 2
[?] (#3) s3: {'13493': '0'}
[?] (#3) - offset: 0, anidbid: 13493, int(episode.split('-')[0]): 2
[?] (#1) season: 3, episode: 3
[?] (#3) s3: {'13493': '0'}
[?] (#3) - offset: 0, anidbid: 13493, int(episode.split('-')[0]): 3
[?] (#1) season: 3, episode: 4
[?] (#3) s3: {'13493': '0'}
[?] (#3) - offset: 0, anidbid: 13493, int(episode.split('-')[0]): 4

KurtzPT avatar Feb 07 '22 21:02 KurtzPT

Possible issue from https://github.com/ZeroQI/Hama.bundle/commit/b475676bcc72fe2a9076b8d86394d1acf7a87bf0 as is the last change to that function. Try reverting these changes and test.

EndOfLine369 avatar Feb 08 '22 00:02 EndOfLine369

I'll try that tomorrow since it's very late now, but if I revert that PR, it will reintroduce the issue that PR fixed. :/

KurtzPT avatar Feb 08 '22 00:02 KurtzPT

Hi, was there any progress regarding this issue? or is the current fix temperamental?

ZyFinity avatar Feb 17 '22 22:02 ZyFinity

BTW, it seems Shingeki no Kyojin OAD [anidb-9826] has the same problems.. Episode titles are from Shingeki no Kyojin [anidb-9541].

plato79 avatar Mar 15 '22 10:03 plato79

Undoing https://github.com/ZeroQI/Hama.bundle/commit/b475676bcc72fe2a9076b8d86394d1acf7a87bf0 fixes a lot of problems with incorrect title names, though #464 should be fixed with another way it seems.

plato79 avatar Mar 15 '22 10:03 plato79

https://github.com/ZeroQI/Hama.bundle/issues/464 got hte following fixes applied:

  • https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/AnimeLists.py#L265 replace mapping = ('0', '0') with mapping = (season, episode)
  • https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/AnimeLists.py#L288 remove mapping = ('0', '0')
  • https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/AnimeLists.py#L336, test if replacing return '0', '0', 'xxxxxxx' with return season, episode, 'xxxxxxx' works

we need to revert. One example in the other case was:

  <anime anidbid="3395" tvdbid="79604" defaulttvdbseason="1">
    <name>Black Lagoon</name>
    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;5-0;</mapping>
    </mapping-list>
  </anime>

Hama does not make the mapping at all in every of these 4 specials. HE had to create anime-list-custom.xml with the following:

<?xml version="1.0" encoding="utf-8"?>
<anime-list>
  <anime anidbid="3395" tvdbid="79604" defaulttvdbseason="1" episodeoffset="" tmdbid="" imdbid="">
    <name>Black Lagoon</name>
  </anime>
</anime-list>

The key point was to know if the mapping file should have been this instead to handle s00e01-04

  <anime anidbid="3395" tvdbid="79604" defaulttvdbseason="1">
    <name>Black Lagoon</name>
    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;1-1;2-2;3-3;4-4;5-0;</mapping>
    </mapping-list>
  </anime>

If we use implied matching, we are going to get conflicts, and better a meta not there than conflicts

  • no mapping-list means it anidb matches tvdb
  • mapping-list presence means it doesn't match, ex s00e05 mapped to nothing [0] but what should be implied for other eps ?

Since mapping are defined as such, i believe the mapping behavior need to be implicit without msapping-list and explicit without, otherwise, we will get mapping issues [https://raw.githubusercontent.com/ScudLee/anime-lists/master/anime-list-master.xml]

  <anime anidbid="2382" tvdbid="77089" defaulttvdbseason="1" episodeoffset="" tmdbid="" imdbid="">
    <name>Cat Ninden Teyandee</name>
    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;1-2;</mapping>
      <mapping anidbseason="1" tvdbseason="1">;1-1;2-2;3-3;4-4;5-5;6-6;7-7;8-8;9-9;10-0;11-10;12-11;13-12;14-13;15-14;16-15;17-16;18-17;19-18;20-19;21-20;22-21;23-22;24-23;25-24;26-25;27-26;28-27;29-28;30-29;31-30;32-31;33-32;34-33;35-34;36-35;37-36;38-37;39-38;40-39;41-40;42-41;43-42;44-43;45-44;46-45;47-46;48-47;49-48;50-49;51-0;52-50;53-51;54-52:</mapping>
    </mapping-list>
  </anime>

What is the consensus on reverting fully the fix ? @KurtzPT We plan to revert the fix due to 4+ tickets for ep mapped to the same episode wreaking havoc. mapping-list when present means the list is accurate and no implicit mapping unless begin/end used

ZeroQI avatar Mar 15 '22 14:03 ZeroQI

If you revert the #464 fix as it is, it will start to not follow the proper logic that was implemented in the anime-list mapping.

In short, you'll fix one issue and create the issue that was happening in #464, because Hama is not applying the correct logic that is being followed by anime-list guys that created and are maintaining the mapping file.

The proper way would be to make both fixes for #500 and #464 without any of them breaking the other.

KurtzPT avatar Mar 15 '22 15:03 KurtzPT

In short, if mapping-list is present, any episode that is matched in it will override the default behaviour of direct episode mapping from anidb to tvdb.

    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;1-1;2-2;3-3;4-4;5-0;</mapping>
    </mapping-list>

So in short looking at the example above, anime-list logic will never put direct episode matchings on mapping-list like this, because that's already the default behaviour of the mapping-list and it's just a waste of space replicating what by default is.

Only the episode 5 entry would be defined in mapping-list since they need to override that mapping because the default there isn't valid (there's no episode 5 in TVDB)

The oficial mapping (which was confirmed by the maintainers of the repo in #464) would be:

    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;5-0;</mapping>
    </mapping-list>

KurtzPT avatar Mar 15 '22 15:03 KurtzPT

On an endnote, looking at the example I gave in the beginning of this issue:

 <anime anidbid="13493" tvdbid="259640" defaulttvdbseason="3" episodeoffset="" tmdbid="" imdbid="">
    <name>Sword Art Online: Alicization</name>
    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;1-24;2-25;</mapping>
    </mapping-list>
  </anime>

The issue I reported above shouldn't even look at mapping-list at all, because it's clearly stated in the mapping file every episode (excluding specials) should be matched to tvdb season 3 (defaulttvdbseason="3") and the mapping-list here is clearly stating that the only overrides that can be done are just for season 0 (AniDB special episodes, defined in anidbseason="0" and mapped to tvdbseason="0")

So in short the Hama logic is broken and reverting #464 will NOT make it right.

KurtzPT avatar Mar 15 '22 15:03 KurtzPT

Has this issue been looked at?

zyfinity01 avatar May 14 '22 22:05 zyfinity01

From last months activity on this project I would say this is not being actively developed by @ZeroQI anymore. I only see PR merges from other people.

Unless someone takes their time around the Python code and make a PR, I don't see this being fixed anytime soon.

KurtzPT avatar May 16 '22 12:05 KurtzPT

From last months activity on this project I would say this is not being actively developed by @ZeroQI anymore. I only see PR merges from other people.

Unless someone takes their time around the Python code and make a PR, I don't see this being fixed anytime soon.

Very unfortunate :( , this bug is my only issue with Hama, can't get EVA, Ghost in the Shell and Monogatari Series, etc. right. Hope someone will take it

co-sine avatar May 17 '22 04:05 co-sine

The problem is still there.

For example for movie "Violet Evergarden Gaiden: Eien to Jidou Shuki Ningyou" instead of "Complete Movie" there is an episode: "Episode 1·"I Love You" and Auto Memoir Dolls" which actually belongs to Violet Evergarden TV series.

plato79 avatar Jun 30 '22 16:06 plato79

This was wrongly closed as completed, since the PR merged logic is failing in some cases.

Unfortunately like I said above, there's no active development on Hama and a lot of stuff is broken at the moment (not just this issue). The repository owner @ZeroQI seems busy and there's no intention (at least publicly announced) from him that any of the stuff broken/failing will be fixed in the future.

KurtzPT avatar Aug 21 '22 14:08 KurtzPT