ZeroQI / YouTube-Agent.bundle

Plex Metadata Agent for Movies and TV Series libraries
463 stars 44 forks source link

Videos not getting any metadata #46

Closed jwmoss closed 4 years ago

jwmoss commented 4 years ago

Running into issues following how this should be configured... I've RTFM in both the ASS repo and youtube bundle repo.

Plex Media Version: 1.20.1.3252 Youtube-DL Version: 2020.07.28 Plex Library Information:

Code used to create file structure

#!/usr/bin/env bash

array=( 
    "https://www.youtube.com/channel/UC5PYHgAzJ1wLEidB58SK6Xw"
)

for i in "${array[@]}"
do
    /home/jwmoss/youtube-dl "$i" \
    -v \
    -i \
    --dateafter now-1week \
    --merge-output-format mp4 \
    -f "bestvideo+bestaudio[ext=m4a]/best" \
    --download-archive ~/.cache/youtube-dl/youtube-dl-seen.conf \
    --output "/home/jwmoss/rclonemount/Media/YouTube/%(uploader)s [%(channel_id)s]/%(playlist_index)s - %(title)s [%(id)s].%(ext)s" \
    --batch-file=~/.cache/youtube-dl/Channels_to_DL.txt
done

Output:

~/rclonemount/Media/YouTube/Blippi [UC5PYHgAzJ1wLEidB58SK6Xw]/001 - Blippi Plays a Game of Bubble Ball _ Educational Videos For Children [IOOkW5MAMGQ].mp4

Logs

com.plexapp.agents.youtube.log com.plexapp.system.log

ZeroQI commented 4 years ago

It seem to crash so code needs amending during search line 173:

2020-09-13 00:45:21,353 (7f36c67fc700) : CRITICAL (agentkit:1018) - Exception in the search function of agent named 'YouTubeSeries', called with keyword arguments {'openSubtitlesHash': '3235858db824c5b9', 'episode': '2', 'name': '002 - Blippi Visits a Cherry Farm Healthy Eating For Children Educational Videos For Kids [ls1DzZ0ijyM].mp4', 'episodic': '1', 'show': 'Blippi [UC5PYHgAzJ1wLEidB58SK6Xw]', 'season': '2020', 'plexHash': '87cad9aebfab54031ed74725c459fad4d2b67e62', 'filename': '%2Fhome%2Fjwmoss%2Fgdrive%2FMedia%2FYouTube%2FBlippi%20%5BUC5PYHgAzJ1wLEidB58SK6Xw%5D%2F002%20-%20Blippi%20Visits%20a%20Cherry%20Farm%20%20Healthy%20Eating%20For%20Children%20%20Educational%20Videos%20For%20Kids%20%5Bls1DzZ0ijyM%5D%2Emp4', 'year': '2020', 'duration': '-1', 'id': '27293'} (most recent call last): File "/mnt/mpatha/jwmoss/Library/Plex/plexmediaserver-1.20.1.3252-a78fef9a9.x86_64/usr/lib/plexmediaserver/Resources/Plug-ins-a78fef9a9/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1011, in _search agent.search(*f_args, **f_kwargs) File "/home/jwmoss/Library/Application Support/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/init.py", line 676, in search def search (self, results, media, lang, manual): Search (results, media, lang, manual, False) File "/home/jwmoss/Library/Application Support/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/init.py", line 200, in Search search_from_info_json(results, media, lang) File "/home/jwmoss/Library/Application Support/Plex Media Server/Plug-ins/YouTube-Agent.bundle/Contents/Code/init.py", line 173, in search_from_info_json displayname = os.path.basename(media.items[0].parts[0].file) if movie else media.show NameError: global name 'movie' is not defined

ZeroQI commented 4 years ago

Please test new code. Did it on the phone so a bit tricky

jwmoss commented 4 years ago

That worked! I initially didn't have it working after your change, but then noticed it's looking for the JSON file to read from, so I added that to my YouTube-DL script and it worked great!

#!/usr/bin/env bash

array=( 
    "https://www.youtube.com/channel/UC5PYHgAzJ1wLEidB58SK6Xw"
    "https://www.youtube.com/channel/UCpamFkrGa5ePxhWsDyQs74w"
)

for i in "${array[@]}"
do
    youtube-dl "$i" \
    -v \
    -i \
    --dateafter now-1week \
    --merge-output-format mp4 \
    -f "bestvideo+bestaudio[ext=m4a]/best" \
    --write-info-json \
    --download-archive ~/.cache/youtube-dl/youtube-dl-seen.conf \
    --output "/YouTube/%(uploader)s [%(channel_id)s]/%(playlist_index)s - %(title)s [%(id)s].%(ext)s" \
    --batch-file=~/.cache/youtube-dl/Channels_to_DL.txt
done
ZeroQI commented 4 years ago

The json is optional so it should work in both cases...