This is the first release of the HTTP AniDB Metadata Agent (HAMA), an alternative AniDB-based anime metadata agent to [Tuffo's excellent UDP-based AniDB agent](http://forums.plexapp.com/index.php/topic/37750-anidb-metadata-agent/).
Features:
- Movie and TV agent
- Uses AniDB's HTTP API for significantly improved lookup times1
- For TV anime, performs a secondary search against the TVDB to pull down banners, posters and backgrounds2
- Correctly handles episode names for Specials (as in the UDP version)
- Maps the top 5 categories in AniDB to the genre list
- Extracts Studios3, Writers, Directors, Producers credits from AniDB
- Estimates the duration of each episode (average of all non-special episode lengths)
- Marks 18-restricted Content4
1 I haven't actually measured them side-by-side but it seems much faster and on paper it should be, as all data is looked up with one request
2 This behavior can be disabled or only enabled for specific image types. By default, we select AniDB's poster, but this can be disabled. If like me, you use Local Media Assets to set background images in the media folder, you should move that plugin to the top of the priority list or else this agent's backgrounds will be selected instead.
3 Plex tends to map Studio names to TV Studios and so you may see some TV Studio logos popping up as a result of this (eg the anime studio Seven Arcs will display Australia's Channel Seven logo) so I may remove it.
4 It marks it as NC-17 - this causes Plex to mark it with a rating logo. Does not look up TVDB for Adult content
Limitations & Notes:
- Provided your media has a hash known to AniDB, Tuffo's UDP client will always give a correct identification. Because AniDB does not expose any sort of search mechanism over HTTP, I instead am running a mirror of an AniDB name search system written by [Eloyard](http://anisearch.outrance.pl/doc.html) as his own deployment's database is around six months out of date. The lookup is slightly fuzzy and can be innacurate in some cases.
- In the event that matching is simply not working correctly you can bypass the search process if you know the correct AniDB Anime ID for the show by searching for 'aid:' followed by the numerical id
- There is no explicit AniDB to TVDB mapping - it is simply a text-based search, looking for a complete match. AniDB lists every season of a TV show separately, where TVDB will munge them all into one season regardless of whether it makes sense to do so. Generally it seems that searching with the official English title from AniDB gives the correct hit on TVDB but this may not always be the case. There's no way to override the match at the moment and if you really want those pictures you may need to manually add them.
- While there is a significant speedup over the UDP API, I have also had to add some flooding control. AniDB's HTTP API has flood protection that may ban you if you re-request the same content more than once on a given day, or if you request data faster than once every 2 seconds on average. As such, all results are cached for 24 hours and all lookups are kept at least 2 seconds apart. Plex tends to use one thread per series lookup, so this makes the behavior when scanning multiple series at once slightly slower. But there is only one lookup per show so in most cases you won't notice a problem. There is an outside chance that the 24-hour cache will cause you to miss new episode names if you're watching very current shows, but generally new episode titles are entered into AniDB days or weeks in advance of screening so again, this shouldn't be an issue.
- I'm not a Python programmer - this is the first major thing I've ever written in Python, I usually work in C++ or C#. As such there are likely tons of bugs and inefficiencies. I'm not responsible if you get banned from AniDB despite my best efforts to avoid this. I am also not responsible if for some reason my code breaks or eats your homework. It's working fairly well for me in my limited testing, however.
- There's heaps and heaps of debug logging still in place. I'll cut it back a bit once it's stable.
Usage: Just extract Hama.bundle to your Plex Media Server's plugin library and restart Plex Media Server and it should appear as a selectable agent. If you have long-running shows with more than a hundred episodes, eg Naruto, I suggest also running [BABS](http://forums.plexapp.com/index.php/topic/31081-better-absolute-scanner-babs/?hl=babs) as your Scanner, as it handles these shows properly (the default Plex TV scanner will assume that episode 101 is season 1 episode 01 and so on). You can set TVDB-related image options in the options for the plugin.
Please let me know if you run into problems and I'll be happy to fix them.
Update 25th April 2013: New version v0.2.
Update 6th May 2013: New version v0.3, should fix syntax error issues when parsing air date.
Update 7th May 2013: New version v0.4, should fix issue with erroneous attempt to look up movies in TVDB