[Rel] HTTP Anidb Metadata Agent (HAMA)

@saitoh183 said:

@ZeroQI said:
Yes.
Artwork should stay.
It’s init not code my bad
Hama.bundle/Contents/Code/__init__.py at master · ZeroQI/Hama.bundle · GitHub

@ZeroQI

So i did the changes and im still getting failed scans.

It is not adding new content during scan and seems to stop prematurely. I have Naruto Shippuden eps 438 and its not there and entire series of Soukyuu no Fafner Dead Aggressor - Exodus 2 is missing. Also a few others.

ASS_Scanner Log : http://pastebin.com/kb95dRKg
ASS_Scanner Filelist: http://pastebin.com/NZHGv2Zf

using PMS: Plex-Media-Server-0.9.1402.1547-60c867f-en-US

Let me know if you need other info

@ZeroQI

Anything else i can try?

@Saitoh183: it seem to crash at the end according to my custom log so nothing new will be added.
“Plex Media Scanner.log” would have confirmed an error

I replaced

into
to strip useless line feed in filelist.txt and used batch file to recreate your library with dummy files (size 0). Logs folder need “keep_zero_size_files” file to show them, and no crash during initial scan, otherwise nothing added since nothing changed in folder.

Alpha 3 was buggy with a line feed deleted by mistake, updated to fix: https://gist.github.com/ZeroQI/26d26f91af04c876b1a0
If you were using alpha 3, that explains it, my simulation of your library show all…

@ziggo0 : Good bug report, pertaining to my latest code, the only bug report also regarding last changes. since agent crash, no updates on impacted anime. Uploaded on github a fix, please test and feedback

@ZeroQI

So i will have to replace the Absolute Series Scanner.py with the one in your link? i attached what i have been using and the plex Media Scanner.log

@saitoh183 : thanks for the logs
your scanner version has 470 lines
. recent (not alpha) is 400 lines https://github.com/ZeroQI/Absolute-Series-Scanner/blob/master/Scanners/Series/Absolute%20Series%20Scanner.py
. most recent alpha is 339 lines https://gist.github.com/ZeroQI/26d26f91af04c876b1a0 - the alpha normally is faster on rescans and scans and cache best, but changes dramatically and doesn’t support .plexignore files…

your log show a crash, hence the fact no new file is detected:

Nov 28, 2015 10:37:15:759 [7288] DEBUG - Adding subdirectory for scanner: D:\Videos\Anime\Yowamushi Pedal Grande Road
Nov 28, 2015 10:37:15:775 [7288] DEBUG - File ‘D:\Videos\Anime\07-Ghost\07-Ghost - 01 - The Future Of Painful Thoughts Is [DB].avi’ didn’t exist, can’t skip.
Nov 28, 2015 10:38:09:310 [7288] ERROR - Error in Python: Running scanner:
Traceback (most recent call last):
File “P:\Data\Plex Media Server\Scanners\Series\Absolute Series Scanner.py”, line 450, in Scan
add_episode_into_plex(mediaList, files, file, path, show, season, int(ep), “”, year, int(ep2), “show: “%s” s%02de%03d%s “%s” “%s”, rx: “%s”” % (show, int(season), int(ep), “” if ep==ep2 else “-%03d” % int(ep2), old_ep, filename, rx)) #add_episode_into_plex(mediaList, files, file, show, season, ep, “”, year, ep2, “show: ‘%s’ (%s) s%02de%03d%s on ‘%s’ from ‘%s’” % (show, xint(year), int(season), ep, “” if ep==ep2 else “-”+str(ep2), rx, filename))
File “P:\Data\Plex Media Server\Scanners\Series\Absolute Series Scanner.py”, line 248, in add_episode_into_plex
tv_show.parts.append(file)
UnboundLocalError: local variable ‘tv_show’ referenced before assignment

You have a buggy scanner with an error i corrected ages ago, it is the normal scanner, not the alpha so i recommend upgrading with the normal scanner since you have multiple custom fields saved manually

@ZeroQI

Thanks i will update the scanner and try again

@ZeroQI

It seems to have worked but the end result is that i have a few series that one or multiple episode created a second series of the same name…see screenshot below for example

snag.gy/516EL.jpg
snag.gy/6Csav.jpg
snag.gy/rRogq.jpg

I tried to re-match manually but they dont merge
i attached the logs

Edit

A Fix incorrect match seems to have cleared up the problem once i applied it to the right copie but maybe my logs will show why it happened in the first place.

Try to unmatch both then rematch. The scanner reports them as same folder/serie

@ZeroQI said:
Try to unmatch both then rematch. The scanner reports them as same folder/serie

Everything seems to be working now :slight_smile:

@ZeroQI I am pleased to report it is now working after your last update. I’m going to continue importing more of my anime with your name scheme and i’ll report any findings of bugs/issues. Are there any log files you would like to view currently? Besides being a little slow it pulled from AniDB correctly for the 4 shows I currently have.

@ziggo0: well if all works, no logs needed. For speed scanning i did the alpha scanner (on gist top tab in github), which show the overlay message with which serie is being added while scanning but the agent part is the slowest after that.
If i could manage i thread only i could possibly make it faster but could not make it work when i tried. can’t think of new functionality. it support both tvdb and anidb and forcing the id, suports series and movies in the same library…

Hi. Thanks for the fabulous work, but i keep getting main title instead of english.
(And yes, my first langagye is set as “en”)
Any idea ?

Exemple :


Main Title Kiseijuu: Sei no Kakuritsu (a10272)
Official Title Parasyte: The Maxim
My config : http://imgur.com/XyPULid
My result : http://imgur.com/zqwmBWL

Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems

anime-list-master.xml (Scud Lee’s mapping files)


Kiseijuu: Sei no Kakuritsu

anime-titles.xml (anidb title database)


Kiseijuu: Sei no Kakuritsu
Parasite
Parasyte
Parasyte -the maxim-
Parasyte -the maxim-
Parasyte: The Maxim
Parazit: Mravní zásady života
Паразит
Паразит: Жизненный принцип
Паразит: Основно правило
寄生兽 生命的准则
寄生獣 セイの格率

Logs\PMS Plugin Logs\com.plexapp.agents.hama.log
2015-12-06 17:23:13,678 (-b694490) : CRITICAL (agentkit:993) - Exception in the search function of agent named ‘HamaTV’, called with keyword arguments {‘openSubtitlesHash’: None, ‘episode’: ‘18’, ‘name’: “I Am a Man! Ranma’s Going Back to China!”, ‘episodic’: ‘1’, ‘show’: ‘Ranma \xbd Nettou Hen’, ‘season’: ‘1’, ‘filename’: ‘%2Fvolume1%2FMegaRaid%2FAnime%2FJap%20Sub%20En%2F_test%20Users%2FZeroQI%2FRanma%20%C2%BD%20Nettou%20Hen%2FRanma%201%202%20-%2018%20-%20%20I%20Am%20a%20Man!%20Ranma`s%20Going%20Back%20to%20China!%20[E-D]%2Emkv’, ‘plexHash’: ‘0da39a3ee5e6b4b0d3255bfef95601890afd80709’, ‘duration’: ‘-1’, ‘id’: ‘375705’} (most recent call last):
File “bundles-release/Framework.bundle-dist/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py”, line 986, in _search
File “/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 678, in search
def search(self, results, media, lang, manual): self.Search(results, media, lang, manual, False )
File “/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/init.py”, line 87, in Search
orig_title = ( media.title if movie else media.show ).encode(‘utf-8’) # NEEDS UTF-8
UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xbd in position 6: invalid start byte

DEBUG (init:489) - Update() - AniDB title: ‘Kiseijuu: Sei no Kakuritsu’, original title: ‘Kiseijuu: Sei no Kakuritsu’, metadata.title ‘Kiseijuu: Sei no Kakuritsu’

Corrected the issue on github and attached here too

@ZeroQi

i got this in my ASS scanner log

Place correct Plex token in X-Plex-Token.id file in logs folder or in PLEX_LIBRARY_URL variable to have a log per library - https://support.plex.tv/hc/en-us/articles/204059436-Finding-your-account-token-X-Plex-Token

Show doesnt seem to be scanning in

using latest plexpass PMS 0.9.14.4

@saitoh183: logs show errors and custom log not stopping in hte middle so so pretty sure it is scanning
did you create the folders in “Plugin Support” folder ?

@ZeroQI said:
@saitoh183: logs show errors and custom log not stopping in hte middle so so pretty sure it is scanning
did you create the folders in “Plugin Support” folder ?

the ones in Dataitems…yes

I had to manual scan in episodes yesterday because they didnt seem to be getting picked up but i was on pms 0.9.14.2.

Now nothing is getting scanned in

@ZeroQI

here is the log after i launch a manual scan which did add the shows

@saitoh183: Did you also create this one: P:\Data\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems\TVDB\episodes\ ? It was added recently enough…

@ZeroQI said:
@saitoh183: Did you also create this one: P:\Data\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems\TVDB\episodes\ ? It was added recently enough…

I will have a look tonight.

Thanks for your help, with title not in english.
I have now an other issue if you have an idea.

95% of my anime folder are named (YEAR)

Last time i did an install (few month ago) all my anime where scrapped, but now, it seems that only a few match.
http://imgur.com/7rDJzqa

It don’t seems to parse the year anymore :
http://imgur.com/G1QawOV

I don’t know python, so that’s probably ugly but i made a quick and dirty fix that way : On the init.py
### AniDB Local exact search ###
p = re.compile(ur’([1-2][0-9][0-9][0-9])$’)
x = re.search(p, orig_title)
if x:
p_year = re.compile(ur’[1-2][0-9][0-9][0-9]’)
x_year = re.search(p_year, x.group())
media.year = int(x_year.group())
orig_title = re.sub(ur’([1-2][0-9][0-9][0-9])$’, “”, orig_title)