Fribb / anime-lists-generator

generator for the anime-lists project
8 stars 2 forks source link

[REQ] `thetvdb_season` field #5

Open BrutuZ opened 1 month ago

BrutuZ commented 1 month ago

Seeing as it is available on Anime-Lists as defaulttvdbseason, it would be nice to have this field available to fetch episode information for example.

Fribb commented 1 month ago

The more I look into this, the more problems I find with it.

First, sure, we could add this to the mapping-list but not as a defaulttvdbseason but rather something more generic. Something like a season element that then has individual elements for the websites. This would enable us to add further information in the future if other sources provide that information like the anime-lists project currently does. This could look like this:

[
   {
      "thetvdb_id":70973,
      "anidb_id":2,
      "season":{
         "thetvdb":1
      }
   },
   {
      "thetvdb_id":70973,
      "anidb_id":3,
      "season":{
         "thetvdb":2
      }
   }
]

However, as I said above, the more I look into this, the more problems or inconsistencies I find that the generator would need to fix or address that could even be a problem for your "fetching episode information".

The first one is that defaulttvdbseason is not always only a number but can also be an a like this:

  <anime anidbid="19" tvdbid="83692" defaulttvdbseason="a">
    <name>Rizelmine</name>
    <mapping-list>
      <mapping anidbseason="1" tvdbseason="1" start="1" end="12"/>
      <mapping anidbseason="1" tvdbseason="2" start="13" end="24" offset="-12"/>
    </mapping-list>
  </anime>

The Problem here is that AniDB has only one Entry (id=19) with 24 episodes, but TheTVDB has one show with 2 seasons with 12 episodes each. This would mean that while we could use the defaulttvdbseason to provide the season mapping for an entry, there is just not enough information for defaulttvdbseason=a and that has to be ignored.

But there is more, because the defaulttvdbseason is also used in relation to episodeoffset for individual entries that are part of a season. An example:

The Show Crest of the Stars has 3 Seasons with a Specials Season. There are 7 entries in the anime-lists XML file that have tvdbid="72025" set. You have the normal seasons:

  <anime anidbid="1" tvdbid="72025" defaulttvdbseason="1">
    <name>Seikai no Monshou</name>
    <supplemental-info>
      <studio>Sunrise</studio>
    </supplemental-info>
  </anime>
  <anime anidbid="4" tvdbid="72025" defaulttvdbseason="2">
    <name>Seikai no Senki</name>
    <supplemental-info>
      <studio>Sunrise</studio>
    </supplemental-info>
  </anime>
  <anime anidbid="5" tvdbid="72025" defaulttvdbseason="3">
    <name>Seikai no Senki II</name>
    <mapping-list>
      <mapping anidbseason="0" tvdbseason="0">;1-4;</mapping>
    </mapping-list>
    <supplemental-info>
      <studio>Sunrise</studio>
    </supplemental-info>
  </anime>

But then you also have:

  <anime anidbid="6" tvdbid="72025" defaulttvdbseason="0">
    <name>Seikai no Danshou: Tanjou</name>
    <supplemental-info>
      <studio>Sunrise</studio>
    </supplemental-info>
  </anime>
  <anime anidbid="884" tvdbid="72025" defaulttvdbseason="0" episodeoffset="2">
    <name>Seikai no Senki Tokubetsu Hen</name>
  </anime>
  <anime anidbid="1623" tvdbid="72025" defaulttvdbseason="0" episodeoffset="1">
    <name>Seikai no Monshou Tokubetsu Hen</name>
  </anime>
  <anime anidbid="2673" tvdbid="72025" defaulttvdbseason="0" episodeoffset="4">
    <name>Seikai no Senki III</name>
    <supplemental-info>
      <studio>Sunrise</studio>
    </supplemental-info>
  </anime>

The episodes are part of the Specials season, from top to bottom:

This means that while the defaulttvdbseason is correct and that it is the "specials" Season, you cannot just use that as an indicator for it being a Season but it can also be individual episodes that are part of the specials season.

To make this more robust, we would also need to add the episode information to this which opens another can of worms.

So, to wrap this up:

Yes, we could add the defaulttvdbseason as outlined above to the dataset, but I also think that we should ignore all defaulttvdbseason that are set to 0 or a. I don't really see a benefit in adding those on their own because it would require much more information for this to be understood and can be used, especially in relation to the "mapping list" to cover more complex episode mappings.

I mean, if those information are required, a consumer could get the anime-lists JSON, search for the entry of the ID that it has, get the anime-lists XML and search for the corresponding anidb ID and you already have all of the information available to you that you then can process.

BrutuZ commented 1 month ago

I'd forgotten about the episodeoffset, the mapping-list and specials can be overlooked too since they also tend to rely on episode-level details, easier to avoid that can of worms. Instead of being ignored, absolute could also map to season 1. I guess season 1 could also be assumed as the default on the client-side, so either would work.

The use I first had in mind was pairing it with Flexget to assign the proper season so it can fetch the metadata and save to media-center compatible paths

Fribb commented 1 month ago

Instead of being ignored, absolute could also map to season 1.

I don't know about that. While I add Data to the entries (by searching for IMDB/TMDB IDs etc) I wouldn't want to make much data manipulation to the original sources. When we have the defaulttvdbseason=a then this would be a manipulation of the original source as well as technically not being correct since it isn't season 1 on TheTVDB side, it could also be season 2.

Because of that inconsistency, I would rather not provide that information in the first place.

From a consumer point of view, I would think that it should be easy to understand without having to keep caveats in mind. I mean, most won't read the documentation anyway so the JSON should be fairly self-explanatory.

But when we say that we add a "season" element and add "thetvdb" with one of those edge cases, then this could be easily overlooked by the sheer number and size of the list. So someone would, for example, see season 0 and deduce from that it is the Specials season without realizing directly that this is, in fact, not the whole season but rather only one episode of it.

This then would raise the question (and probably feature request) of adding the episode mapping, which I really want to avoid.

My plan would be the following:

BrutuZ commented 1 month ago

Seems like a good compromise to me 👍