Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata doesn't pull for episodes with the same date even when ASS assigns sequential suffix. #84

Open
doctaphil89 opened this issue May 17, 2021 · 37 comments

Comments

@doctaphil89
Copy link

If you have a channel/list with a bunch of videos from the same date, if you add the first one by itself, the metadata will pull, but adding any additional episodes will cause the metadata to reset for the videos of that date and revert to the filenames / unmatched. Removing the datestamp from the filenames solves this problem sometimes but that's the most I can say right now.

@doctaphil89
Copy link
Author

doctaphil89 commented May 17, 2021

the result of a scan with the datestamps removed from the filenames. the episodes where ASS assigned an a longer number to the end went unmatched

=============================================================================================================================================================
Call: "Plex", path: "Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]", folder_show: "Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]", dirs (0), files (10)
=============================================================================================================================================================
Forced ID (series folder) - source: "youtube", id: "UC5B27ZdPle33KaQqsisR3mQ"
season: 2018, episode: 2018-03-08, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 1 Thinking In Sets - [LFqbtk-Mi-M].mkv,
season: 2017, episode: 2017-11-21, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 2 Number and Date Tables - [T4z2ZMqawSU].mkv,
season: 2019, episode: 2019-07-18, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 3 CASE Expressions - [3HUqNWH9XxE].mkv,
season: 2019, episode: 2019-08-01, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 4 Computed Columns - [K3cw5h3sC1w].mkv,
season: 2019, episode: 2019-08-0102, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 5 Windowing Functions 1 Design - [-cYg10kqFPA].mkv,
season: 2018, episode: 2018-03-14, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 5 Windowing Functions 2 Performance - [_qHT2FXmURI].mkv,
season: 2019, episode: 2019-07-31, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 6 Replacing Cursors Part 1 - [fFzOd2MZ5Co].mkv,
season: 2019, episode: 2019-07-28, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 6 Replacing Cursors Part 2 - [55PcSgOyl0k].mkv,
season: 2019, episode: 2019-07-24, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 6 Replacing Cursors Part 3 - [2elCCk9IYyY].mkv,
season: 2019, episode: 2019-07-2802, filename: Y:\Video\YouTube\Brent Ozar Unlimited [UC5B27ZdPle33KaQqsisR3mQ]\T SQL Level Up Chapter 7 Let the Adventure Begin - [A1Eh1dBIr1k].mkv,
season: 2017, keys(1): ['2017-11-21']
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2017e2017-11-21                         "Youtube Date" "T SQL Level Up Chapter 2 Number and Date Tables - [T4z2ZMqawSU].mkv" "T SQL Level Up Chapter 2 Number and Date Tables - [T4z2ZMqawSU].mkv"
season: 2019, keys(9): ['2019-07-18', '2019-07-2801', '2019-07-24', '2019-07-2802', '2019-07-28', '2019-07-31', '2019-08-01', '2019-08-0102', '2019-08-0101']
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2019e2019-07-18                         "Youtube Date" "T SQL Level Up Chapter 3 CASE Expressions - [3HUqNWH9XxE].mkv" "T SQL Level Up Chapter 3 CASE Expressions - [3HUqNWH9XxE].mkv"
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2019e2019-07-2801                         "Youtube Date" "T SQL Level Up Chapter 6 Replacing Cursors Part 2 - [55PcSgOyl0k].mkv" "T SQL Level Up Chapter 6 Replacing Cursors Part 2 - [55PcSgOyl0k].mkv"
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2019e2019-07-24                         "Youtube Date" "T SQL Level Up Chapter 6 Replacing Cursors Part 3 - [2elCCk9IYyY].mkv" "T SQL Level Up Chapter 6 Replacing Cursors Part 3 - [2elCCk9IYyY].mkv"
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2019e2019-07-2802                         "Youtube Date" "T SQL Level Up Chapter 7 Let the Adventure Begin - [A1Eh1dBIr1k].mkv" "T SQL Level Up Chapter 7 Let the Adventure Begin - [A1Eh1dBIr1k].mkv"
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2019e2019-07-31                         "Youtube Date" "T SQL Level Up Chapter 6 Replacing Cursors Part 1 - [fFzOd2MZ5Co].mkv" "T SQL Level Up Chapter 6 Replacing Cursors Part 1 - [fFzOd2MZ5Co].mkv"
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2019e2019-08-0102                         "Youtube Date" "T SQL Level Up Chapter 5 Windowing Functions 1 Design - [-cYg10kqFPA].mkv" "T SQL Level Up Chapter 5 Windowing Functions 1 Design - [-cYg10kqFPA].mkv"
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2019e2019-08-0101                         "Youtube Date" "T SQL Level Up Chapter 4 Computed Columns - [K3cw5h3sC1w].mkv" "T SQL Level Up Chapter 4 Computed Columns - [K3cw5h3sC1w].mkv"
season: 2018, keys(2): ['2018-03-08', '2018-03-14']
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2018e2018-03-08                         "Youtube Date" "T SQL Level Up Chapter 1 Thinking In Sets - [LFqbtk-Mi-M].mkv" "T SQL Level Up Chapter 1 Thinking In Sets - [LFqbtk-Mi-M].mkv"
"Brent Ozar Unlimited [youtube-UC5B27ZdPle33KaQqsisR3mQ]" s2018e2018-03-14                         "Youtube Date" "T SQL Level Up Chapter 5 Windowing Functions 2 Performance - [_qHT2FXmURI].mkv" "T SQL Level Up Chapter 5 Windowing Functions 2 Performance - [_qHT2FXmURI].mkv"

@ZeroQI
Copy link
Owner

ZeroQI commented May 17, 2021

and revert to the filenames / unmatched
What does that mean? There is no matching for files, only series...

Scanner numbering as designed with hack for multiple releases on same day.

Are the files added in Plex at the salon/episode/dates as per the logs above? If so, the scanner did it's job and you have an agent issue...

You need to add files for it to rescan, even if you rename as scanner results are cached

@ZeroQI
Copy link
Owner

ZeroQI commented May 19, 2021

There is no matching for files, just series.

  • Are all the files added in Plex ok as per scanner logs?
  • Agent logs showing the issue missing

@MizeryMade
Copy link
Contributor

MizeryMade commented May 20, 2021

When two videos are scanned in from the same day from a channel, then they will be placed under the correct series and correct season (year). However, the videos will only have the filename as their title and the generated thumbnail. They lack an episode number/date (shows as 1900-01-01 in the edit screen, but nothing shows below the title like files showing correctly). The agent throws an error when trying to process data for the file(s):

2021-05-19 17:56:23,471 (2bc8) :  INFO (logkit:16) - metadata.seasons[2021].episodes[None] "{Sinvicta} ~ ~  SINVICTA TEACHES ISAAC TO A NOOB - Feat. Trikslyr  The Binding Of Isaac_ Repentance (1080p_60fps_H264-128kbit_AAC) ~ [A5YlHgx7KzA].mp4"
2021-05-19 17:56:23,471 (2bc8) :  INFO (logkit:16) - populate_episode_metadata_from_info_json() - series_root_folder: E:\Youtube\Gaming\Sinvicta [UC86BKGkw3Giit6yTAntInfQ], filename: {Sinvicta} ~ ~  SINVICTA TEACHES ISAAC TO A NOOB - Feat. Trikslyr  The Binding Of Isaac_ Repentance (1080p_60fps_H264-128kbit_AAC) ~ [A5YlHgx7KzA].mp4
2021-05-19 17:56:23,471 (2bc8) :  INFO (logkit:16) - Searching for "{Sinvicta} ~ ~  SINVICTA TEACHES ISAAC TO A NOOB - Feat. Trikslyr  The Binding Of Isaac_ Repentance (1080p_60fps_H264-128kbit_AAC) ~ [A5YlHgx7KzA].info.json". Searching in "E:\Youtube\Gaming\Sinvicta [UC86BKGkw3Giit6yTAntInfQ]".
2021-05-19 17:56:23,471 (2bc8) :  INFO (logkit:16) - Directory \\?\E:\Youtube\Gaming\Sinvicta [UC86BKGkw3Giit6yTAntInfQ] contains 4 files
2021-05-19 17:56:23,471 (2bc8) :  INFO (logkit:16) - populate_episode_metadata_from_api() - filename: {Sinvicta} ~ ~  SINVICTA TEACHES ISAAC TO A NOOB - Feat. Trikslyr  The Binding Of Isaac_ Repentance (1080p_60fps_H264-128kbit_AAC) ~ [A5YlHgx7KzA].mp4
2021-05-19 17:56:23,473 (2bc8) :  INFO (logkit:16) - # videoId [A5YlHgx7KzA] not in Playlist/channel item list so loading json_video_details
2021-05-19 17:56:23,492 (2bc8) :  DEBUG (networking:143) - Requesting 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=A5YlHgx7KzA&key=AIzaSyBHiKPgMTbGf4D1vpvPj3XZ4i8scfIZdzY'
2021-05-19 17:56:23,983 (2bc8) :  INFO (logkit:16) - [?] link:     "https://www.youtube.com/watch?v=A5YlHgx7KzA"
2021-05-19 17:56:23,984 (2bc8) :  INFO (logkit:16) - [ ] title:    "SINVICTA TEACHES ISAAC TO A NOOB - Feat. Trikslyr  The Binding Of Isaac: Repentance"
2021-05-19 17:56:23,984 (2bc8) :  INFO (logkit:16) - [ ] summary:  "SINVICTA TEACHES ISAAC TO A NOOB - Feat. Trikslyr  The Binding Of Isaac: Repentance. NFSW LANGUAGE. BECOME A MOSH PIT MVP! ►►https://www.youtube.com/channel/UC86BKGkw3Giit6yTAntInfQ/join. PATREON CAMPAIGN! ►► http://www.patreon.com/sinvicta. . TRIKSLYR ►►https://twitch.tv/trikslyr.  . REPENTANCE IS HERE! The long-awaited expansion to the hugely popular The Binding Of Isaac: Afterbirth+!  Join Sinvicta as he continues his journey in the warped world of The Binding Of Isaac.. . BUY THE STREAM PACKAGE ALBUM HERE►► https://bit.ly/3pcF8FC. GO HERE FOR THE NON-INSTRUMENTAL VERSION OF THE ALBUM. ►► http://sinvicta.bandcamp.com. THE SINVICTA SHOP! ►►https://www.designbyhumans.com/shop/Sinvicta. Our New Subreddit! ►►https://www.reddit.com/r/Sinvicta. TOP 10 CARRY ITEMS IN ISAAC ►► https://www.youtube.com/watch?v=72jRvk9jgag. -----------------------------------------------. TWITTER:  http://twitter.com/sinvicta. FACEBOOK:  http://FB.com/THELawder. TWITCH:  http://twitch.tv/sinvicta. EMAIL:  [email protected]. STEAM FAN GROUP: http://steamcommunity.com/groups/sinvicta"
2021-05-19 17:56:23,986 (2bc8) :  CRITICAL (core:574) - Exception in the update function of agent named 'YouTubeSeries', called with guid 'com.plexapp.agents.youtube://youtube|UC86BKGkw3Giit6yTAntInfQ|Sinvicta [UC86BKGkw3Giit6yTAntInfQ]?lang=xn' (most recent call last):
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-d7c624def\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py", line 1093, in _update
    agent.update(obj, media, lang, **kwargs)
  File "C:\Users\iammi\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 516, in update
    def update (self, metadata, media, lang, force ):  Update (metadata, media, lang, force,  False)
  File "C:\Users\iammi\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 488, in Update
    if len(e)>3:  episode.originally_available_at = Datetime.ParseDate(json_video_details['snippet']['publishedAt']).date();                       Log.Info('[ ] date:     "{}"'.format(json_video_details['snippet']['publishedAt']))
TypeError: object of type 'NoneType' has no len()

2021-05-19 17:56:24,071 (2bc8) :  DEBUG (model:229) - Serializing to C:\Users\iammi\AppData\Local\Plex Media Server\Metadata\TV Shows\3\0f2621d2d84ee52a6ca9f8b14b820f5dd584f24.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-05-19 17:56:24,073 (2bc8) :  DEBUG (runtime:88) - Sending packed state data (107 bytes)
2021-05-19 17:56:24,073 (2bc8) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

The error is the same for each instance of this, and I notice this as well: "metadata.seasons[2021].episodes[None]". Is this perhaps because the scanner/Plex isn't handling the "hacked" release date correctly resulting in a null episode number? Setting the release date for these affected videos to the correct date and then refreshing the "show" will allow it to properly pull the metadata -- with duplicated infomation on the videos that are actually from the same day and not processed as such due to timezones (but I believe I saw this was a limitation on Plex's handling of same day episodes when release date is the "episode number"?)

@doctaphil89
Copy link
Author

doctaphil89 commented May 20, 2021

So I think the combo of ASS & the YT agent throws an error if i'm using the Channel ID (UC prefix) but not if I use the "all videos uploaded" playlist ID (UU prefix.)

It's been a few days so my memory is already fuzzy but I ended up ditching ASS, using the default scanner, and having yt-dl assign S01EXX based on playlist index and now everything is hunky dory. sorry for the hubbub.

@ZeroQI
Copy link
Owner

ZeroQI commented May 20, 2021

if you use the playlist id, the rank in the playlist is used as episode number and it auto reverse the playlist if needed, so it make sense it works then

Yes it seem the date based numbering make e = None, which crashed it...
When a release date is put on a date based episode, it amends the ep number

@MizeryMade
https://github.com/ZeroQI/YouTube-Agent.bundle/blob/master/Contents/Code/__init__.py#L488
replace
if len(e)>3: episode.originally_available_at = Datetime.ParseDate(Dict(json_video_details, 'upload_date')).date(); Log.Info(u'[ ] date: "{}"'.format(Dict(json_video_details, 'upload_date')))<br class="Apple-interchange-newline">
with:
episode.originally_available_at = Datetime.ParseDate(Dict(json_video_details, 'upload_date')).date(); Log.Info(u'[ ] date: "{}"'.format(Dict(json_video_details, 'upload_date')))<br class="Apple-interchange-newline">
and report please

@MizeryMade
Copy link
Contributor

MizeryMade commented May 20, 2021

I think the code and relevant line got a little jumbled. The code seems to have been lifted from line 458, but modifying the relevant line 488 by removing "if len(e)>3: ", the agent no longer throws the critical error when scanning these same day episodes. It correctly shows a date in the log where it was previously showing the error.

They still remain as just titles in plex however. Was the change supposed to mitigate that, or was it strictly addressing the subsequent agent crash?

EDIT: Thought I would note that currently I have Plex Server 1.22.3.4392... in case a plex update busted your hack?

@ZeroQI
Copy link
Owner

ZeroQI commented May 20, 2021

Was mitigating the crash.
Please attach agent logs file

@MizeryMade
Copy link
Contributor

Scanned in two videos from the same day in a clean database. Log(s) as follows:

Sinvicta [UC86BKGkw3Giit6yTAntInfQ].scanner.log
com.plexapp.agents.youtube.log

Clipboard02

@ZeroQI
Copy link
Owner

ZeroQI commented May 21, 2021

Weird, series title is updated, so the rest of the metadata update should be applied
Can only see one video in the episode loop in the logs
# videoId [fF8d_LFZYQw] not in Playlist/channel item list so loading json_video_details

Need to check code but nothing obvious to date

@MizeryMade
Copy link
Contributor

I see the "# videoID not in Playlist/channel item list" on what appears to be any video in a "[UC...]" folder. Is that normal?

In toying around with some things, I think this boils down to a limitation on Plex's part. I'm not sure if a recent Plex build might have broken what you were able to accomplish with the hack you implemented into the ASS code for same-date episodes, but it doesn't seem to accomplish what it's trying to do anymore? I think the "YYYY-MM-DDII" episode identifiers are being lost by Plex resulting in these videos being unable to be associated with metadata. Your agent will save the data it's pulling for any video showing in the agent as "metadata.seasons[2021].episodes[None]" to a None.xml file in the folder tree the agent says it's serializing the data to but Plex doesn't seem to do anything with said data.

Scanned in the two example files with the stock Plex Series Scanner and your agent (since I noticed the stock scanner was adding "same date episodes" in another library of mine -- added the date in the filename though so Plex's scanner would recognize) and it added the files in similarly to your scanner, but gave a generic title (instead of the filename, they were "Episode 04-28") and showed the "release date" below said title which ASS doesn't. The agent then tried doing it's thing, and only showed one of the videos in the log like when running the test with ASS, but didn't show the "None" and correctly apply metadata to... well, it applied the metadata from one of the videos to both, but it's surely thinking they're the same episode.

I don't know. There's only a couple channels I save videos from that sometimes put out multiple episodes per day (although there's cases where due to timezones, the code places videos on the same day when they weren't intended to be) so it's not catastrophic if it doesn't work, haha.

@ZeroQI
Copy link
Owner

ZeroQI commented May 24, 2021

Very good analysis

Seems like I can add to Plex from the scanner but the episode number is None so cannot be lopped through the agent side anymore...

Need to find another way but not sure there is...

@reddragonguy
Copy link

i think you may have to revert to calculating an episode id based on month/day/(hour/min or counter). So, having two videos with the following date/time:

  • 5/24/2021 11:34 am
  • 5/24/2021 9:25 am

could be:

  • 052400
  • 052401

or

  • 05241134
  • 05240925

I'd lean towards the latter because i think the former is prone to issues if a new video is added with a previously used date and that older video doesn't exist anymore because it was deleted.

@ZeroQI
Copy link
Owner

ZeroQI commented May 24, 2021

remove the year as the season is the year, to be tested but if two videos can be posted the same minute, we could have issues

@reddragonguy
Copy link

yes, the year doesn't need to be there. yes, there may be chance, but I think the percentage of that is really, really small.

@MizeryMade
Copy link
Contributor

MizeryMade commented May 27, 2021

Putting together an artificial "episode number" for these files would probably do the trick, and as pointed out would probably play even nicer for instances where episodes are added/deleted over time. Having it apply the number by Month/Day/Hour/Minute would work fine if you're pulling the filedate -- but wouldn't work out as well for those that have the release in the filename as it's not really standard to have the hour/minute in there although I guess you could revert to doing a sequential index for these?

I know you recently consolidated the Youtube functionalities into a single mode for the scanner, but perhaps you could break out this functionality into Youtube2, as the current implementation works fine for the majority of cases -- it's only those that do put out more than one video a day. The user is likely to know which sources do this and could choose to run Youtube2 to get these alternate episode numbers. This would of course miss the random case for ones that don't normally release more than one in a day though. Hm.

@nifoc
Copy link

nifoc commented Sep 14, 2021

Just ran into this same issue.
Metadata does not show up, even when the crash is prevented.

Is there anything I can do to help fix this?

@MatthK
Copy link

MatthK commented Sep 19, 2021

I believe I have the same issue. I have downloaded TED talks and it got sorted nicely into different Years (seasons). In 2007 I have the following files in the directory.

The directory structure above is as follows:

YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\

20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
20070106 Secrets of success in 8 words, 3 minutes _ Richard St. John [Y6bbMQXQ180].mp4
20070116 The best stats you've ever seen _ Hans Rosling [hVimVzgtD6w].mkv
20070116 The freakonomics of McDonalds vs. drugs _ Steven Levitt [5UGC2nLnaes].mkv
20070116 The paradox of choice _ Barry Schwartz [VO6XEQIsCoM].mkv
20070514 How to truly listen _ Evelyn Glennie [IU3V6zNER4g].mkv

Only the last video has the proper Metadata, while the others only show the filename. And in Plex, I can't mark them as watched/unwatched independently.

Screenshot-2021-09-19-at-15-45-21-Plex

The log file shows an error about a 'NoneType' has no len()

2021-09-19 15:50:21,572 (3218) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwNHM0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 15:50:21,572 (3218) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2021-09-19 15:50:21,572 (3218) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwNHM0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 15:50:21,573 (3218) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCAuUUnT6oDeKwE6v1NGQxug|TED [UCAuUUnT6oDeKwE6v1NGQxug]/2007/1900-01-01?lang=xn
2021-09-19 15:50:21,573 (3218) :  DEBUG (model:234) - Deserializing from C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 15:50:21,579 (3218) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/98204/tree'
2021-09-19 15:50:21,588 (3218) :  INFO (logkit:16) - === update(lang=xn, force=True, movie=False) ===
2021-09-19 15:50:21,588 (3218) :  INFO (logkit:16) - U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 15:50:21,588 (3218) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 15:50:21,588 (3218) :  INFO (logkit:16) - [!] Library access denied
2021-09-19 15:50:21,588 (3218) :  INFO (logkit:16) - [!] ASS root scanner file missing: "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems\_Logs\_root_.scanner.log"
2021-09-19 15:50:21,588 (3218) :  INFO (logkit:16) - [ ] library:    ""
2021-09-19 15:50:21,588 (3218) :  INFO (logkit:16) - [ ] root:       "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 15:50:21,589 (3218) :  INFO (logkit:16) - [ ] path:       ""
2021-09-19 15:50:21,589 (3218) :  INFO (logkit:16) - [ ] dir:        "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 15:50:21,589 (3218) :  INFO (logkit:16) - [ ] series_root_folder: "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\"
2021-09-19 15:50:21,670 (3218) :  INFO (logkit:16) - [ ] subfolder_count:    "0"
2021-09-19 15:50:21,670 (3218) :  INFO (logkit:16) - Grouping folder not found or single folder, root: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug], path: , Grouping folder: , subdirs: 0, reverse_path: ['']
2021-09-19 15:50:21,697 (3218) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics%2CbrandingSettings&id=UCAuUUnT6oDeKwE6v1NGQxug&key=' from the HTTP cache
2021-09-19 15:50:21,723 (3218) :  INFO (logkit:16) - [ ] title:        "TED ", metadata.title: "TED "
2021-09-19 15:50:21,724 (3218) :  INFO (logkit:16) - [ ] art:       https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 15:50:21,724 (3218) :  INFO (logkit:16) - [ ] banners:   https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 15:50:21,724 (3218) :  INFO (logkit:16) - [ ] posters:   https://yt3.ggpht.com/ytc/AKedOLRTHraf4M_OaDZFwfqK8F9TTjxe3DHwFZMkZGqmAw=s240-c-k-c0x00ffffff-no-rj
2021-09-19 15:50:21,726 (3218) :  INFO (logkit:16) - [ ] role:        TED
2021-09-19 15:50:21,726 (3218) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 15:50:21,726 (3218) :  INFO (logkit:16) - Season: 2007
2021-09-19 15:50:21,726 (3218) :  INFO (logkit:16) - metadata.seasons[2007].episodes[None] "20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv"
2021-09-19 15:50:21,726 (3218) :  INFO (logkit:16) - populate_episode_metadata_from_info_json() - series_root_folder: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\, filename: 20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 15:50:21,726 (3218) :  INFO (logkit:16) - Searching for "20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].info.json". Searching in "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\".
2021-09-19 15:50:21,778 (3218) :  INFO (logkit:16) - Directory \\?\U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\ contains 200 files
2021-09-19 15:50:21,779 (3218) :  INFO (logkit:16) - populate_episode_metadata_from_api() - filename: 20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 15:50:21,779 (3218) :  INFO (logkit:16) - # videoId [iG9CE55wbtY] not in Playlist/channel item list so loading json_video_details
2021-09-19 15:50:21,805 (3218) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=iG9CE55wbtY&key=' from the HTTP cache
2021-09-19 15:50:21,832 (3218) :  INFO (logkit:16) - [?] link:     "https://www.youtube.com/watch?v=iG9CE55wbtY"
2021-09-19 15:50:21,832 (3218) :  INFO (logkit:16) - [ ] title:    "Do schools kill creativity? | Sir Ken Robinson"
2021-09-19 15:50:21,832 (3218) :  INFO (logkit:16) - [ ] summary:  "Visit http://TED.com to get our entire library of TED Talks, transcripts, translations, personalized talk recommendations and more.. . Sir Ken Robinson makes an entertaining and profoundly moving case for creating an education system that nurtures (rather than undermines) creativity.. . The TED Talks channel features the best talks and performances from the TED Conference, where the world's leading thinkers and doers give the talk of their lives in 18 minutes (or less). Look for talks on Technology, Entertainment and Design -- plus science, business, global issues, the arts and more. You're welcome to link to or embed these videos, forward them to others and share these ideas with people you know. . . Follow TED on Twitter: http://twitter.com/TEDTalks. Like TED on Facebook: http://facebook.com/TED. Subscribe to our channel: http://youtube.com/TED. . TED's videos may be used for non-commercial purposes under a Creative Commons License, Attribution–Non Commercial–No Derivatives (or the CC BY – NC – ND 4.0 International) and in accordance with our TED Talks Usage Policy (https://www.ted.com/about/our-organization/our-policies-terms/ted-talks-usage-policy). For more information on using TED for commercial purposes (e.g. employee learning, in a film or online course), please submit a Media Request at https://media-requests.ted.com"
2021-09-19 15:50:21,832 (3218) :  CRITICAL (core:574) - Exception in the update function of agent named 'YouTubeSeries', called with guid 'com.plexapp.agents.youtube://youtube|UCAuUUnT6oDeKwE6v1NGQxug|TED [UCAuUUnT6oDeKwE6v1NGQxug]/2007/1900-01-01?lang=xn' (most recent call last):
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py", line 1093, in _update
    agent.update(obj, media, lang, **kwargs)
  File "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 518, in update
    def update (self, metadata, media, lang, force ):  Update (metadata, media, lang, force,  False)
  File "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 490, in Update
    if len(e)>3:  episode.originally_available_at = Datetime.ParseDate(json_video_details['snippet']['publishedAt']).date();                       Log.Info('[ ] date:     "{}"'.format(json_video_details['snippet']['publishedAt']))
TypeError: object of type 'NoneType' has no len()

2021-09-19 15:50:21,858 (3218) :  DEBUG (model:229) - Serializing to C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 15:50:21,859 (3218) :  DEBUG (runtime:88) - Sending packed state data (107 bytes)
2021-09-19 15:50:21,861 (3218) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

Is there a way I can manually make some changes to get these right?

@ZeroQI
Copy link
Owner

ZeroQI commented Sep 19, 2021

json_video_details['snippet']['publishedAt'] so need to add a check for it and ue Dict to avoit error on missing key for good practice

if len(e)>3: episode.originally_available_at = Datetime.ParseDate(json_video_details['snippet']['publishedAt']).date(); Log.Info('[ ] date: "{}"'.format(json_video_details['snippet']['publishedAt']))

replace
if len(e)>3: episode.originally_available_at = Datetime.ParseDate(json_video_details['snippet']['publishedAt']).date(); Log.Info('[ ] date: "{}"'.format(json_video_details['snippet']['publishedAt']))
with:
if len(e)>3 and Dict(json_video_details, 'snippet', 'publishedAt'): episode.originally_available_at = Datetime.ParseDate(Dict(json_video_details, 'snippet', 'publishedAt')).date(); Log.Info(u'[ ] date: "{}"'.format(Dict(json_video_details, 'snippet', 'publishedAt')))
and report please

@MatthK
Copy link

MatthK commented Sep 19, 2021

Doesn't seem to make a difference. The Metadata does still not get updated.

This is the new log after a restart of Plex.

2021-09-19 16:22:13,648 (3664) :  INFO (core:349) - Starting framework core - Version: 2.6.3, Build: 2b1b51d (Thu Aug 26 08:46:10 UTC 2021)
2021-09-19 16:22:13,648 (3664) :  DEBUG (core:361) - Using the elevated policy
2021-09-19 16:22:13,648 (3664) :  DEBUG (core:450) - Starting runtime component.
2021-09-19 16:22:13,651 (3664) :  DEBUG (core:450) - Starting caching component.
2021-09-19 16:22:13,651 (3664) :  DEBUG (core:450) - Starting data component.
2021-09-19 16:22:13,651 (3664) :  DEBUG (core:450) - Starting networking component.
2021-09-19 16:22:13,651 (3664) :  DEBUG (networking:261) - Loaded HTTP cookies
2021-09-19 16:22:13,664 (3664) :  DEBUG (networking:428) - Setting the default network timeout to 20.0
2021-09-19 16:22:13,664 (3664) :  DEBUG (core:450) - Starting localization component.
2021-09-19 16:22:13,664 (3664) :  INFO (localization:409) - Setting the default locale to en-us
2021-09-19 16:22:13,664 (3664) :  DEBUG (core:450) - Starting messaging component.
2021-09-19 16:22:13,664 (3664) :  DEBUG (core:450) - Starting debugging component.
2021-09-19 16:22:13,665 (3664) :  DEBUG (core:450) - Starting services component.
2021-09-19 16:22:13,665 (3664) :  DEBUG (core:450) - Starting myplex component.
2021-09-19 16:22:13,665 (10a4) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/system/messaging/clear_events/com.plexapp.agents.youtube'
2021-09-19 16:22:13,665 (3664) :  DEBUG (core:450) - Starting notifications component.
2021-09-19 16:22:13,746 (3664) :  DEBUG (accessor:68) - Creating a new model access point for provider com.plexapp.agents.youtube in namespace 'metadata'
2021-09-19 16:22:13,750 (3664) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/resourceHashes'
2021-09-19 16:22:13,868 (44fc) :  DEBUG (services:265) - Plug-in is not daemonized - loading services from system
2021-09-19 16:22:13,868 (3664) :  DEBUG (runtime:1117) - Created a thread named 'load_all_services'
2021-09-19 16:22:13,871 (3664) :  DEBUG (runtime:1117) - Created a thread named 'get_server_info'
2021-09-19 16:22:13,871 (44fc) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X0J1bmRsZVNlcnZpY2U6QWxsU2VydmljZXM_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMApyMAo_'
2021-09-19 16:22:13,872 (3664) :  DEBUG (core:150) - Finished starting framework core
2021-09-19 16:22:13,874 (165c) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400'
2021-09-19 16:22:13,875 (3664) :  DEBUG (core:560) - Loading plug-in code
2021-09-19 16:22:13,908 (165c) :  DEBUG (core:538) - Machine identifier is aeaecc8613f4673bd847fe6c2b52ef0191cf3e68
2021-09-19 16:22:13,910 (165c) :  DEBUG (core:539) - Server version is 1.24.2.4973-2b1b51db9
2021-09-19 16:22:14,164 (44fc) :  DEBUG (services:362) - Loaded services
2021-09-19 16:22:14,173 (2da4) :  DEBUG (services:438) - No shared code to load
2021-09-19 16:22:14,384 (3664) :  DEBUG (core:566) - Finished loading plug-in code
2021-09-19 16:22:14,384 (3664) :  DEBUG (agentkit:1132) - Creating new agent class called YouTubeSeriesAgent
2021-09-19 16:22:14,384 (3664) :  DEBUG (agentkit:937) - Updating agent information: [{'media_types': ['TV_Show'], 'accepts_from': ['com.plexapp.agents.localmedia'], 'fallback_agent': None, 'contributes_to': None, 'languages': ['xn'], 'persist_stored_files': True, 'version': 0, 'primary_provider': True, 'prefs': True, 'name': 'YouTubeSeries'}]
2021-09-19 16:22:14,385 (3664) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X0FnZW50U2VydmljZTpVcGRhdGVJbmZv/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQo2CmRpY3QKbGlzdApkaWN0Cmxpc3QKbGlzdApsaXN0CjIKczI2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlczEwCmlkZW50aWZpZXJyMQpzMTAKYWdlbnRfaW5mbzEKcjIKMTAKcjMKczExCm1lZGlhX3R5cGVzcjQKczEyCmFjY2VwdHNfZnJvbW5zMTQKZmFsbGJhY2tfYWdlbnRuczE0CmNvbnRyaWJ1dGVzX3RvcjUKczkKbGFuZ3VhZ2VzYjFzMjAKcGVyc2lzdF9zdG9yZWRfZmlsZXNpMApzNwp2ZXJzaW9uYjFzMTYKcHJpbWFyeV9wcm92aWRlcmIxczUKcHJlZnNzMTMKWW91VHViZVNlcmllc3M0Cm5hbWUxCnM3ClRWX1Nob3cxCnMyOQpjb20ucGxleGFwcC5hZ2VudHMubG9jYWxtZWRpYTEKczIKeG5yMAo_'
2021-09-19 16:22:14,418 (3664) :  DEBUG (agentkit:1132) - Creating new agent class called YouTubeMovieAgent
2021-09-19 16:22:14,420 (3664) :  DEBUG (agentkit:937) - Updating agent information: [{'media_types': ['TV_Show'], 'accepts_from': ['com.plexapp.agents.localmedia'], 'fallback_agent': None, 'contributes_to': None, 'languages': ['xn'], 'persist_stored_files': True, 'version': 0, 'primary_provider': True, 'prefs': True, 'name': 'YouTubeSeries'}, {'media_types': ['Movie'], 'accepts_from': ['com.plexapp.agents.localmedia'], 'fallback_agent': None, 'contributes_to': None, 'languages': ['xn'], 'persist_stored_files': True, 'version': 0, 'primary_provider': True, 'prefs': True, 'name': 'YouTubeMovie'}]
2021-09-19 16:22:14,421 (3664) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X0FnZW50U2VydmljZTpVcGRhdGVJbmZv/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxMApkaWN0Cmxpc3QKZGljdApsaXN0Cmxpc3QKbGlzdApkaWN0Cmxpc3QKbGlzdApsaXN0CjIKczI2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlczEwCmlkZW50aWZpZXJyMQpzMTAKYWdlbnRfaW5mbzIKcjIKcjYKMTAKcjMKczExCm1lZGlhX3R5cGVzcjQKczEyCmFjY2VwdHNfZnJvbW5zMTQKZmFsbGJhY2tfYWdlbnRuczE0CmNvbnRyaWJ1dGVzX3RvcjUKczkKbGFuZ3VhZ2VzYjFzMjAKcGVyc2lzdF9zdG9yZWRfZmlsZXNpMApzNwp2ZXJzaW9uYjFzMTYKcHJpbWFyeV9wcm92aWRlcmIxczUKcHJlZnNzMTMKWW91VHViZVNlcmllc3M0Cm5hbWUxCnM3ClRWX1Nob3cxCnMyOQpjb20ucGxleGFwcC5hZ2VudHMubG9jYWxtZWRpYTEKczIKeG4xMApyNwpzMTEKbWVkaWFfdHlwZXNyOApzMTIKYWNjZXB0c19mcm9tbnMxNApmYWxsYmFja19hZ2VudG5zMTQKY29udHJpYnV0ZXNfdG9yOQpzOQpsYW5ndWFnZXNiMXMyMApwZXJzaXN0X3N0b3JlZF9maWxlc2kwCnM3CnZlcnNpb25iMXMxNgpwcmltYXJ5X3Byb3ZpZGVyYjFzNQpwcmVmc3MxMgpZb3VUdWJlTW92aWVzNApuYW1lMQpzNQpNb3ZpZTEKczI5CmNvbS5wbGV4YXBwLmFnZW50cy5sb2NhbG1lZGlhMQpzMgp4bnIwCg__'
2021-09-19 16:22:14,450 (3664) :  INFO (logkit:16) - Library: C:\Users\Matth\AppData\Local\Plex Media Server
2021-09-19 16:22:14,451 (3664) :  INFO (logkit:16) - 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-TokenHTTP Error 401: Unauthorized
2021-09-19 16:22:14,451 (3664) :  INFO (core:611) - Started plug-in
2021-09-19 16:22:14,453 (3664) :  DEBUG (socketinterface:160) - Starting socket server
2021-09-19 16:22:14,453 (3664) :  DEBUG (runtime:1117) - Created a thread named 'start'
2021-09-19 16:22:14,453 (3664) :  INFO (socketinterface:184) - Socket server started on port 52463
2021-09-19 16:22:14,453 (3664) :  INFO (pipeinterface:25) - Entering run loop
2021-09-19 16:22:14,454 (3664) :  DEBUG (runtime:717) - Handling request GET /:/prefixes
2021-09-19 16:22:14,454 (3664) :  DEBUG (runtime:814) - Found route matching /:/prefixes
2021-09-19 16:22:14,456 (3664) :  DEBUG (runtime:924) - Response: [200] MediaContainer, 151 bytes
2021-09-19 16:22:28,369 (2d2c) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwNHM0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 16:22:28,378 (2d2c) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwNHM0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 16:22:28,380 (2d2c) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCAuUUnT6oDeKwE6v1NGQxug|TED [UCAuUUnT6oDeKwE6v1NGQxug]/2007/1900-01-01?lang=xn
2021-09-19 16:22:28,381 (2d2c) :  DEBUG (model:234) - Deserializing from C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 16:22:28,394 (2d2c) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/98204/tree'
2021-09-19 16:22:28,403 (2d2c) :  INFO (logkit:16) - === update(lang=xn, force=True, movie=False) ===
2021-09-19 16:22:28,403 (2d2c) :  INFO (logkit:16) - U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 16:22:28,404 (2d2c) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 16:22:28,404 (2d2c) :  INFO (logkit:16) - [!] Library access denied
2021-09-19 16:22:28,404 (2d2c) :  INFO (logkit:16) - [!] ASS root scanner file missing: "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems\_Logs\_root_.scanner.log"
2021-09-19 16:22:28,404 (2d2c) :  INFO (logkit:16) - [ ] library:    ""
2021-09-19 16:22:28,404 (2d2c) :  INFO (logkit:16) - [ ] root:       "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 16:22:28,404 (2d2c) :  INFO (logkit:16) - [ ] path:       ""
2021-09-19 16:22:28,404 (2d2c) :  INFO (logkit:16) - [ ] dir:        "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 16:22:28,404 (2d2c) :  INFO (logkit:16) - [ ] series_root_folder: "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\"
2021-09-19 16:22:28,479 (2d2c) :  INFO (logkit:16) - [ ] subfolder_count:    "0"
2021-09-19 16:22:28,479 (2d2c) :  INFO (logkit:16) - Grouping folder not found or single folder, root: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug], path: , Grouping folder: , subdirs: 0, reverse_path: ['']
2021-09-19 16:22:28,480 (2d2c) :  WARNING (data:179) - Error decoding with simplejson, using demjson instead (this will cause a performance hit) - Expecting value: line 5 column 1 (char 518)
2021-09-19 16:22:28,480 (2d2c) :  DEBUG (preferences:258) - Loaded preferences from DefaultPrefs.json
2021-09-19 16:22:28,482 (2d2c) :  DEBUG (preferences:178) - Loaded the user preferences for com.plexapp.agents.youtube
2021-09-19 16:22:28,515 (2d2c) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics%2CbrandingSettings&id=UCAuUUnT6oDeKwE6v1NGQxug&key=' from the HTTP cache
2021-09-19 16:22:28,546 (2d2c) :  INFO (logkit:16) - [ ] title:        "TED ", metadata.title: "TED "
2021-09-19 16:22:28,546 (2d2c) :  INFO (logkit:16) - [ ] art:       https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 16:22:28,546 (2d2c) :  INFO (logkit:16) - [ ] banners:   https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 16:22:28,546 (2d2c) :  INFO (logkit:16) - [ ] posters:   https://yt3.ggpht.com/ytc/AKedOLRTHraf4M_OaDZFwfqK8F9TTjxe3DHwFZMkZGqmAw=s240-c-k-c0x00ffffff-no-rj
2021-09-19 16:22:28,546 (2d2c) :  INFO (logkit:16) - [ ] role:        TED
2021-09-19 16:22:28,546 (2d2c) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 16:22:28,546 (2d2c) :  INFO (logkit:16) - Season: 2007
2021-09-19 16:22:28,546 (2d2c) :  INFO (logkit:16) - metadata.seasons[2007].episodes[None] "20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv"
2021-09-19 16:22:28,548 (2d2c) :  INFO (logkit:16) - populate_episode_metadata_from_info_json() - series_root_folder: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\, filename: 20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 16:22:28,548 (2d2c) :  INFO (logkit:16) - Searching for "20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].info.json". Searching in "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\".
2021-09-19 16:22:28,602 (2d2c) :  INFO (logkit:16) - Directory \\?\U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\ contains 200 files
2021-09-19 16:22:28,602 (2d2c) :  INFO (logkit:16) - populate_episode_metadata_from_api() - filename: 20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 16:22:28,604 (2d2c) :  INFO (logkit:16) - # videoId [iG9CE55wbtY] not in Playlist/channel item list so loading json_video_details
2021-09-19 16:22:28,631 (2d2c) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=iG9CE55wbtY&key=' from the HTTP cache
2021-09-19 16:22:28,660 (2d2c) :  INFO (logkit:16) - [?] link:     "https://www.youtube.com/watch?v=iG9CE55wbtY"
2021-09-19 16:22:28,661 (2d2c) :  INFO (logkit:16) - [ ] title:    "Do schools kill creativity? | Sir Ken Robinson"
2021-09-19 16:22:28,661 (2d2c) :  INFO (logkit:16) - [ ] summary:  "Visit http://TED.com to get our entire library of TED Talks, transcripts, translations, personalized talk recommendations and more.. . Sir Ken Robinson makes an entertaining and profoundly moving case for creating an education system that nurtures (rather than undermines) creativity.. . The TED Talks channel features the best talks and performances from the TED Conference, where the world's leading thinkers and doers give the talk of their lives in 18 minutes (or less). Look for talks on Technology, Entertainment and Design -- plus science, business, global issues, the arts and more. You're welcome to link to or embed these videos, forward them to others and share these ideas with people you know. . . Follow TED on Twitter: http://twitter.com/TEDTalks. Like TED on Facebook: http://facebook.com/TED. Subscribe to our channel: http://youtube.com/TED. . TED's videos may be used for non-commercial purposes under a Creative Commons License, Attribution–Non Commercial–No Derivatives (or the CC BY – NC – ND 4.0 International) and in accordance with our TED Talks Usage Policy (https://www.ted.com/about/our-organization/our-policies-terms/ted-talks-usage-policy). For more information on using TED for commercial purposes (e.g. employee learning, in a film or online course), please submit a Media Request at https://media-requests.ted.com"
2021-09-19 16:22:28,661 (2d2c) :  CRITICAL (core:574) - Exception in the update function of agent named 'YouTubeSeries', called with guid 'com.plexapp.agents.youtube://youtube|UCAuUUnT6oDeKwE6v1NGQxug|TED [UCAuUUnT6oDeKwE6v1NGQxug]/2007/1900-01-01?lang=xn' (most recent call last):
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py", line 1093, in _update
    agent.update(obj, media, lang, **kwargs)
  File "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 519, in update
    def update (self, metadata, media, lang, force ):  Update (metadata, media, lang, force,  False)
  File "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 491, in Update
    if len(e)>3 and Dict(json_video_details, 'snippet', 'publishedAt'): episode.originally_available_at = Datetime.ParseDate(Dict(json_video_details, 'snippet', 'publishedAt')).date(); Log.Info(u'[ ] date: "{}"'.format(Dict(json_video_details, 'snippet', 'publishedAt')))
TypeError: object of type 'NoneType' has no len()

2021-09-19 16:22:28,687 (2d2c) :  DEBUG (model:229) - Serializing to C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 16:22:28,690 (2d2c) :  DEBUG (runtime:88) - Sending packed state data (107 bytes)
2021-09-19 16:22:28,690 (2d2c) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes
2021-09-19 16:22:59,272 (2500) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwM3M0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 16:22:59,273 (2500) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2021-09-19 16:22:59,273 (2500) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwM3M0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 16:22:59,273 (2500) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCAuUUnT6oDeKwE6v1NGQxug|TED [UCAuUUnT6oDeKwE6v1NGQxug]/2007/1900-01-01?lang=xn
2021-09-19 16:22:59,273 (2500) :  DEBUG (model:234) - Deserializing from C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 16:22:59,280 (2500) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/98203/tree'
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - === update(lang=xn, force=True, movie=False) ===
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\20070106 Secrets of success in 8 words, 3 minutes _ Richard St. John [Y6bbMQXQ180].mp4
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - [!] Library access denied
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - [!] ASS root scanner file missing: "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems\_Logs\_root_.scanner.log"
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - [ ] library:    ""
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - [ ] root:       "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - [ ] path:       ""
2021-09-19 16:22:59,289 (2500) :  INFO (logkit:16) - [ ] dir:        "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 16:22:59,290 (2500) :  INFO (logkit:16) - [ ] series_root_folder: "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\"
2021-09-19 16:22:59,365 (2500) :  INFO (logkit:16) - [ ] subfolder_count:    "0"
2021-09-19 16:22:59,365 (2500) :  INFO (logkit:16) - Grouping folder not found or single folder, root: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug], path: , Grouping folder: , subdirs: 0, reverse_path: ['']
2021-09-19 16:22:59,395 (2500) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics%2CbrandingSettings&id=UCAuUUnT6oDeKwE6v1NGQxug&key=' from the HTTP cache
2021-09-19 16:22:59,426 (2500) :  INFO (logkit:16) - [ ] title:        "TED ", metadata.title: "TED "
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - [ ] art:       https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - [ ] banners:   https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - [ ] posters:   https://yt3.ggpht.com/ytc/AKedOLRTHraf4M_OaDZFwfqK8F9TTjxe3DHwFZMkZGqmAw=s240-c-k-c0x00ffffff-no-rj
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - [ ] role:        TED
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - Season: 2007
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - metadata.seasons[2007].episodes[None] "20070106 Secrets of success in 8 words, 3 minutes _ Richard St. John [Y6bbMQXQ180].mp4"
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - populate_episode_metadata_from_info_json() - series_root_folder: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\, filename: 20070106 Secrets of success in 8 words, 3 minutes _ Richard St. John [Y6bbMQXQ180].mp4
2021-09-19 16:22:59,427 (2500) :  INFO (logkit:16) - Searching for "20070106 Secrets of success in 8 words, 3 minutes _ Richard St. John [Y6bbMQXQ180].info.json". Searching in "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\".
2021-09-19 16:22:59,480 (2500) :  INFO (logkit:16) - Directory \\?\U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\ contains 200 files
2021-09-19 16:22:59,480 (2500) :  INFO (logkit:16) - populate_episode_metadata_from_api() - filename: 20070106 Secrets of success in 8 words, 3 minutes _ Richard St. John [Y6bbMQXQ180].mp4
2021-09-19 16:22:59,480 (2500) :  INFO (logkit:16) - # videoId [Y6bbMQXQ180] not in Playlist/channel item list so loading json_video_details
2021-09-19 16:22:59,507 (2500) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=Y6bbMQXQ180&key=' from the HTTP cache
2021-09-19 16:22:59,535 (2500) :  INFO (logkit:16) - [?] link:     "https://www.youtube.com/watch?v=Y6bbMQXQ180"
2021-09-19 16:22:59,535 (2500) :  INFO (logkit:16) - [ ] title:    "Secrets of success in 8 words, 3 minutes | Richard St. John"
2021-09-19 16:22:59,535 (2500) :  INFO (logkit:16) - [ ] summary:  "http://www.ted.com  Why do people succeed? Is it because they're smart, or are they just lucky? Analyst Richard St. John condenses years of interviews into an unmissable 3-minute presentation on the real secrets of success.
. 
. TEDTalks is a daily video podcast of the best talks and performances from the TED Conference, where the world's leading thinkers and doers give the talk of their lives in 18 minutes. TED stands for Technology, Entertainment, Design, and TEDTalks cover these topics as well as science, business, development and the arts. Closed captions and translated subtitles in a variety of languages are now available on TED.com, at http://www.ted.com/translate.
. 
. Follow us on Twitter
. http://www.twitter.com/tednews
.  
. Checkout our Facebook page for TED exclusives
. https://www.facebook.com/TED"
2021-09-19 16:22:59,536 (2500) :  CRITICAL (core:574) - Exception in the update function of agent named 'YouTubeSeries', called with guid 'com.plexapp.agents.youtube://youtube|UCAuUUnT6oDeKwE6v1NGQxug|TED [UCAuUUnT6oDeKwE6v1NGQxug]/2007/1900-01-01?lang=xn' (most recent call last):
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py", line 1093, in _update
    agent.update(obj, media, lang, **kwargs)
  File "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 519, in update
    def update (self, metadata, media, lang, force ):  Update (metadata, media, lang, force,  False)
  File "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 491, in Update
    if len(e)>3 and Dict(json_video_details, 'snippet', 'publishedAt'): episode.originally_available_at = Datetime.ParseDate(Dict(json_video_details, 'snippet', 'publishedAt')).date(); Log.Info(u'[ ] date: "{}"'.format(Dict(json_video_details, 'snippet', 'publishedAt')))
TypeError: object of type 'NoneType' has no len()

2021-09-19 16:22:59,562 (2500) :  DEBUG (model:229) - Serializing to C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 16:22:59,565 (2500) :  DEBUG (runtime:88) - Sending packed state data (107 bytes)
2021-09-19 16:22:59,565 (2500) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

@ZeroQI
Copy link
Owner

ZeroQI commented Sep 19, 2021

Thanks to your feedback, we now know "len(e)" cause the error...

if len(e)>3: episode.originally_available_at = Datetime.ParseDate(json_video_details['snippet']['publishedAt']).date(); Log.Info('[ ] date: "{}"'.format(json_video_details['snippet']['publishedAt']))

replace with:
if e is not None and len(e)>3 and Dict(json_video_details, 'snippet', 'publishedAt'): episode.originally_available_at = Datetime.ParseDate(Dict(json_video_details, 'snippet', 'publishedAt')).date(); Log.Info(u'[ ] date: "{}"'.format(Dict(json_video_details, 'snippet', 'publishedAt')))
and report please

@MatthK
Copy link

MatthK commented Sep 19, 2021

I updated the file, restarted Plex, refreshed the page with the YouTube video season and tried to refresh the Metadata for one Episode.

It showed another error. Looks like that line has a syntax error.

2021-09-19 20:15:14,256 (3bf4) :  INFO (core:349) - Starting framework core - Version: 2.6.3, Build: 2b1b51d (Thu Aug 26 08:46:10 UTC 2021)
2021-09-19 20:15:14,256 (3bf4) :  DEBUG (core:361) - Using the elevated policy
2021-09-19 20:15:14,256 (3bf4) :  DEBUG (core:450) - Starting runtime component.
2021-09-19 20:15:14,259 (3bf4) :  DEBUG (core:450) - Starting caching component.
2021-09-19 20:15:14,259 (3bf4) :  DEBUG (core:450) - Starting data component.
2021-09-19 20:15:14,259 (3bf4) :  DEBUG (core:450) - Starting networking component.
2021-09-19 20:15:14,259 (3bf4) :  DEBUG (networking:261) - Loaded HTTP cookies
2021-09-19 20:15:14,273 (3bf4) :  DEBUG (networking:428) - Setting the default network timeout to 20.0
2021-09-19 20:15:14,273 (3bf4) :  DEBUG (core:450) - Starting localization component.
2021-09-19 20:15:14,273 (3bf4) :  INFO (localization:409) - Setting the default locale to en-us
2021-09-19 20:15:14,273 (3bf4) :  DEBUG (core:450) - Starting messaging component.
2021-09-19 20:15:14,275 (3bf4) :  DEBUG (core:450) - Starting debugging component.
2021-09-19 20:15:14,275 (3bf4) :  DEBUG (core:450) - Starting services component.
2021-09-19 20:15:14,276 (3568) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/system/messaging/clear_events/com.plexapp.agents.youtube'
2021-09-19 20:15:14,276 (3bf4) :  DEBUG (core:450) - Starting myplex component.
2021-09-19 20:15:14,276 (3bf4) :  DEBUG (core:450) - Starting notifications component.
2021-09-19 20:15:14,357 (3bf4) :  DEBUG (accessor:68) - Creating a new model access point for provider com.plexapp.agents.youtube in namespace 'metadata'
2021-09-19 20:15:14,361 (3bf4) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/resourceHashes'
2021-09-19 20:15:14,441 (3bb4) :  DEBUG (services:265) - Plug-in is not daemonized - loading services from system
2021-09-19 20:15:14,441 (3bf4) :  DEBUG (runtime:1117) - Created a thread named 'load_all_services'
2021-09-19 20:15:14,444 (3bf4) :  DEBUG (runtime:1117) - Created a thread named 'get_server_info'
2021-09-19 20:15:14,444 (3bb4) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X0J1bmRsZVNlcnZpY2U6QWxsU2VydmljZXM_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMApyMAo_'
2021-09-19 20:15:14,444 (3bf4) :  DEBUG (core:150) - Finished starting framework core
2021-09-19 20:15:14,444 (39c0) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400'
2021-09-19 20:15:14,447 (3bf4) :  DEBUG (core:560) - Loading plug-in code
2021-09-19 20:15:14,466 (39c0) :  DEBUG (core:538) - Machine identifier is aeaecc8613f4673bd847fe6c2b52ef0191cf3e68
2021-09-19 20:15:14,466 (3bf4) :  CRITICAL (core:574) - Exception while loading code (most recent call last):
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\core.py", line 563, in load_code
    self.init_code = self.loader.load(self.init_path, elevated, use_xpython = Framework.constants.flags.use_xpython in self.sandbox.flags)
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\code\loader.py", line 47, in load
    code = self.compile(str(source), str(uni(filename)), elevated)
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\code\loader.py", line 52, in compile
    return RestrictedPython.compile_restricted(source, name, 'exec', elevated=elevated)
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Platforms\Shared\Libraries\RestrictedPython\RCompile.py", line 115, in compile_restricted
    gen.compile()
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Platforms\Shared\Libraries\RestrictedPython\RCompile.py", line 68, in compile
    tree = self._get_tree()
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Platforms\Shared\Libraries\RestrictedPython\RCompile.py", line 59, in _get_tree
    tree = self.parse()
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Platforms\Shared\Libraries\RestrictedPython\RCompile.py", line 56, in parse
    return niceParse(self.source, self.filename, self.mode)
  File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-2b1b51db9\Framework.bundle\Contents\Resources\Platforms\Shared\Libraries\RestrictedPython\RCompile.py", line 38, in niceParse
    compile(source, filename, mode)
  File "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-ins\YouTube-Agent.bundle\Contents\Code\__init__.py", line 492
    if e is not None and len(e)>3 and Dict(json_video_details, 'snippet', 'publishedAt'): episode.originally_available_at = Datetime.ParseDate(Dict(json_video_details, 'snippet', 'publishedAt')).date(); Log.Info(u'[ ] date: "{}"'.format(Dict(json_video_details, 'snippet', 'publishedAt')))
    ^
IndentationError: unexpected indent

2021-09-19 20:15:14,467 (39c0) :  DEBUG (core:539) - Server version is 1.24.2.4973-2b1b51db9
2021-09-19 20:15:14,542 (3bb4) :  DEBUG (services:362) - Loaded services
2021-09-19 20:15:14,548 (29d0) :  DEBUG (services:438) - No shared code to load

@ZeroQI
Copy link
Owner

ZeroQI commented Sep 19, 2021

Number of spaces before the command is too much. Put same number of leading spaces as old command

Using latest code it is line 490: https://github.com/ZeroQI/YouTube-Agent.bundle/blob/master/Contents/Code/__init__.py#L490

@MatthK
Copy link

MatthK commented Sep 19, 2021

I used a tab instead of spaces. Unfortunately, still no improvement. The Metadata is not loading. This is the log.

2021-09-19 20:58:29,384 (473c) :  INFO (core:349) - Starting framework core - Version: 2.6.3, Build: 2b1b51d (Thu Aug 26 08:46:10 UTC 2021)
2021-09-19 20:58:29,384 (473c) :  DEBUG (core:361) - Using the elevated policy
2021-09-19 20:58:29,384 (473c) :  DEBUG (core:450) - Starting runtime component.
2021-09-19 20:58:29,387 (473c) :  DEBUG (core:450) - Starting caching component.
2021-09-19 20:58:29,388 (473c) :  DEBUG (core:450) - Starting data component.
2021-09-19 20:58:29,388 (473c) :  DEBUG (core:450) - Starting networking component.
2021-09-19 20:58:29,388 (473c) :  DEBUG (networking:261) - Loaded HTTP cookies
2021-09-19 20:58:29,401 (473c) :  DEBUG (networking:428) - Setting the default network timeout to 20.0
2021-09-19 20:58:29,401 (473c) :  DEBUG (core:450) - Starting localization component.
2021-09-19 20:58:29,401 (473c) :  INFO (localization:409) - Setting the default locale to en-us
2021-09-19 20:58:29,401 (473c) :  DEBUG (core:450) - Starting messaging component.
2021-09-19 20:58:29,403 (473c) :  DEBUG (core:450) - Starting debugging component.
2021-09-19 20:58:29,403 (473c) :  DEBUG (core:450) - Starting services component.
2021-09-19 20:58:29,404 (473c) :  DEBUG (core:450) - Starting myplex component.
2021-09-19 20:58:29,404 (3b00) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/system/messaging/clear_events/com.plexapp.agents.youtube'
2021-09-19 20:58:29,404 (473c) :  DEBUG (core:450) - Starting notifications component.
2021-09-19 20:58:29,487 (473c) :  DEBUG (accessor:68) - Creating a new model access point for provider com.plexapp.agents.youtube in namespace 'metadata'
2021-09-19 20:58:29,490 (473c) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/resourceHashes'
2021-09-19 20:58:29,553 (da8) :  DEBUG (services:265) - Plug-in is not daemonized - loading services from system
2021-09-19 20:58:29,553 (473c) :  DEBUG (runtime:1117) - Created a thread named 'load_all_services'
2021-09-19 20:58:29,555 (473c) :  DEBUG (runtime:1117) - Created a thread named 'get_server_info'
2021-09-19 20:58:29,555 (da8) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X0J1bmRsZVNlcnZpY2U6QWxsU2VydmljZXM_/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMApyMAo_'
2021-09-19 20:58:29,556 (473c) :  DEBUG (core:150) - Finished starting framework core
2021-09-19 20:58:29,556 (4654) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400'
2021-09-19 20:58:29,558 (473c) :  DEBUG (core:560) - Loading plug-in code
2021-09-19 20:58:29,588 (4654) :  DEBUG (core:538) - Machine identifier is aeaecc8613f4673bd847fe6c2b52ef0191cf3e68
2021-09-19 20:58:29,589 (4654) :  DEBUG (core:539) - Server version is 1.24.2.4973-2b1b51db9
2021-09-19 20:58:29,881 (da8) :  DEBUG (services:362) - Loaded services
2021-09-19 20:58:29,888 (3aac) :  DEBUG (services:438) - No shared code to load
2021-09-19 20:58:30,161 (473c) :  DEBUG (core:566) - Finished loading plug-in code
2021-09-19 20:58:30,161 (473c) :  DEBUG (agentkit:1132) - Creating new agent class called YouTubeSeriesAgent
2021-09-19 20:58:30,163 (473c) :  DEBUG (agentkit:937) - Updating agent information: [{'media_types': ['TV_Show'], 'accepts_from': ['com.plexapp.agents.localmedia'], 'fallback_agent': None, 'contributes_to': None, 'languages': ['xn'], 'persist_stored_files': True, 'version': 0, 'primary_provider': True, 'prefs': True, 'name': 'YouTubeSeries'}]
2021-09-19 20:58:30,164 (473c) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X0FnZW50U2VydmljZTpVcGRhdGVJbmZv/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQo2CmRpY3QKbGlzdApkaWN0Cmxpc3QKbGlzdApsaXN0CjIKczI2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlczEwCmlkZW50aWZpZXJyMQpzMTAKYWdlbnRfaW5mbzEKcjIKMTAKcjMKczExCm1lZGlhX3R5cGVzcjQKczEyCmFjY2VwdHNfZnJvbW5zMTQKZmFsbGJhY2tfYWdlbnRuczE0CmNvbnRyaWJ1dGVzX3RvcjUKczkKbGFuZ3VhZ2VzYjFzMjAKcGVyc2lzdF9zdG9yZWRfZmlsZXNpMApzNwp2ZXJzaW9uYjFzMTYKcHJpbWFyeV9wcm92aWRlcmIxczUKcHJlZnNzMTMKWW91VHViZVNlcmllc3M0Cm5hbWUxCnM3ClRWX1Nob3cxCnMyOQpjb20ucGxleGFwcC5hZ2VudHMubG9jYWxtZWRpYTEKczIKeG5yMAo_'
2021-09-19 20:58:30,171 (473c) :  DEBUG (agentkit:1132) - Creating new agent class called YouTubeMovieAgent
2021-09-19 20:58:30,171 (473c) :  DEBUG (agentkit:937) - Updating agent information: [{'media_types': ['TV_Show'], 'accepts_from': ['com.plexapp.agents.localmedia'], 'fallback_agent': None, 'contributes_to': None, 'languages': ['xn'], 'persist_stored_files': True, 'version': 0, 'primary_provider': True, 'prefs': True, 'name': 'YouTubeSeries'}, {'media_types': ['Movie'], 'accepts_from': ['com.plexapp.agents.localmedia'], 'fallback_agent': None, 'contributes_to': None, 'languages': ['xn'], 'persist_stored_files': True, 'version': 0, 'primary_provider': True, 'prefs': True, 'name': 'YouTubeMovie'}]
2021-09-19 20:58:30,173 (473c) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/:/plugins/com.plexapp.system/messaging/function/X0FnZW50U2VydmljZTpVcGRhdGVJbmZv/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxMApkaWN0Cmxpc3QKZGljdApsaXN0Cmxpc3QKbGlzdApkaWN0Cmxpc3QKbGlzdApsaXN0CjIKczI2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlczEwCmlkZW50aWZpZXJyMQpzMTAKYWdlbnRfaW5mbzIKcjIKcjYKMTAKcjMKczExCm1lZGlhX3R5cGVzcjQKczEyCmFjY2VwdHNfZnJvbW5zMTQKZmFsbGJhY2tfYWdlbnRuczE0CmNvbnRyaWJ1dGVzX3RvcjUKczkKbGFuZ3VhZ2VzYjFzMjAKcGVyc2lzdF9zdG9yZWRfZmlsZXNpMApzNwp2ZXJzaW9uYjFzMTYKcHJpbWFyeV9wcm92aWRlcmIxczUKcHJlZnNzMTMKWW91VHViZVNlcmllc3M0Cm5hbWUxCnM3ClRWX1Nob3cxCnMyOQpjb20ucGxleGFwcC5hZ2VudHMubG9jYWxtZWRpYTEKczIKeG4xMApyNwpzMTEKbWVkaWFfdHlwZXNyOApzMTIKYWNjZXB0c19mcm9tbnMxNApmYWxsYmFja19hZ2VudG5zMTQKY29udHJpYnV0ZXNfdG9yOQpzOQpsYW5ndWFnZXNiMXMyMApwZXJzaXN0X3N0b3JlZF9maWxlc2kwCnM3CnZlcnNpb25iMXMxNgpwcmltYXJ5X3Byb3ZpZGVyYjFzNQpwcmVmc3MxMgpZb3VUdWJlTW92aWVzNApuYW1lMQpzNQpNb3ZpZTEKczI5CmNvbS5wbGV4YXBwLmFnZW50cy5sb2NhbG1lZGlhMQpzMgp4bnIwCg__'
2021-09-19 20:58:30,183 (473c) :  INFO (logkit:16) - Library: C:\Users\Matth\AppData\Local\Plex Media Server
2021-09-19 20:58:30,184 (473c) :  INFO (logkit:16) - 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-TokenHTTP Error 401: Unauthorized
2021-09-19 20:58:30,184 (473c) :  INFO (core:611) - Started plug-in
2021-09-19 20:58:30,184 (473c) :  DEBUG (socketinterface:160) - Starting socket server
2021-09-19 20:58:30,186 (473c) :  DEBUG (runtime:1117) - Created a thread named 'start'
2021-09-19 20:58:30,186 (473c) :  INFO (socketinterface:184) - Socket server started on port 49342
2021-09-19 20:58:30,186 (473c) :  INFO (pipeinterface:25) - Entering run loop
2021-09-19 20:58:30,187 (473c) :  DEBUG (runtime:717) - Handling request GET /:/prefixes
2021-09-19 20:58:30,187 (473c) :  DEBUG (runtime:814) - Found route matching /:/prefixes
2021-09-19 20:58:30,187 (473c) :  DEBUG (runtime:924) - Response: [200] MediaContainer, 151 bytes
2021-09-19 20:58:40,605 (27ac) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwNHM0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 20:58:40,617 (27ac) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwNHM0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 20:58:40,618 (27ac) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCAuUUnT6oDeKwE6v1NGQxug|TED [UCAuUUnT6oDeKwE6v1NGQxug]/2007/1900-01-01?lang=xn
2021-09-19 20:58:40,619 (27ac) :  DEBUG (model:234) - Deserializing from C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 20:58:40,631 (27ac) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/98204/tree'
2021-09-19 20:58:40,641 (27ac) :  INFO (logkit:16) - === update(lang=xn, force=True, movie=False) ===
2021-09-19 20:58:40,641 (27ac) :  INFO (logkit:16) - U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 20:58:40,641 (27ac) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 20:58:40,641 (27ac) :  INFO (logkit:16) - [!] Library access denied
2021-09-19 20:58:40,641 (27ac) :  INFO (logkit:16) - [!] ASS root scanner file missing: "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems\_Logs\_root_.scanner.log"
2021-09-19 20:58:40,641 (27ac) :  INFO (logkit:16) - [ ] library:    ""
2021-09-19 20:58:40,641 (27ac) :  INFO (logkit:16) - [ ] root:       "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 20:58:40,641 (27ac) :  INFO (logkit:16) - [ ] path:       ""
2021-09-19 20:58:40,642 (27ac) :  INFO (logkit:16) - [ ] dir:        "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 20:58:40,642 (27ac) :  INFO (logkit:16) - [ ] series_root_folder: "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\"
2021-09-19 20:58:40,716 (27ac) :  INFO (logkit:16) - [ ] subfolder_count:    "0"
2021-09-19 20:58:40,716 (27ac) :  INFO (logkit:16) - Grouping folder not found or single folder, root: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug], path: , Grouping folder: , subdirs: 0, reverse_path: ['']
2021-09-19 20:58:40,717 (27ac) :  WARNING (data:179) - Error decoding with simplejson, using demjson instead (this will cause a performance hit) - Expecting value: line 5 column 1 (char 518)
2021-09-19 20:58:40,719 (27ac) :  DEBUG (preferences:258) - Loaded preferences from DefaultPrefs.json
2021-09-19 20:58:40,720 (27ac) :  DEBUG (preferences:178) - Loaded the user preferences for com.plexapp.agents.youtube
2021-09-19 20:58:40,752 (27ac) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics%2CbrandingSettings&id=UCAuUUnT6oDeKwE6v1NGQxug&key=' from the HTTP cache
2021-09-19 20:58:40,782 (27ac) :  INFO (logkit:16) - [ ] title:        "TED ", metadata.title: "TED "
2021-09-19 20:58:40,783 (27ac) :  INFO (logkit:16) - [ ] art:       https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 20:58:40,783 (27ac) :  INFO (logkit:16) - [ ] banners:   https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 20:58:40,783 (27ac) :  INFO (logkit:16) - [ ] posters:   https://yt3.ggpht.com/ytc/AKedOLRTHraf4M_OaDZFwfqK8F9TTjxe3DHwFZMkZGqmAw=s240-c-k-c0x00ffffff-no-rj
2021-09-19 20:58:40,785 (27ac) :  INFO (logkit:16) - [ ] role:        TED
2021-09-19 20:58:40,785 (27ac) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 20:58:40,785 (27ac) :  INFO (logkit:16) - Season: 2007
2021-09-19 20:58:40,786 (27ac) :  INFO (logkit:16) - metadata.seasons[2007].episodes[None] "20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv"
2021-09-19 20:58:40,786 (27ac) :  INFO (logkit:16) - populate_episode_metadata_from_info_json() - series_root_folder: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\, filename: 20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 20:58:40,786 (27ac) :  INFO (logkit:16) - Searching for "20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].info.json". Searching in "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\".
2021-09-19 20:58:40,842 (27ac) :  INFO (logkit:16) - Directory \\?\U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\ contains 200 files
2021-09-19 20:58:40,842 (27ac) :  INFO (logkit:16) - populate_episode_metadata_from_api() - filename: 20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 20:58:40,842 (27ac) :  INFO (logkit:16) - # videoId [iG9CE55wbtY] not in Playlist/channel item list so loading json_video_details
2021-09-19 20:58:40,878 (27ac) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=iG9CE55wbtY&key=' from the HTTP cache
2021-09-19 20:58:40,910 (27ac) :  INFO (logkit:16) - [?] link:     "https://www.youtube.com/watch?v=iG9CE55wbtY"
2021-09-19 20:58:40,910 (27ac) :  INFO (logkit:16) - [ ] title:    "Do schools kill creativity? | Sir Ken Robinson"
2021-09-19 20:58:40,910 (27ac) :  INFO (logkit:16) - [ ] summary:  "Visit http://TED.com to get our entire library of TED Talks, transcripts, translations, personalized talk recommendations and more.. . Sir Ken Robinson makes an entertaining and profoundly moving case for creating an education system that nurtures (rather than undermines) creativity.. . The TED Talks channel features the best talks and performances from the TED Conference, where the world's leading thinkers and doers give the talk of their lives in 18 minutes (or less). Look for talks on Technology, Entertainment and Design -- plus science, business, global issues, the arts and more. You're welcome to link to or embed these videos, forward them to others and share these ideas with people you know. . . Follow TED on Twitter: http://twitter.com/TEDTalks. Like TED on Facebook: http://facebook.com/TED. Subscribe to our channel: http://youtube.com/TED. . TED's videos may be used for non-commercial purposes under a Creative Commons License, Attribution–Non Commercial–No Derivatives (or the CC BY – NC – ND 4.0 International) and in accordance with our TED Talks Usage Policy (https://www.ted.com/about/our-organization/our-policies-terms/ted-talks-usage-policy). For more information on using TED for commercial purposes (e.g. employee learning, in a film or online course), please submit a Media Request at https://media-requests.ted.com"
2021-09-19 20:58:40,911 (27ac) :  INFO (logkit:16) - [ ] duration: "PT20M4S"->"1204000"
2021-09-19 20:58:40,911 (27ac) :  INFO (logkit:16) - [ ] rating:   "9.84177785981"
2021-09-19 20:58:40,926 (27ac) :  DEBUG (networking:143) - Requesting 'https://i.ytimg.com/vi/iG9CE55wbtY/mqdefault.jpg'
2021-09-19 20:58:40,996 (27ac) :  DEBUG (networking:175) - Not caching 'https://i.ytimg.com/vi/iG9CE55wbtY/mqdefault.jpg' (content type 'image/jpeg' not cacheable in Agent plug-ins)
2021-09-19 20:58:40,997 (27ac) :  INFO (logkit:16) - [ ] thumbs:   "https://i.ytimg.com/vi/iG9CE55wbtY/mqdefault.jpg"
2021-09-19 20:58:40,997 (27ac) :  INFO (logkit:16) - [ ] Thumb: https://i.ytimg.com/vi/iG9CE55wbtY/mqdefault.jpg
2021-09-19 20:58:40,997 (27ac) :  INFO (logkit:16) - [ ] director: "TED"
2021-09-19 20:58:40,997 (27ac) :  INFO (logkit:16) - [ ] genres:   "[u'Ken', u'educational', u'education', u'school', u'TED', u'innovation', u'TEDTalks', u'system', u'schooling', u'TED2006', u'curiosity', u'creativity', u'Talks', u'Education', u'Robinson']"
2021-09-19 20:58:40,999 (27ac) :  INFO (logkit:16) - === End Of Agent Call, errors after that are Plex related ===================================================================================================
2021-09-19 20:58:41,032 (27ac) :  DEBUG (model:229) - Serializing to C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 20:58:41,036 (27ac) :  DEBUG (runtime:88) - Sending packed state data (107 bytes)
2021-09-19 20:58:41,036 (27ac) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes
2021-09-19 20:58:59,500 (4494) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwNHM0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 20:58:59,500 (4494) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2021-09-19 20:58:59,503 (4494) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.youtube/messaging/function/X0FnZW50S2l0OlVwZGF0ZU1ldGFkYXRh/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoxCmRpY3QKMTAKczIKeG5zNApsYW5nYjFzNQpmb3JjZWIwczgKcGVyaW9kaWNzNQo5ODIwNHM0CmRiaWRpMApzNwp2ZXJzaW9uczEwNQpjb20ucGxleGFwcC5hZ2VudHMueW91dHViZTovL3lvdXR1YmV8VUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnfFRFRCBbVUNBdVVVblQ2b0RlS3dFNnYxTkdReHVnXS8yMDA3P2xhbmc9eG5zMTAKcGFyZW50R1VJRHM1CjkwOTg4czgKcGFyZW50SURzNwpUVl9TaG93czEwCm1lZGlhX3R5cGVzMTE2CmNvbS5wbGV4YXBwLmFnZW50cy55b3V0dWJlOi8veW91dHViZXxVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWd8VEVEIFtVQ0F1VVVuVDZvRGVLd0U2djFOR1F4dWddLzIwMDcvMTkwMC0wMS0wMT9sYW5nPXhuczQKZ3VpZHM2Mwp5b3V0dWJlfFVDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z3xURUQgW1VDQXVVVW5UNm9EZUt3RTZ2MU5HUXh1Z11zMgppZHIwCg__
2021-09-19 20:58:59,503 (4494) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.youtube://youtube|UCAuUUnT6oDeKwE6v1NGQxug|TED [UCAuUUnT6oDeKwE6v1NGQxug]/2007/1900-01-01?lang=xn
2021-09-19 20:58:59,503 (4494) :  DEBUG (model:234) - Deserializing from C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 20:58:59,509 (4494) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/98204/tree'
2021-09-19 20:58:59,519 (4494) :  INFO (logkit:16) - === update(lang=xn, force=True, movie=False) ===
2021-09-19 20:58:59,519 (4494) :  INFO (logkit:16) - U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 20:58:59,519 (4494) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 20:58:59,519 (4494) :  INFO (logkit:16) - [!] Library access denied
2021-09-19 20:58:59,520 (4494) :  INFO (logkit:16) - [!] ASS root scanner file missing: "C:\Users\Matth\AppData\Local\Plex Media Server\Plug-in Support\Data\com.plexapp.agents.hama\DataItems\_Logs\_root_.scanner.log"
2021-09-19 20:58:59,520 (4494) :  INFO (logkit:16) - [ ] library:    ""
2021-09-19 20:58:59,520 (4494) :  INFO (logkit:16) - [ ] root:       "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 20:58:59,520 (4494) :  INFO (logkit:16) - [ ] path:       ""
2021-09-19 20:58:59,520 (4494) :  INFO (logkit:16) - [ ] dir:        "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]"
2021-09-19 20:58:59,520 (4494) :  INFO (logkit:16) - [ ] series_root_folder: "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\"
2021-09-19 20:58:59,611 (4494) :  INFO (logkit:16) - [ ] subfolder_count:    "0"
2021-09-19 20:58:59,611 (4494) :  INFO (logkit:16) - Grouping folder not found or single folder, root: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug], path: , Grouping folder: , subdirs: 0, reverse_path: ['']
2021-09-19 20:58:59,644 (4494) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics%2CbrandingSettings&id=UCAuUUnT6oDeKwE6v1NGQxug&key=' from the HTTP cache
2021-09-19 20:58:59,677 (4494) :  INFO (logkit:16) - [ ] title:        "TED ", metadata.title: "TED "
2021-09-19 20:58:59,677 (4494) :  INFO (logkit:16) - [ ] art:       https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 20:58:59,677 (4494) :  INFO (logkit:16) - [ ] banners:   https://yt3.ggpht.com/x6Fjmm5ayvnSmkr8bjrF2Fu6ggvnsqICQYRHouJ-PJ808-KysIquuPjqkvoJGn_UeNk1WHAVocA=s1920
2021-09-19 20:58:59,677 (4494) :  INFO (logkit:16) - [ ] posters:   https://yt3.ggpht.com/ytc/AKedOLRTHraf4M_OaDZFwfqK8F9TTjxe3DHwFZMkZGqmAw=s240-c-k-c0x00ffffff-no-rj
2021-09-19 20:58:59,677 (4494) :  INFO (logkit:16) - [ ] role:        TED
2021-09-19 20:58:59,677 (4494) :  INFO (logkit:16) - =============================================================================================================================================================
2021-09-19 20:58:59,677 (4494) :  INFO (logkit:16) - Season: 2007
2021-09-19 20:58:59,678 (4494) :  INFO (logkit:16) - metadata.seasons[2007].episodes[None] "20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv"
2021-09-19 20:58:59,678 (4494) :  INFO (logkit:16) - populate_episode_metadata_from_info_json() - series_root_folder: U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\, filename: 20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 20:58:59,678 (4494) :  INFO (logkit:16) - Searching for "20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].info.json". Searching in "U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\".
2021-09-19 20:58:59,734 (4494) :  INFO (logkit:16) - Directory \\?\U:\YouTube\video\TED\TED [UCAuUUnT6oDeKwE6v1NGQxug]\ contains 200 files
2021-09-19 20:58:59,734 (4494) :  INFO (logkit:16) - populate_episode_metadata_from_api() - filename: 20070106 Do schools kill creativity _ Sir Ken Robinson [iG9CE55wbtY].mkv
2021-09-19 20:58:59,736 (4494) :  INFO (logkit:16) - # videoId [iG9CE55wbtY] not in Playlist/channel item list so loading json_video_details
2021-09-19 20:58:59,769 (4494) :  DEBUG (networking:138) - Fetching 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&id=iG9CE55wbtY&key=' from the HTTP cache
2021-09-19 20:58:59,809 (4494) :  INFO (logkit:16) - [?] link:     "https://www.youtube.com/watch?v=iG9CE55wbtY"
2021-09-19 20:58:59,809 (4494) :  INFO (logkit:16) - [ ] title:    "Do schools kill creativity? | Sir Ken Robinson"
2021-09-19 20:58:59,809 (4494) :  INFO (logkit:16) - [ ] summary:  "Visit http://TED.com to get our entire library of TED Talks, transcripts, translations, personalized talk recommendations and more.. . Sir Ken Robinson makes an entertaining and profoundly moving case for creating an education system that nurtures (rather than undermines) creativity.. . The TED Talks channel features the best talks and performances from the TED Conference, where the world's leading thinkers and doers give the talk of their lives in 18 minutes (or less). Look for talks on Technology, Entertainment and Design -- plus science, business, global issues, the arts and more. You're welcome to link to or embed these videos, forward them to others and share these ideas with people you know. . . Follow TED on Twitter: http://twitter.com/TEDTalks. Like TED on Facebook: http://facebook.com/TED. Subscribe to our channel: http://youtube.com/TED. . TED's videos may be used for non-commercial purposes under a Creative Commons License, Attribution–Non Commercial–No Derivatives (or the CC BY – NC – ND 4.0 International) and in accordance with our TED Talks Usage Policy (https://www.ted.com/about/our-organization/our-policies-terms/ted-talks-usage-policy). For more information on using TED for commercial purposes (e.g. employee learning, in a film or online course), please submit a Media Request at https://media-requests.ted.com"
2021-09-19 20:58:59,809 (4494) :  INFO (logkit:16) - [ ] duration: "PT20M4S"->"1204000"
2021-09-19 20:58:59,809 (4494) :  INFO (logkit:16) - [ ] rating:   "9.84177785981"
2021-09-19 20:58:59,809 (4494) :  INFO (logkit:16) - [ ] genres:   "[u'Ken', u'educational', u'education', u'school', u'TED', u'innovation', u'TEDTalks', u'system', u'schooling', u'TED2006', u'curiosity', u'creativity', u'Talks', u'Education', u'Robinson']"
2021-09-19 20:58:59,811 (4494) :  INFO (logkit:16) - === End Of Agent Call, errors after that are Plex related ===================================================================================================
2021-09-19 20:58:59,845 (4494) :  DEBUG (model:229) - Serializing to C:\Users\Matth\AppData\Local\Plex Media Server\Metadata\TV Shows\b\1763cda0d02ee01d92e19f6d6ca2e0dc6cc11d7.bundle\Contents\com.plexapp.agents.youtube\Info.xml
2021-09-19 20:58:59,848 (4494) :  DEBUG (runtime:88) - Sending packed state data (107 bytes)
2021-09-19 20:58:59,848 (4494) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

@ZeroQI
Copy link
Owner

ZeroQI commented Sep 19, 2021

metadata.seasons[2007].episodes[None]
Big in scanner, date based eps get all assigned None EP, therefore only the last have metadata

@MatthK
Copy link

MatthK commented Sep 20, 2021

So that means there is no solution for this?

@ZeroQI
Copy link
Owner

ZeroQI commented Sep 20, 2021

Renaming files so the scanner allocate proper episode number

@MatthK
Copy link

MatthK commented Sep 22, 2021

How do I have to rename the files? Adding a S07EXX in front does not make a difference. I also tried [2007].[01], but also then it does not add the Metadata.
What is the syntax I need for the renaming?

@MatthK
Copy link

MatthK commented Sep 22, 2021

Ok, so I think I figured it out. I had to move the files out of the library, refresh it, rename the files and give them a different date, then put them back into the library. Only then it recognized it and added the Metadata.

@AtomicClown
Copy link

Has anyone found a hard fix as of yet? I keep running into this issue and tried following this thread, but nothing seems to work. Only seemingly random videos get matched despite having all my metadata saved as .jsons.

@MatthK You mentioned you found a workaround by renaming and re-dating the files, any chance you could share what methods worked for you?

@MatthK
Copy link

MatthK commented Oct 22, 2021

Well, as I mentioned above. By manually giving the files a different date (outside the library) and move them back, then the agent pulled the metadata.

@AtomicClown
Copy link

Do you happen to have any examples of a file you had and what you renamed it to to get it working? Do you keep the dates in the filenames?

@MatthK
Copy link

MatthK commented Oct 22, 2021

This is an example. TubeSync downloaded these three files all with the same date.

20070117 The best stats you've ever seen _ Hans Rosling [hVimVzgtD6w].mkv
20070117 The freakonomics of McDonalds vs. drugs _ Steven Levitt [5UGC2nLnaes].mkv
20070117 The paradox of choice _ Barry Schwartz [VO6XEQIsCoM].mkv

I moved the files out of the directory, renamed the files (change the dates for the 2nd and 3rd file) and moved them back to the library.

20070117 The best stats you've ever seen _ Hans Rosling [hVimVzgtD6w].mkv
20070118 The freakonomics of McDonalds vs. drugs _ Steven Levitt [5UGC2nLnaes].mkv
20070119 The paradox of choice _ Barry Schwartz [VO6XEQIsCoM].mkv

@MizeryMade
Copy link
Contributor

MizeryMade commented May 11, 2022

I got to thinking about this again recently. It's something that'll rear its head for me on occasion. We can certainly chalk this up as a limitation in the way that Plex works. However, it could still be worked around -- but that'd come from ASS as opposed to the Meta Agent. That left me a little unsure if I should start a fresh thread over at ASS about it, or come back over here since there was already some established conversation about it here.

I know that you tried working around it in the ASS code by trying to add the index at the end which didn't completely solve the issue. Unsure if that's due to that functionality being deprecated in Plex at some point or if its due to the approach in implementing it into ASS. I tracked down the Extended Media Scanner which I believe provided the inspiration and went poking round it. It looks to me that it might work on there because it's actually setting "built" episode numbers for the files in question -- which was a suggestion at one point here. Though I know you were a fan of the Date Based approach because it looks cleaner.

That said, I went to tinkering with ASS and running some test scans. I don't entirely know what I'm doing, but was able to butcher it enough to test the theory that said "built" episode numbers would work.

    ### YouTube Channel ###
    if source.startswith('youtube') and id.startswith('UC') or id.startswith('HC'):  # or not json_playlist and not json_full and source.startswith('youtube') and len(id)>2 and id[0:2] in ('PL', 'UU', 'FL', 'LP', 'RD')
      mapping = {} #mapping[season][ep]=filename  if dupe #mapping[season][ep]=index count, mapping[season][epxx] = filename,
      for file in files:  #to have latest ep first, add: ", reverse=True"
        filename = os.path.join(root, path, file)
        if extension(file) not in VIDEO_EXTS or os.path.isdir(filename):  continue  #only files with video extensions
        for rx in DATE_RX:
          match = rx.search(file)  # file starts with "yyyy-mm-dd" "yyyy.mm.dd" "yyyy mm dd" or "yyyymmdd"
          if match:
            filedate        = time.gmtime(os.path.getmtime(filename))
            season, episode = match.group('year'), '{:>02}{:>02}{:>02}{:>02}'.format(match.group('month'), match.group('day'), filedate[3], filedate[4])
            break
        else:
          filedate        = time.gmtime(os.path.getmtime(filename))
          season, episode = str(filedate[0]), '{:>02}{:>02}{:>02}{:>02}'.format(filedate[1], filedate[2], filedate[3], filedate[4])

Awful, I know. Just doing some testing. This gave a MMDDHHMM episode number -- unfortunately it doesn't look like Youtube freely hands over the release/upload time anymore which is why I cobbled it together using the Filedate if pulling MMDD from filename. Certainly possible that someone with fast internet could end up with two files finished in the same minute, but again, testing some things out at least. Assigning the HHMM to each file and not just "duplicates" results in more uniform numbers for sorting and also would prevent some Metadata and Watch History shenanigans from happening if you add/remove videos later and thus removing/changing an index.

However bad the means of getting there, the result was a successful scan and Meta search for a set of Test files I had from some time ago that was a dozen or so 2 a day releases. I then tried scanning in my main Youtube folder and all the files were successfully added into Plex and didn't appear to show any issues with Metadata but honestly didn't look over them in too much detail since there were so many.

The way I approached it pretty much bypassed the second part of your code where you try setting an Index. Being honest, I get completely lost just looking at that second half! Haha. HOWEVER -- my lack of understanding of that portion didn't allow me to try something else. I ran across this: https://www.reddit.com/r/PleX/comments/bfcmzl/identifying_datebased_episodes_when_two_have_the/

In that reddit post from a few years back, they run into a similar issue with the native scanner and a talkshow. They found that giving the "duplicate" episodes an explicit episode number go them to scan in with the other Date Based episodes. Given I was unable to hack away at the second part of the code, I am left unsure if something like this could be the automatic happy median to our "problem." I don't know how trying to mix Date Based and Explicitly set Episode Numbers would display and sort in Plex or if it would've worked back then but has since been deprecated by Plex. Perhaps something to tinker with by someone who understands coding far more than me, haha.

All that said... I know you at one point had some Youtube switches for differing functionality in ASS and then deprecated them as you wrapped it all up into one function that (should've) covered all of our bases -- but perhaps if explicitly setting each episode number is the only way of preventing the missing Metadata issue, then perhaps readding a switch that could then optionally be used by those that want and/or that could be used on those channels that do frequently have multiple videos a day?

@llmcgovern
Copy link

Also seeing this issue. FWIW, the MMDDHHMM episode hack didn't work for me, but I'm pulling metadata from the local json files.

@AtomicClown
Copy link

Is there any solid solution presently or in progress? Too many videos aren't being matched into my library due to them being hidden by one from the same date, and I've adored this plugin otherwise.

@ZeroQI
Copy link
Owner

ZeroQI commented Feb 6, 2023

If videos are released at the same time there are issues using date based numbering, the scanner leaves it to the agent strings to renumber episodes and that failed if released at the same time. My fix seemingly didn't work and this is uncharted territory... If somebody want to work on it I will assist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants