vosmiic / jellyfin-ani-sync

Synchronize anime watch status between Jellyfin and anime tracking sites.
GNU General Public License v3.0
215 stars 15 forks source link

Read Anidb ID from the season before trying to use the season offset from Tvdb #119

Open Terrails opened 3 months ago

Terrails commented 3 months ago

Currently the plugin doesn't really like any kind of setup where specials are in their own season, resulting in seasons being detected wrongly. I'm using Shokofin as my metadata provider and it uses S1 normally, but the specials that aired after (and have their own anime entry on anidb) are in their own season marked as S2, with actual S2 getting offset to S3. This causes this plugin to think that the actual S2 is S3 and updates the wrong entry in the list. I was talking about the slime isekai (TenSura) in this example, but there most definitely are more examples.

The author of Shokofin told me that they set the AniDB id per season here. Ani-sync seems to be fetching that ID but uses it just to find the Tvdb ID and then just uses the season with the same number as the one set in jellyfin.

My question is that if a season already has an AniDB id set, shouldn't that just be returned directly from the GetAniDbId method? I have tested this myself and it seems to make it work as intended. As far as I am aware the Anidb plugin only sets this id on a series level, so anything set at season level should only be set by Shokofin.

vosmiic commented 2 months ago

Special support by the plugin has always been a bit awkward. I have been meaning to re-write some of the logic around the detection of specials because, as you have experienced, its not good.

My question is that if a season already has an AniDB id set, shouldn't that just be returned directly from the GetAniDbId method? I have tested this myself and it seems to make it work as intended. As far as I am aware the Anidb plugin only sets this id on a series level, so anything set at season level should only be set by Shokofin.

Yes, you are right, we should be using the season level AniDB ID, if it exists. The reason that we don't bother checking was because of the AniDB metadata plugin that, as you outlined, sets it at the series level which forces the plugin to use the season number set by Jellyfin which isn't always accurate.

That being said, I am now aware of the Shokofin plugin, and would like to add support for its metadata capabilities to this plugin. As it sets the AniDB ID at the season level, it could very potentially become the most compatible metadata provider for the plugin.

I am currently away from my dev PC so development is slow, but I will take a look at this when I get a chance. As a quick, temporary workaround I will test your solution of just returning the season level AniDB ID and see if I can get it into the upcoming beta release.

Terrails commented 2 months ago

I have compiled my own version of ani-sync which just returns the AniDB id when its set on a season level and it has been working great for now.

Shokofin's solution does require Shoko Server, so it cannot work on its own, but compared to every other provider, it probably gives the best experience for anime in Jellyfin, so thank you for considering support for it!

revam commented 2 months ago

Just adding some information from my/our side on this issue:

The Shokofin plugin currently provides the AniDB anime ID on season/series entries and the AniDB episode ID for the first episode of the given type on episode entries to Jellyfin for other plugins to use. Though when using the IDs in a library managed by the plugin, there are a couple of specific challenges that need addressing:

In 99% of use cases, these challenges won't be an issue. However, for the remaining 1%, using just the AniDB anime ID and the episode number within the season to determine episodes for syncing can be problematic. Deeper integration between the plugins will be necessary to ensure accurate syncing of AniList episode statuses in libraries managed by the Shokofin plugin. Feel free to ask me for more details about Shokofin or Shoko (if needed) or propose a solution if you believe we can work together to integrate our plugins. Or, if you believe this is outside the scope of your plugin to support, feel free to say no, and we'll leave it at this. We'll respect your decision either way. :slightly_smiling_face:

vosmiic commented 2 months ago

Thanks @revam, I think getting our plugins to work together makes absolute sense, since they both compliment each other, and I will most definitely take you up on that offer. Like I said in my previous comment, I am currently away from my dev PC so I am not extending the functionality of the plugin at the moment and really only fixing major bugs, but when I am next able to work on the plugin (should be mid to late May) I'll look into adding support for the Shokofin plugin. If I have any questions (I'm sure I will) I'll open an issue/discussion on the Shokofin repo. Thanks again for offering to work together on this!