ZeroQI / YouTube-Agent.bundle

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

problem with channel #47

Closed reddragonguy closed 3 years ago

reddragonguy commented 3 years ago

Hi,

the following channel doesn't seem to update properly. it doesn't pull channel or video information. Is there something else i need to do for this?

https://www.youtube.com/channel/UCe0TLA0EsQbE-MjuHXevj2A

thank you for the great plug-in.

ZeroQI commented 3 years ago

I need your agent log please

reddragonguy commented 3 years ago

youtube agent.log

Here you go. Also, could you not log any secrets or tokens in the file.

ZeroQI commented 3 years ago

Can change the source if i know the line number or the text displayed

2020-09-27 02:05:13,436 (7fddb4ff9700) :  CRITICAL (model:192) - Exception serializing TV_Show with guid 'com.plexapp.agents.youtube://youtube|UCe0TLA0EsQbE-MjuHXevj2A|ATHLEAN-X™ [UCe0TLA0EsQbE-MjuHXevj2A]?lang=xn' (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-a78fef9a9/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/model.py", line 190, in _write
    self._serialize(os.path.join(self._storage_path, subdir))
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-a78fef9a9/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/model.py", line 215, in _serialize
    el.set('id', self._id)
  File "lxml.etree.pyx", line 699, in lxml.etree._Element.set (lxml-2.3/src/lxml/lxml.etree.c:34531)
  File "apihelpers.pxi", line 563, in lxml.etree._setAttributeValue (lxml-2.3/src/lxml/lxml.etree.c:15781)
  File "apihelpers.pxi", line 1366, in lxml.etree._utf8 (lxml-2.3/src/lxml/lxml.etree.c:22211)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

/media/youtube/ATHLEAN-X™ [UCe0TLA0EsQbE-MjuHXevj2A]/S01E20200612 - All About Traps (COMPLETE GROWTH GUIDE!) [eqYNJLbxRkk].mp4

It seem to crash after the end of the metadata gathering with line 675 outputting INFO (__init__:675) - =============================================================================================================================================================

INFO (__init__:649) - metadata.seasons[ 1].episodes[2020900016] "S01E2020900016 - Do This Between E

Are you using latest code?

reddragonguy commented 3 years ago

i just updated the code. Here's the error from the new log file:

2020-09-27 16:55:04,027 (7fe719ffb700) :  INFO (__init__:671) - =============================================================================================================================================================
2020-09-27 16:55:04,028 (7fe719ffb700) :  CRITICAL (model:192) - Exception serializing TV_Show with guid 'com.plexapp.agents.youtube://youtube|UCe0TLA0EsQbE-MjuHXevj2A|ATHLEAN-X™ [UCe0TLA0EsQbE-MjuHXevj2A]?lang=xn' (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-a78fef9a9/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/model.py", line 190, in _write
    self._serialize(os.path.join(self._storage_path, subdir))
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-a78fef9a9/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/modelling/model.py", line 215, in _serialize
    el.set('id', self._id)
  File "lxml.etree.pyx", line 699, in lxml.etree._Element.set (lxml-2.3/src/lxml/lxml.etree.c:34531)
  File "apihelpers.pxi", line 563, in lxml.etree._setAttributeValue (lxml-2.3/src/lxml/lxml.etree.c:15781)
  File "apihelpers.pxi", line 1366, in lxml.etree._utf8 (lxml-2.3/src/lxml/lxml.etree.c:22211)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

To answer your question about renaming the folder, i didn't try and it wouldn't help. The next time the channel is updated, ytdl will just recreate the same folder again with the TM in it.

Also, it seems when i Unmatch the series, the shows get their titles and descriptions, but when i match the series, they lose everything.

ZeroQI commented 3 years ago

None of the incriminated python lines are in the agent code so it seems Plex cannot saved metadata to their internal XML afterwards... I could try to scrub the character if so, but not sure how yet as i already tried in the past to no avail

reddragonguy commented 3 years ago

renaming the folder worked, but i noticed another issue that i previously hacked a fix for. It seems the show name in Plex has my folder name in it. I made a local edit previously to add this line: metadata.title = re.sub(r'/media/youtube/', '', metadata.title).strip(), but i couldn't figure out the right fix. It slso doesn't show the correct image for the show and ends up just using a random episode image.

here's the poster it uses: image

and here's where the correct one is:

image

ZeroQI commented 3 years ago

we need to see if saving the impacted folder name without the problematic character works...

Found how to convert a string to xml to string to remove bad characters

from lxml import etree
xml_parser              = etree.XMLParser(recover=True)
cleaned_xml_string = etree.tostring( etree.fromstring(dirty_xml_string, parser=xml_parser) )

Source: https://stackoverflow.com/questions/57490580/removing-invalid-characters-from-xml-in-python3-with-etree

ZeroQI commented 3 years ago

instead of metadata.title = re.sub(r'/media/youtube/', '', metadata.title).strip() try metadata.title = os.path.basename(metadata.title)

ZeroQI commented 3 years ago

Any feedback?

ZeroQI commented 3 years ago

Any feedback?

ZeroQI commented 3 years ago

Will probably be resolved alongside https://github.com/ZeroQI/YouTube-Agent.bundle/issues/28 No reply to code suggestion