jellyfin / jellyfin-plugin-anidb

This plugin adds the metadata provider for aniDB to Jellyfin
GNU General Public License v2.0
34 stars 14 forks source link

Parse the AniDB ID from the path if possible #63

Open Dillonb opened 10 months ago

Dillonb commented 10 months ago

Match the behavior of https://github.com/ZeroQI/Absolute-Series-Scanner - a Plex plugin.

I include anidb ids in the names of my anime directories to avoid incorrect matches. This PR will parse those out and use them, if it finds exactly one in the path. I've tested it and it works for my library.

Without this change, as an example, the plugin matched every season of a show in my library as season 1.

I'm open to and would appreciate feedback.

nalsai commented 10 months ago

I am in favor of this change.

However, with Jellyfin you are supposed to use [anidbid-12345], which gets picked up by the standard info.ProviderIds.GetOrDefault, but of course that isn't compatible with ASS.


Also, I don't understand what you mean by

Without this change, as an example, the plugin matched every season of a show in my library as season 1.

This plugin first selects all similar enough titles and then matches the one that is the most similar to the title in Jellyfin (-> your folder name). It will then be internally treated as season 1 or, if you enabled "Ignore Season" in the plugin settings, whatever season you have set it to. But that shouldn't matter much as long as you don't try to use multiple conflicting metadata plugins and you didn't change anything about it.

Dillonb commented 10 months ago

However, with Jellyfin you are supposed to use [anidbid-12345]

I didn't know that. I'm pretty new to Jellyfin and am running it in parallel to Plex for now while I iron out the kinks. This would be a perfect solution but unfortunately I do need it to be compatible with ASS... I don't think I have a unique use case here.

I can make my behavior a fallback if info.ProviderIds.GetOrDefault doesn't find an id instead of the other way around. What do you think?

This plugin first selects all similar enough titles and then matches the one that is the most similar to the title in Jellyfin (-> your folder name). It will then be internally treated as season 1

Ah, yeah I do know about the internal representation as season 1 - I just meant it was failing to match a lot of my series, and when it did match it usually matched against the first season (even if the directory was named "Show X Second Season" exactly as it is on AniDB) - it had particular trouble with shows with a lot of very similarly-named seasons like Attack on Titan and Initial D. 😄

in the regex \d+ should be [0-9]+ and I believe you don't need the brackets

Good call, I'll switch to [0-9]+. As for the brackets, are you saying change the regex to something like @"anidb-([0-9]+)"? I think I need those outer brackets to be compatible with ASS and with how Jellyfin does it as in [anidbid-12345]

nalsai commented 10 months ago

I think it's fine the way you did it but making your behavior a fallback after info.ProviderIds.GetOrDefault might be better, because that way it can keep the id after it was set and doesn't need to run the regex each time.

I meant \[anidb-[0-9]+\]

Dillonb commented 10 months ago

I meant \[anidb-[0-9]+\]

Ah. In that case, I definitely need the parentheses to make a capturing group so I can pull out just the integer ID.

I'll make it a fallback and make sure it still works, then update the PR. Thanks for the review and discussion.

nalsai commented 10 months ago

Ah, yes of course 🤦‍♂️

sjorge commented 10 months ago

Once 10.9.x gets release, would these not better end up in SeasonProviderIds ? Technically from jellyfin's POV anidb only contains seasons as it's trying to strictly follow the TVDB naming. (Which for anime I personally do not agree with, as I like pure anidb naming more)

Perhaps once 10.9.x gets release this should be configurable somehow, I think as long as only anidb is selected as the metadata provider always using the ID to match the show is probably the cleanest. But once another provider is also selected it could get messy.

(HAMA/ASS is pretty great those overall, HAMA matches anidb shows but somehow fetches the proper tvdb season for titles/descriptions. So far I've not even come close to getting such nice metadata on jellyfin.)

nalsai commented 10 months ago

Technically from jellyfin's POV anidb only contains seasons as it's trying to strictly follow the TVDB naming. (Which for anime I personally do not agree with, as I like pure anidb naming more)

Where did you get that from?


The only thing we can do is keep it as is, or handle both cases (Series & Season) as best as possible.

Dillonb commented 10 months ago