ZeroQI / YouTube-Agent.bundle

Plex Metadata Agent for Movies and TV Series libraries
452 stars 43 forks source link

ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters #109

Open Fribb opened 2 years ago

Fribb commented 2 years ago

Full log: here

It seems that the pulled Metadata cannot be applied to the library item in some cases. I would assume that the special characters in the title is the reason for that.

nbgibson commented 1 year ago

This is mentioned in the Readme briefly, but should probably be given more prominence as the issue isn't on YTA/ASS's side. Plex doesn't like special characters particularly much and you'll want to adapt your intake pipeline to triage things until Plex fixes the problem (if ever). if you're using Youtube-dl/dlp/whatever be sure to include the --restrict-filenames flag in your script to strip out the problem causers. This will usually address the problem but it isn't perfect.

A prime example: Kurzgesagt - In a Nutshell

Plex hates that dash. If you include the flag above you'll end up with "Kurzgesagt_In_a_Nutshell" instead, but at least then you can just manually tweak the display/sort names to be correct and enjoy the properly sourced metadata and so on. I need to see if the non-legacy ASS can handle this a bit more gracefully as I've been sticking with the old version for a while now.

Fribb commented 1 year ago

I don't think that what you describe is it or at least not fully.

For example, in my case, just a couple of hours ago, Kurzgesagt added a new video. The metadata for that was downloaded and applied correctly without any issues.

However, the Agent seems to set the GUID from a combination of the youtube-ID and the title of the file? If that filename then contains filesystem valid but special characters, it fails with Exception serializing Movie with guid.

And this isn't something that was all the time the case, it just happened somewhat recently.

I am not sure why the GUID for plex has to include this, the youtube ID should be enough because it already is unique, or at least it should be.

I use the Movie Library and I cannot use ASS for that kind of library.

ZeroQI commented 1 year ago

Some characters in filename cause an issue it seems the GUID contain the title and if special characters are there, it fails...

stegmajo commented 1 year ago

I have this issue very often. For example for the channel Yakari, most videos have a title, which contains the special characters "ᴴᴰ". I assume that this special characters break the scanner.

@ZeroQI is there any bugfix planned? I could also try to support with a PR. The only question is: How to solve this bug? Would it be an option to remove characters from the title which are not fitting? As side-effect the titles would look different in Plex than on Youtube. But when it is used for the GUID generation, it's better to have a slightly wrong title than no imported metadata...

ZeroQI commented 1 year ago

First: would plex agent and scanner have an issue with the character? Maybe it's not fixabke One would dévide à test for chars and an action to fix, but am clueless on how to implement it... If somebody found python code to solve such problems in other agents or software sanitizing filenames, it could be ported over... Find which string what to remove to make it work and the command to do so... I fix on my phone if I can fix in one go but not using this agent for myself so no bugfix planned honestly