[Rel] HTTP Anidb Metadata Agent (HAMA)

Thanks, added to the readme. Will quite help those under linux

Having a weird issue where a a pair of seasons I downloaded are not being parsed fully (title and posters are grabbed, but not tags, info or episode names). So far it is just the two specific seasons, and the other show added at the same fully parsed with no issues.

Shows/seasons with issues atm:

To Love-Ru: Darkness
To Love-Ru Darkness 2nd

Shows added at the same that are not having issues:

High School DxD BorN

I have included the log file for hama.

Well idk wtf happened but now scanning is completely broken for me. Nothing is returned on any attempt to match any show, anime or otherwise. Great.

@aroth.khashar scanning is adding files to plex, not serie matching

There was a change in the DefaultPrefs.json very recently and it needs to change weight value so it is not ‘None’ to avoid crashing

@ZeroQI said:
@aroth.khashar scanning is adding files to plex, not serie matching

There was a change in the DefaultPrefs.json very recently and it needs to change weight value so it is not ‘None’ to avoid crashing

Sorry for using the wrong terminology, and thanks for the correction. I ended up just reverting back to the version of HAMA I had downloaded the night before (prior to the changes you made this morning) and that resolved the issue with matching series.

That said, HAMA is still not updating any metadata fields other than Series Title, Year, Rating and posters. Synopsis/info, tags, episode names, etc. are not being updated for the two series in question (though other series seem to be updated fine atm). The xml files being download do contain the relevant information, so I am not sure what is going on.

@aroth.khashar need hama log showing both series

Removed all four recently added seasons/series from the library, restarted the Plex Media Server application, added the series back to the library folder and then tried to match them using the HamaTV Agent.

The first two series added (High School DxD BorN and The Testament of Sister New Devil BURST) get all of their meta data updated, the second two (To LOVE-Ru: Darkness, and To LOVE-Ru: Darkness 2nd) only get series title, rating, originally available data and posters.

crash so expected. we need to correct that. did you update DefaultPrefs.json? did you change the weight for categories? that should prevent the crash for now


How long should the added series be in Japanese? I have everything set to show in English, however it is displaying the series names in Japanese


EDIT: also, it is showing the aniDB reference number in the series title. I have one series added for testing purposes, and it’s Attack on Titan. DIrectory/File structure is:

x:\Anime\Attack on Titan\attack.on.titan.s01e03.mkv

Plex is showing it as “Attack on Titan [anidb-9541]”

Thanks!

Hi,

I have the agent and scanner installed, it’s pulled the metadata of each series but doesn’t seem to get posters, background or theme music.

Any ideas?

Here is the only critical message I can find in the agent.hama.log file

2016-07-19 10:47:15,956 (-ba6a470) : CRITICAL (agentkit:1067) - Exception in the update function of agent named ‘HamaTV’, called with guid ‘com.plexapp.agents.hama://8692?lang=en’ (most recent call last):
File “/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Resources/Plug-ins-c094d0d/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py”, line 1065, in _update
agent.update(obj, media, lang, **kwargs)
File “/root/Library/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 814, in update
def update(self, metadata, media, lang, force ): self.update2(metadata, media, lang, force, False )
File “/root/Library/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 272, in update2
tvdbid, tmdbid, imdbid, defaulttvdbseason, mappingList, mapping_studio, anidbid_table = self.anidbTvdbMapping(metadata, error_log)
File “/root/Library/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 582, in anidbTvdbMapping
for anime in AniDB_TVDB_mapping_tree.iterchildren(‘anime’):
AttributeError: ‘NoneType’ object has no attribute ‘iterchildren’

@KinjinZero if the id is there, the search worked but the metadata agent didn’t update so the agent probably crashing which we would see if you add attached the log files indicated in the read-me (links in my signature).

@aroth.khashar agent crash so it’s expected.

2016-07-15 11:39:43,246 (300c) :  DEBUG (logkit:13) - update() - AniDB Ratings:    '3.69'*
2016-07-15 11:39:43,246 (300c) :  CRITICAL (core:574) - Exception in the update function of agent named 'HamaTV', called with guid 'com.plexapp.agents.hama://anidb-11142?lang=en' (most recent call last):
  File "C:\Programs (x86)\Plex\Plex Media Server\Resources\Plug-ins-a17e99e\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py", line 1065, in _update
    agent.update(obj, media, lang, **kwargs)
  File "C:\Users\aroth\AppData\Local\Plex Media Server\Plug-ins\Hama.bundle\Contents\Code\__init__.py", line 848, in update
    def update(self, metadata, media, lang, force ): self.Update(metadata, media, lang, force,  False )
  File "C:\Users\aroth\AppData\Local\Plex Media Server\Plug-ins\Hama.bundle\Contents\Code\__init__.py", line 541, in Update
    elif season=="0":                                                    tvdb_ep = "s"+season+"e"+epNumVal
TypeError: int() argument must be a string or a number, not 'NoneType'

We added some content rating and altered the settings here https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/DefaultPrefs.json.
Despite default weight specified could end up None and in hte agent to empty it needs to be set to “None” and revert to None, and despite being default


This commit will fix

@theroninhunter : are you confident you created the agent data folders as per the readme ?

Hi,

Bit more infor on my post. The metadata for my anime episodes like Title has been fetched but no Synopsis of each episode, no Posters, Theme songs or background images.

The following logfile is empty Plex Media Scanner (custom ASS) - Filelist.log

I am adamant that I’ve created the necessary folder structure in “Plug-in Support/Data/com.plexapp.agents.hama/DataItems” as I moved the folder structure using the template provided.

I have applied the latest init.py from github

The following is from com.plexapp.system.log

2016-07-19 11:52:06,891 (-b1db470) : DEBUG (sandbox:19) - >>> No file found at path /root/Library/Plex Media Server/Media/localhost/b/083f6ee149c30ea776263c7f024b612e322c5fa.bundle/Contents/Subtitle Contributions/com.plexapp.agents.localmedia.xml

Here is my screenshot of the folder structures and this is still the only critical error in log

2016-07-19 12:20:38,979 (-bf00470) : CRITICAL (agentkit:1067) - Exception in the update function of agent named ‘HamaTV’, called with guid ‘com.plexapp.agents.hama://anidb-8692?lang=en’ (most recent call last):
File “/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Resources/Plug-ins-a17e99e/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py”, line 1065, in _update
agent.update(obj, media, lang, **kwargs)
File “/root/Library/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 862, in update
def update(self, metadata, media, lang, force ): self.Update(metadata, media, lang, force, False )
File “/root/Library/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 249, in Update
if not THEME_URL % tvdbid in metadata.themes: error_log[‘Plex themes missing’].append(“tvdbid: %s | Title: ‘%s’ | %s” % (WEB_LINK % (TVDB_SERIE_URL % tvdbid, tvdbid), tvdbtitle, WEB_LINK % ("mailto:themes@plexapp.com?cc=&subject=Missing%%20theme%%20song%%20-%%20’%s%%20-%%20%s.mp3’" % (tvdbtitle, tvdbid), ‘Upload’)))
File “/root/Library/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 665, in anidbTvdbMapping
error_log[‘anime-list anidbid missing’].append(“anidbid: %s | Title: ‘UNKNOWN’” % WEB_LINK % (ANIDB_SERIE_URL % anidbid, anidbid))
UnboundLocalError: local variable ‘anidbid’ referenced before assignment

Another error

2016-07-19 12:20:38,112 (-8e6e530) : CRITICAL (sandbox:303) - Exception when calling function ‘Start’ (most recent call last):
File “/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Resources/Plug-ins-a17e99e/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py”, line 294, in call_named_function
result = f(*args, **kwargs)
File “/root/Library/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 71, in Start
AniDB_TVDB_mapping_tree = HamaCommonAgent().xmlElementFromFile(ANIDB_TVDB_MAPPING, os.path.basename(ANIDB_TVDB_MAPPING), False, CACHE_1HOUR * 24 * 2)
File “/root/Library/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 825, in xmlElementFromFile
result = result_custom[:result_custom.rfind("")-1] + result[result.find("")+len("")+1:] #cut both fiels together removing ending and starting tags to do so
AttributeError: ‘NoneType’ object has no attribute ‘find’

“The following logfile is empty Plex Media Scanner (custom ASS) - Filelist.log”. well are the files showing updated in plex ? if so, your logs folder path might be unknown to the scanner


“I have applied the latest init.py from github”. “DefaultPrefs.json” was just modified
 did you pull that too ?
I did update the readme now to include that file.

Readme are fastidious to read but i try to make it so i can solve a problem in one go, which i can’t from the original post
I tried writing a troubleshoting section, which is in the readme on github, whose link is on my signature and state to include 4 files to account for all possibilities.

Try https://github.com/ZeroQI/Hama.bundle/commit/74c3a139ca061f1e0be97919bda6693819b30ae1 and update as well “DefaultPrefs.json” and restart plex and match manually the series and attach ast least
[
]/Plex Media Server/Logs/PMS Plugin Logs/com.plexapp.system.log
[
]/Plex Media Server/Logs/PMS Plugin Logs/com.plexapp.agents.hama.log

Here are the two logfiles.

The files appear in plex with the episode title metadata perfectly fine but nothing else no synopsis, rating etc

Updated init.py and DefaultPrefs.json

Still have the same problem

Just installed it, having several issues. First of all, all animes show up with their anidbid in the title. Also no metadata or posters at all downloaded. I attached the necessary logs. Renamed 2 of them since otherwise it wouldn’t let me upload them here.

Folder structure should be fine:
C:\Users\Allaire\AppData\Local\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems:

C:\Users\Allaire\AppData\Local\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems\TVDB:

@zz1l

Did you follow the instructions in the read me?

@chrno
As in installation instructions? Well yea.
Also folder structure should be fine as shown above. I’m using Windows 10, so permissions shouldn’t be the issue.

@zz1l

Your fault is identical to my issue, only difference is the OS.