[Rel] HTTP Anidb Metadata Agent (HAMA)

Check the readme in my signature
It include known issues with the linux commands as you probably a rights issue the general agent logs will have some logs explaining…

@ZeroQI said:
Check the readme in my signature
It include known issues with the linux commands as you probably a rights issue the general agent logs will have some logs explaining…

figured it out, not sure how but i ended up with 2 application support folders.

One at /var/lib/plexmediaserver/library/application support

another at /media/plex/application support

and i was in the wrong one…

Thanks for the quick reply

I got another question.

Beyond Anime I would love to (ab)use HAMA for combined animation/documentaries libraries as well. For example combine the movie The Corporation (2003) with the tv show Planet Earth within the same library.

Would it be possible to force HAMA to use TMDB for movies and TVDB for tv shows within the same library?

I saw that your previously had suggested a solution to that problem already: https://forums.plex.tv/discussion/comment/1413737/#Comment_1413737

I wonder if that still has a chance to get implemented?

Yes and no.

  • Hama is meant to search the title in AniBD or be forced with an ID
  • If it is in a series library, how does it know it is a movie ?
  • you could force the tmdbid in the movie folder title, “Title [tmdb-xxxxx]” thatis already supported
  • for documentaries, a themoviedb custom agent if supporting both movies and series in same library could do the trick but my scanner would work without any change

@ZeroQI said:

  • If it is in a series library, how does it know it is a movie ?
  • you could force the tmdbid in the movie folder title, “Title [tmdb-xxxxx]” thatis already supported
  • for documentaries, a themoviedb custom agent if supporting both movies and series in same library could do the trick but my scanner would work without any change
  1. Thought of a couple of ways like to check for standard plex movie format “title (year)” or use the “Complete Movie” tag at the end of the movie file name as indicator.
  2. In a series or a movie library? I thought I tried forcing tmdb before already, but it didn’t seem to work. But maybe that was due to the other bug, I’ll check that again when I get home.
  3. That is what I started yesterday. Looking at your code, 99% of what I need is already there and just needs to be adjusted slightly. I used your Scanner and then got the search function to look for “title (year)” and find the correct TMDB id by that. Now I just need to get metadata download to work correctly for me. Once I get used to the Python syntax, the rest should be hopefully doable thanks to your existing code for the various sources.

Thanks for the answer.

The beta branch allot to select the meta source per field in agent settings. that should handle tmdb before thetvdb no pb

I’m not sure what I did wrong, But all of a sudden I have no posters showing for my anime, It just shows a grey computer icon.

I made sure to check that I indeed did have “Plug-in Support/Data/com.plexapp.agents.hama/DataItems” in my plug-in support. To note, I did indeed have it.

This is what I see when I go to my anime section of my Plex.

Please follow troubleshooting steps in the readme and attach logs mentioned there.

Hi @ZeroQI. ASS and HAMA have been lifesavers for me when trying to import my anime archive into Plex. Thank you very much for creating these amazing tools!

I’ve noticed a critical error on the latest beta when trying to retrieve metadata for any hentai series. It’s caused by line 96 in __init __.py file

dict_OMDb = OMDb.GetMetadata(movie, IMDbid) if TVDBid=='hentai' else {}

Inverting the condition check fixed the issue

dict_OMDb = OMDb.GetMetadata(movie, IMDbid) if TVDBid!='hentai' else {}

I wouild like to add, that when I was messing with the Agent I had an error in line 65.

maxi = TheMovieDB.Search (results, media, lang, manual, movie)

TheMovieDB should be TheMovieDb ?

Hey @ZeroQI,

I’ve been having trouble with getting HAMA to properly name my Anime series. I’ve followed (or at least tried to follow) all the configuration steps on both ASS and HAMA and search the forums for quite a bit, but still couldn’t quite get it to do what I wanted.

My idea was to have the series be named in romaji (main/x-jat) and the episodes named in English. The latter I was able to do perfectly, but no matter what I try, I _cannot _ get the titles to be set the way I would like.

As an example, I’ll use Higurashi no Naku Koro ni: I’ve named the folder and the files Higurashi no Naku Koro ni, and even tried forcing the AniDB ID on the folder name and if I try to fix the match, the search finds the title perfectly. However, after metadata is processed and downloaded, the series ends up named When They Cry - Higurashi, which is the English name.

Match:

Title set in Plex:

As a side note (and this happens with a couple of other series too, like Inuyasha and KonoSuba) I also have Higurashi no Naku Koro ni Kai in my library, and because of the way the titles are set (even though the matches look correct), I end up with duplicate titles (and incorrect info, such as Release Year and Summary, as well) for both series, even though the episodes are named correctly:


Basically all of the other series have the same problem. Some of them (FLCL, for example) have “incorrect” matches (i.e. even when trying to fix the match it shows the English title, rather than the main title), but most of them match correctly, but then end up setting the title in English.

In fact, if I try to select a match in the Fix Match screen, it will briefly revert the title to the folder name (and include the matched AniDB ID in it), and will change the poster to a different image, but will eventually revert to the English title and to the previous image (generally after finishing processing the episode names, I found).

Here are my HamaTV settings:

Other than the language priority, I didn’t change anything in there from the way the config looked when I first installed HAMA and ASS.

So after all that, my question is: did I configure something incorrectly (either within Plex or in my folder structure)? Going through my file list, you’ll see that some folder and file names still have some garbage in them – I’m in the process of clearing those up --, but even the folders and files I fixed still present the same problem.

Thanks (and please let me know if you need any more info to look into this)!

Two other things I noticed:

  1. For most of the series, there was no Cast metadata downloaded, even though the AniDB entries do have cast information.
  2. Specifically for Phi Brain: Kami no Puzzle, using the anidb2 guidtype only works for Season 1; Season 2 gets identified as if it was Uta no Prince-sama. I’ve made sure to force the correct AniDB IDs on both folders, but maybe I’m using the wrong naming convention (I’ve named both folders Phi Brain Kami no Puzzle and added their anidb2 forced IDs, and named the files themselves without specifying their season). This, I realize, is a separate issue (and I had this series set to use TVDB seasons when I posted my previous message), so I’ve included the new logs in this post.

Thanks again! :smile:

Sorry for the spam, but I’ve been poking around my library some more, and it seems to me that HAMA is using TVDB info in some/most cases, rather than using AniDB.

For instance, the names for most of Steins;Gate’s episodes are quite different between AniDB and TVDB:

AniDB:

TVDB:

So, despite the HamaTV config placing AniDB as the first priority for titles, and despite Plex showing the correct AniDB ID for the series while retrieving/refreshing metadata, this is how the Steins;Gate episode list looks like in Plex:

An even clearer example of this is Code Geass, specifically regarding Specials: I used the AniDB naming conventions for the Specials (Sxx) and while it looks like the episode numbers are being scanned correctly, the info being retrieved for them is incorrect, because the way AniDB has the Specials numbered is very different from TVDB.

This is how the specials look on AniDB:

And this is how they look on TVDB:

Going by the AniDB order and naming, I have Specials 2 through 9, so I’ve named them S2 to S9 accordingly. The names should have been, in order:

  1. Stage 8.5: The Mask’s Tracks
  2. Stage 17.5: Truth Behind the Mask
  3. Picture Drama 1
  4. Picture Drama 2
  5. Picture Drama 3
  6. Picture Drama 4
  7. Picture Drama 5
  8. Picture Drama 6

However, this is what they look like in my library:

In this case, unlike with Steins;Gate, it goes beyond just having the episode names be a different flavour of randomly-generated English sentences :smirk:, since the names are completely incorrect for the Code Geass Specials because of the episode order mismatch.

The logs in my original post won’t have info about this particular issue because I hadn’t fixed Code Geass’s folder and files yet when I posted, and I haven’t included any new logs in this post because it looks to me like this is a symptom of a broader, generic issue, given the Steins;Gate problem I mentioned above. If it will help, though, I’d be happy to force a metadata refresh and grab the logs for this specifc issue – please let me know if you’d like for me to do so.

Thanks once more (and I promise this is the last message about this until I hear from you :mrgreen: :wink:)!

Sweet Jesus, my brain hurts.

I’m sure the fix is easy, but I’ve been thinking and reading so much now that I just cannot connect the dots anymore at all. I need some help.

I want to merge two separate AniDB entries (“KissXSis” and “KissXSis (2010)”), because it’s silly to have them appear as two separate shows obviously. (generally despise AniDB’s approach to make OVAs entirely separate “shows”, even though they link them in the “related” box, but whatever… I digress)

Problem is, I want the OPs and EDs for each in the Specials, too, which obviously don’t have TVDB entries. So how do I map the KissXSis 2010 OP/EDs to the KissXSis TVDB entry, but pull metadata from AniDB, EXCEPT the show name of course.

I’d love to harvest the correct metadata, which can obviously only come from AniDB it being the only database of the two to even have the OP/EDs listed. Basically, pull episode numbering from AniDB and group the two different AniDB shows into one based on TVDB.

I could manually edit all of this by hand, but then I’ll be doing this for any other show where I have OPs and EDs and other content not listed on TVDB… I’d love to avoid that!

Thanks so much in advance, I cannot compute anymore. :s

I’m having similar problems with setting up Hidamari Sketch to be displayed as a single season and display the specials in the correct order. The problem is that it consists of 6 AniDB entries (1 2 3 4 5 6), 3 of which have the speicals that are fully fledged episodes on their own. Plus the order conventions and formatting are significantly different between AniDB and TVDB. For now, I just gave up and made every season into a separate show with its own set of specials - it’s the only thing I found that works reliably and doesn’t require an unhealthy amount of time to set up.

Any tips or advice would be appreciated.

Tell me about it. Boy, how I wish this whole agent thing wasn’t even a thing and Plex just let you pick the source of info from an import screen and require manual review. I just don’t trust this whole agent thing, because if for some reason some settings switch around it can rescrape all meta-data and who knows when you will notice if it just affects part of your library!

Anime + Plex = terrible user experience. Saves me some money though, because if it was as seamless as Western content (with many exceptions of its own) I’d probably buy the Plex Pass right away…

And what I would give to separate specials by seasons… Or lump them in the same view.

Sorry if I sound very negative, I’m sure most of these shortcomings are related more to how Plex wants to handle things than anything else. (yes yes, separate entries in AniDB make things complex, but how about separating metadata scraping from season naming, special grouping and all that? Again, agents can’t do this automagically, I’d be super fine with options of my own on the server frontend.)

Does Emby work better with anime?

@ZeroQI said:
Please follow troubleshooting steps in the readme and attach logs mentioned there.

I have followed the troubleshooting steps in the readme guide and I am happy to report that everything is working again. Thank you for your help.

OK, I lied – this will be the last message for now: on my second post, I mentioned a problem with Phi Brain: Kami no Puzzle, that the second season was being matched to the wrong series. That is because I’m an idiot and forced the wrong AniDB ID on it. :cold_sweat:

Just forget that part, please. Pretend it never happened. :anguished:

Another question…

K-On has OVAs in both seasons… They are listed within the respective season episode listings…

How the hell do I name them? Right now all the two will show up as is as mere duplicates of each other.

Two "S00E01"s… Because you know… It’s great that we can’t differentiate specials by their respective seasons… Looks like a major problem of loss of information due to reduction of precision to me, but maybe my thinking is wrong and I can’t see a solution that may be obvious to others?

Any help is greatly appreciated.

@zo1d Thanks for the fix, will be included in next version
@Shantara

  • TVDB has no hentai series so that limit the metadata, and OMDb paliate that for HAMA hentai lovers but require (now) a personal API key (if i could request 1 for hama for everybody let me know). Your fix doesn’t call it anymore for hentai avoid solving the actual cause if i am correct… What was the actual error after this function was called ? I could fix that
  • “Hidamari Sketch” displayed as a single season (so not following tvdb numbering since it has 4 seasons and not following anidb numbering neither since it has 6 separate anidb entries) and i cannot figure what “specials in the correct order” should be ?

anidb 5571 13 eps 03 sp Hidamari Sketch x 365
anidb 7128 12 eps 02 sp Hidamari Sketch x Hoshimittsu
anidb 8577 02 eps 01 sp Hidamari Sketch x SP
anidb 8575 12 eps 10 sp Hidamari Sketch x Honeycomb
anidb 9752 02 eps 00 sp Hidamari Sketch: Sae Hiro Sotsugyou Hen

I may be wrong but i get the feeling you want 39 eps with absolute numbering with specials in chronological release order which would require a custom mapping file written for this specific arbitrary yet maybe logical displaying order.

If you want tvdb special numbering you can use tvdb4 (use absolute numbering so single season as all seasons would be in sequence but i doubt your file naming will be compatible)

@cobrabr Hama currently follow the meta source first, then the language

  • for the cast will have to check

“Higurashi no Naku Koro ni” show correct scanner logs for both anidb naming convention folders
anidb 3574 26 eps 07 sp Higurashi no Naku Koro ni
anidb 4894 24 eps 25 sp Higurashi no Naku Koro ni Kai

What language is zh? Simplified chinese?
2017-10-07 15:27:38,769 (c50c) : INFO (logkit:16) - id: anidb-3574, title: When They Cry - Higurashi, lang: zh, force: True, movie: False
2017-10-07 15:27:39,953 (c50c) : INFO (logkit:16) - [=] title Type: str Source: TheTVDB Value: ‘When They Cry - Higurashi’

Title did come from TheTVDN not AniDB but Anidb first then order main, ja, en


2017-10-07 15:23:44,960 (45d0) : INFO (logkit:16) - AniDB.GetMetadata() - AniDBid: ‘2511’
2017-10-07 15:23:44,961 (45d0) : DEBUG (logkit:13) - common.LoadFile() - Filename: ‘2511.xml’, Directory: ‘AniDB\xml’, url: ‘http://api.anidb.net:9001/httpapi?request=anime&client=hama&clientver=1&protover=1&aid=2511’ does not exists in cache
2017-10-07 15:23:45,053 (45d0) : DEBUG (networking:161) - Fetching ‘http://api.anidb.net:9001/httpapi?request=anime&client=hama&clientver=1&protover=1&aid=2511’ from the HTTP cache
2017-10-07 15:23:45,102 (45d0) : DEBUG (logkit:13) - LoadFile() - url: ‘http://api.anidb.net:9001/httpapi?request=anime&client=hama&clientver=1&protover=1&aid=2511’ loaded
2017-10-07 15:23:45,102 (45d0) : INFO (logkit:16) - AniDB.get_metadata() - ANNid: ‘’, MALid: ‘’, xml loaded: ‘True’
2017-10-07 15:23:45,102 (45d0) : INFO (logkit:16) - -------------------------------------------------------------------------------------------------------------------------------------------------------------
2017-10-07 15:23:45,104 (45d0) : INFO (logkit:16) -

no ANN id nor MALid yet resssource 1 and 2 present in xml…
After checking hama result table log no anidb field used…

http://api.anidb.net:9001/httpapi?request=anime&client=hama&clientver=1&protover=1&aid=3574

<titles>
<title xml:lang="x-jat" type="main">Higurashi no Naku Koro ni</title>
<title xml:lang="ja" type="official">ひぐらしのなく頃に</title>
<title xml:lang="en" type="official">When They Cry - Higurashi</title>
</titles>

<resources>
<resource type="1">
<externalentity>
<identifier>6134</identifier>
</externalentity>
<externalentity>
<identifier>8766</identifier>
</externalentity>
</resource>
<resource type="2">
<externalentity>
<identifier>934</identifier>
</externalentity>
<externalentity>
<identifier>2899</identifier>
</externalentity>
</resource>

Your xml fetched from cache is corrupted, please check agent data folders, delete xml then custom match searching manualy for serie named “clear-cache” using custom match then cancel…