AniDB metadata agent



Version 1 is working for me /woot. Installed, restarted the server a few times (sacrificed that goat I've been saving) and it started working.


Okeli-dokeli, I feel bad for the goat, but hey - you're getting anime metadata :D Still strange though, I take it version 2 didn't work properly either?

Version 1 worked for a second then quit after restart. I compared the logs, the only thing I can see different is “2012-04-11 07:39:01,122 (1c8) : INFO (core:318) - Could not load file data, msg: You must be authed to execute commands besides AUTH and PING”. Logs are attached. Ignore the first part of 1st Try, I fat-fingered the folder name in PMS.



Also, thanks for working with us on this.

OMFG, I think it’s an AniDB freakout. I let it sit for a few mins while I made some coffee and now it works.

1 Like


There's a limit as to how often you can try to authenticate that might come into play here. Checkout the paragraph "Connection problems" at [http://wiki.anidb.info/w/UDP_API_Definition](http://wiki.anidb.info/w/UDP_API_Definition). I'll see what can be done about this, but again this is a limitation of the AniDB API.


Well, at least I've got it working. Let me know if you need any further info for replication purposes.

Thanks for a great plugin.

I originally installed it with the unsupported plugin thing and then manually replaced it with the direct download.



This time I shut down PMS and then deleted all the files replated to anidb and unsupportedplugin and then did a fresh unzip into the plugins folder of just the anidb files.



I’m running it now again to see if it is working and will have to report back in a bit to see for sure. I still have the ANIDB checkbox grayed out in PMM when I go to Preferences and then select AniDB. Is it grayed out for anyone who has it working?



Let me know if it works out - I did see some strange behaviour on Windows 7 yesterday myself. I'll have a try in OSX tonight as well, my Linux installation is still working without issues. The checkbox can be ignored, AniDB is the only primary agent and there's really no point in selecting/deselecting it.

@Pallimud

Ok, after some testing - make sure you update the correct settings file for the agent (if you’re doing it manually). You need to update com.plexapp.agents.anidb.xml in the Plug-in Support/Preferences folder to hold



your-username

your-password



DON’T update defaultPrefs.json as the above file will already have been created when installing via Unsupported Appstore. This works dandy for me in Windows 7. Let me know if there are still issues with authentication.

Looks like it is working for me now :smiley:



I still cannot click the checkbox within the Agent when going into Preferences but that doesn’t seem to matter. Also, a big note is that the agent is different for Anime Movies vs Anime TV shows. I’m thinking of editing the app to combine the update function so that you can have one folder for both movies and shows, not sure what the draw backs are or if it is possible yet.



So my solution using Windows 7 was:



[list]

[]Install plugin App manually

[
]edit the defaultsPrefs.json and set my anidb username/password in the default field

[]Seperate anime into movies folder and tv folder

[
]Create two seperate channels, one for anime tv and one for anime movies and set anidb as the agent

[/list]



As OP mentioned, you have to be patient since anidb can be slow and reject requests occasionally.



Lastly, a suggestion. I think the connect is not being cached, so each time a file is updated, a new AUTH is sent to anidb. I may be wrong but looking at my log, it seems to be the case. If this is correct, then storing the AUTH session would make it so fewer requests are done to anidb and help the performance of the plugin. Again, I may be wrong, I’ll have to do more checking but I do see self.connect and self.disconnect called each time for updates.


Excellent, I'm pleased to hear it's working. Plex won't handle a mixed folder with both movies and tv-shows properly, so that won't work I'm afraid.


Yes, a new AUTH is sent every time you search/update metadata, for each movies or show. The nature of AniDB's API makes it tricky to handle authentication over longer periods of time, especially if you're behind a NAT router (which most people are today I would think). That would involve pinging the server occasionally to keep the connection open etc. Too much hassle for too little gain. Perhaps 80 - 90 percent of the time is spent on creating a hash of the media file(s) and most of the remainder is loading the metadata, not the actual authentication calls. If you gain two seconds per show/movie, you would have to have a LOT of shows/movies for that to make a big difference as a whole.

Bottom line, I won't change this behaviour, but feel free to make changes yourself. Read up on the AniDB UDP API first though, as you might get yourself banned if you don't follow the rules for the API.

Oh, and yet again (for you and other readers) - DON'T SET USERNAME AND PASSWORD IN defaultPrefs.json. Use the correct settings file in Plug-in Support/Preferences instead (com.plexapp.agents.anidb.xml). I don't want to spend time troubleshooting authentication issues because of incorrect usage.


Ah that makes sense, thanks for the reply and explanation, I appreciate it a lot.

Also, it looks like my com.plexapp.agents.anidb.xml was updated with the proper username/password but yeah that's an important note you've made. I hope others see it too.

I'm still not getting all my ova's listed properly, I'm going to try switching them to the tv mode to see if maybe they are indexed as that. I'll see how that hows and report anything I find.

Thanks again for an awesome plugin.

[Edit]



So I’m trying to sync my OVAs and I noticed that some that even have the right name don’t get added properly. When I click on the file in PMM and then click ‘Fix incorrect match’ it finds the match from anidb and then I can select it.



Any idea why the plugin doesn’t just use that match that I see when I click the button?

I was reading up on the UDP API and I saw this note in response to what your wrote before:






I'm realizing now that the reason I'm not getting my larger ova library indexed through is because I'm getting a connect timed out error when trying to AUTH after going through maybe 5 files. Those first 5 files never get index because no match can be found, so when the plugin gets past them, it can't AUTH and all remaining files are also not found. Probably if I remove those first few I can get through more.

I'm not that great with Python but I'm going to see if I can figure out how to save the login session. This might remedy the problem. It isn't about speed of AUTHing each time, but it is about AniDB not returning AUTHs if too many are done in a short period of time. So while it doesn't speed up the plugin, it allows for the plugin to continue to pull data from ANIDB rather than having to wait for whatever timeout they have set for the API.


There's no mention about only being allowed a certain amount of logins per time unit, but you could be right. The problem is that their UDP API is not really cut out for the stateless Plex agents. There's no way that the agent can know if another call is likely within 20 minutes or not (or if it's done). Therefore you might run into a situation where you keep the connection open and then you NAT router changes source port and you might get banned. Again, lots of "might" as AniDB is a bit fuzzy on how they accept or don't accept various scenarios or what the consequences are.

I think the best way would be to take their nightly dump, stick into a full-text search engine and create a separate backend that handles searches. Not my top priority right now, but perhaps something for the future.

I have one other questions. For OVAs that are multiple parts, should those go into the TV agent instead of the Movie agent?



I’m not having much luck with the plugin organizing these multipart OVAs, for example ‘5 Centimeters per Second’ is three parts but it just won’t organize it like that or even load the meta data for any of the parts. Same goes for ‘Apocalypse Zero’ which is two parts and basically any other multipart OVA.



Thanks, I appreciate all your replies, I hope they help others too.



Are they picked up by Plex's media scanner? Check the scanner log to see - the agent itself doesn't order anything, it's supplied with values from the scanner. How do you name the files? Plex has support for multi-part movies, read more here http://wiki.plexapp.com/index.php/PlexNine_PMS_Naming_Guide#Stacked_Files.


Yeah, Plex is picking them up but it isn't grouping them or getting meta data for them. I can watch them in Plex though.

This is an example: http://anidb.net/perl-bin/animedb.pl?show=anime&aid=111

It is an OVA, not a TV Show and it has 5 episodes. It isn't a single movie split into 5 parts, but instead 5 episodes that make up a movie. I could throw it into my Anime TV folder, but since this is a OVA, I'd like to have it within my Movies section. Reading the link you gave, that seems like more for a movie that I split into multiple files, rather than a movie that really is multiple files.

What I'm trying now is I've made a new section for Anime OVAs (so three sections: Anime Movies, Anime OVAs, and Anime TV Shows). I've set Anime OVA to use the TV agent and I'm moving any Movie that get the meta data to the OVA folder instead. So far this has been working, but since I have so many files it will take me a while to move the right ones. I think this is the best solution so far, since OVAs don't seem to count as Movies.


My bad, I thought you meant stacked files. Not all OVAs are multi-files though, and my experience is that if not, it's better to keep them in a movie section. If it works for you, then go for it! :) I think it all boils down to finding a working file naming and grouping strategy for your specific needs if you want it to work in Plex.

I wanted to give a final update as to how I am dealing with Movies/OVAs/TV Shows.



This plugin is great but either due to its own limitations for the limitations of AniDB’s UDP API you have to maneuver to get things to work perfectly.



Anime Movies (set as a Movie section)

[list]

[]Single episode Movies or OVA files

[
]Do not put multi-episode OVAs here

[]If you have a movie split into multiple files, you can put it here so long as they aren’t separate episodes and you follow Plex’s naming convention for movie parts.

[
]You can set the Agent to AniDB plugin for Movies

[/list]



Anime OVAs (set as a TV section)

[list]

[]Multi-episode OVAs or Movies should go here

[
]Make sure to follow Plex’s naming convention for episodes

[]First set the default Agent to TheTVDB, most anime series will load this way.

[
]On a case by case basis you can switch the Agent to AniDB and see if the plugin can find the OVA. In some cases it will but if it doesn’t, try again another day or a few hours later.

[/list]



Anime TV (set as a TV section)

[list]

[]This is the simple one for just TV shows

[
]Make sure to follow Plex’s naming convertion for episodes

You can set the default agent to AniDB but if you are having trouble, switch to TheTVDB and then follow the steps from above.

[/list]



This is what I had to do to get everything working. This AniDB plugin is great, but like I said, there are limitations and inconsistent performance. Use TheTVDB to at least get initial meta data, otherwise you’ll always have problems with the AniDB agent when adding many files at once.



Lastly, I had the most success starting with a smaller library and then adding new files once the first ones got indexed properly. If you use TheTVDB, you won’t have this issue, but AniDB plugin eventually will timeout with a large un-indexed library, so don’t push it too hard.



Thanks again for this great plugin. I’m sure AniDB can improve their service and hopefully this plugin can get some more love too.