Open MrDemocracy opened 4 years ago
Added š
Small caveat is that PlexAPI doesn't seem to always supply the original title or is limited to movie objects.
Awesome! š Maybe the HamaTV or TheTVDB agents doesn't import "original title" to Plex? After looking through my anime library, I couldn't find any shows with original titles, that I hadn't added myself.
Unfortunately the new feature doesn't work for me. All of the movies it is trying to sync have japanese characters in the original title, and I just get unicode encode errors when it tries to encode the title.
Should be fixable with forcing unicode encoding but believe that is also OS related with Python, if you can post both logs (debug and standard) will take a look :)
Here you go: PlexAniSync-logs.zip
Don't see any encoding error tracebacks in log, could you make a screenshot and post the title of one that it's having issues with.
You can also try the docker image which rules out any Python or local OS issues:
Sorry, I thought the logfiles reflected what I could see in the console. Here's the console output: PlexAniSync-console.log I will try docker next time I restart my machine since I have to logout to install it.
It should have logged to file so that's odd, thanks and will check the console logs now :)
Our guessit implementation looks like the root cause so will try some solutions now.
Could you retry with replacing anilist.py with this one:
https://gist.github.com/RickDB/d533c4d6f94a324bf8f049293a97bc85
This will force encoding to UTF8 for guessit, since it also break logging it could be an operating system + Python issue where it doesn't properly translates these characters. So would still test the docker image as well just in case to rule this out.
Guessit Exception: PlexAniSync-logs.zip
What operating system and Python version are you currently testing under?
Found some other user reports for Guessit but it seems only under Python 2 and certain Windows versions, for now will add a workaround which logs + skips over Guessit if error occured. We only use that as an extra title so should not matter much anyway for these kind of titles.
Windows 10 64bit Python 3.8.2
Added some checks and forcing locale in below Python files, also includes PlexAniSync.py this time:
https://gist.github.com/RickDB/d533c4d6f94a324bf8f049293a97bc85 https://gist.github.com/RickDB/dcd0158f2b84fd857041d27152a2171a
What seems to happen is Guessit is throwing error and logger fails to output it because Python locale under Windows is cp1252 (non-unicode) which explains the lack of log output, either way this is fixable but probably need a few tries to get it right :)
New logs: PlexAniSync.zip
Updated to include encoding in logger creation:
https://gist.github.com/RickDB/d533c4d6f94a324bf8f049293a97bc85 https://gist.github.com/RickDB/dcd0158f2b84fd857041d27152a2171a
For some reason it's not taking the logging parameters, could you post a few problematic titles here so I can test locally as well.
In the meantime a new try with logger changes:
They did show up in the console log I attached. Does it not show the japanese characters for you? Here's a few:
åććććć®ć¢ćŖćØććć£
čØć®čć®åŗ
ćć¦ć«ć®åćå
ē«ć®ę©čæć
é儳ć®å®
ę„ä¾æ
The debug log wasn't created this time: PlexAniSync.zip
Seems to be working now judging by console output but hard to see if there are real matches for the other titles, when testing those problematic titles show no more errors in logger so gonna clean up and restore a few functions.
Noticed title in the console log before just not sure if that got trimmed down :)
New version with debug logging restored:
Still no debug log for me: PlexAniSync.zip
Fixed in below version.
The debug logs are back now: PlexAniSync.zip
Logs look clean now with no more crashes, OVA / Movie matching is still experimental so for now would use custom mappings for those that are not lining up until a better solution is added :)
Pushed fixes to repo and updated docker image should be out soon.
But did you manage to sync anything using "original title" as alternate title? None of the movies with alternative titles got synced for me. It doesn't say anything about it attempting it in the log either.
Those get included in the generic matching pool of potential titles and don't log those as those can flood the log.
Attached a debug version of anilist.py which will output all 3 Plex titles which among others get included for lookup, if the original title there is the same as the standard / sort title it means PlexAPI sadly didn't supply it.
Thank you for the debug version.
There are some movies that doesn't match with Anilist using the japanese title, even though they should be able to. Like with Ponyo; searching for ćć®ć®ć姫
on Anilist gives me the correct result, but in the console I get Failed to find valid match on AniList for: Ponyo pƄ klippen ved havet
.
It also seems like the output of the print function for the plex titles is offset to the previous movie/series (which is probably not related to the issue).
Logs: PlexAniSync.zip
Console output for it could look a bit off as there's no new line before it but it's for the entry after it for sure. Will take a look at the AniList GraphQL queries to see what they return, would try with the Docker image as well so we know it's not an encoding issue somewhere further along.
Pretty sure I found the bug and new version below, it will be a bit slower when searching AniList as there's a 100ms delay between each potential title search and for no results that could mean 1.2s per show worse case.
Okay, got one step further now. Ponyo got detected this time, but it was matched incorrectly to 5702. In fact it seems like all "original title" results have incorrect Anilist id's, though I haven't checked every one of them.
I'm also seeing a lot of Found match however started year is a mismatch
in a row, with a varying years on each line.
Here's the latest logs: PlexAniSync.zip
I just realized I have a Raspberry Pi at the same location where my Plex server is, so I've installed docker on it and I did the pull command for rickdb/plexanisync
. But I have no idea how to use docker, so I'm not sure how to proceed with doing the same kind of tests on docker.
For the mismatch it might be guessit fuzzy matching, new test version below to rule this out:
The docker docs need updating with some steps for users new to Docker and will see about adding them š
I will do some reading on docker later, but a guide would definitely be helpful for new users.
Updated docs pushed some tweaks mostly for small fine tuning the title searches and reduce unnecessary load on the AniList API:
https://hub.docker.com/r/rickdb/plexanisync
Back on this early next week but if you found out more please don't hesitate to post :)
Updated docker docs and with the latest version do you still have issues with matching?
When I try to run the docker image using docker run
, with the same parameters as the create command from the docs, I get this error message:
ERRO[0003] error waiting for container: context canceled
On windows I've not been able to sync any movie using the "original title"-feature. It just adds some seemingly random other movie to anilist, for every movie.
I tried setting up custom_mappings
, but I'm not sure how to do it for movies, and couldn't get it to work.
While doing this, I was also mapping some series and discovered another bug; When I map a season from a series that didn't have any problems being matched with anilist, plexanisync get's stuck in a loop.
I can make a new issue for this bug if you prefer that, but I probably won't have time to do it before in a couple of hours.
Disabling original title for the time being and will test it again later, do have a rework on the matching in progress which uses XREF sources like HAMA does at the moment Will improve matching so we rely less on what Plex supplies title wise at least, still a few weeks off depending on current workload though.
Keeping it in this issue is fine :)
Not sure which cross reference sources HAMA uses (thetvdb?), but sound great! Does this mean individual episodes could also be matched for series like Bleach where all the seasons are just merged into one season on Anilist? And the other way around for series like JoJo, where Stardust Crusaders is split up in two part on Anilist, unlike how it's listed on other databases.
Here's the logs for the loop issue described I above: PlexAniSync.1.2.4.zip
Just to clarify; When doing the sync with custom_mappings.ini
disabled, The Familiar of Zero
season 1 get matched automatically and it continues searching for the next series, but enabling custom mappings where the line The Familiar of Zero^1^1195
is added, causes it to get stuck in a loop when searching for it on Anilist.
This isn't a major issue, since you can just remove the series causing the issue from custom_mappings.ini
and it will be matched anyway, so it's up to you if you think this is something that needs to be fixed or not.
Hama uses several lists (AniDB / TVDB) and a cross reference table managed by anime community, integrating it will vastly improve matching but want to clean up the code first so it fits in perfectly :)
Thanks for the logs and will fix the loop today.
Pushed fix for loop and if you can retry with latest version of this repo that would be great š
Didn't get stuck in loop this time :) Here's the logs: PlexAniSync.zip
Awesome, thanks for testing again š
Hopefully by end of the month I can fork over the HAMA code for XREF matching (AniDB / TVDB) so we can get matching on par with that but it all depends on my workload.
Looking forward to it š
I have a lot of anime movies and series that doesn't use english or japanese titles. It would be great if PlexAniSync could use "Sort title" and "Original title" from Plex, as alternative titles when searching Anilist for the movie/series fails. The sort title is usually the same as the title, but I like to add the english title together with the translated title there, so for my situation it would be nice if the sort title was used as well. But the "Original title" field would probably give the correct result from anilist most of the time.