ankenyr / jellyfin-youtube-metadata-plugin

Youtube Metadata Plugin for Jellyfin
GNU Affero General Public License v3.0
510 stars 33 forks source link

YouTube episode ordering not correctly labeled #57

Closed alexpattyn closed 4 months ago

alexpattyn commented 2 years ago

Jellyfin:10.8.1 YoutubeMetaData: 1.0.3.7

I was downloading playlist using TheFrenchGhosty's archivist (no comments) script and I was having issues getting the videos in the correct order. For example downloading this playlist and then moving it into a jellyfin shows library using the following directory structure:

Youtube
    └── Angory Tom
                 ├── Warhammer Total War - Warlord Tom vs King Ben - (Angory Tom)\
                          ├── 20170209 - Total War - Warhammer - First Blood! - Part #2\
                                  ├── 20170209 - Total War - Warhammer - First Blood! - Part #2 [VtiI1QL0K0A]description
                                  ├── 20170209 - Total War - Warhammer - First Blood! - Part #2 [VtiI1QL0K0A].info.json
                                  ├── 20170209 - Total War - Warhammer - First Blood! - Part #2 [VtiI1QL0K0A].mkv
                                  ├── 20170209 - Total War - Warhammer - First Blood! - Part #2 [VtiI1QL0K0A].webp
                          ├── 20170212 - Total War - Warhammer - How to be a Warlord - Part #3
                                  ├── ...
                          ├── ...

Gives the following in jellyfin:

image

Where every episode is listed as "1" instead of the order they appear in the playlist.

ankenyr commented 2 years ago

Can you try running the scheduled event "YouTubeMetadata" found in the scheduled events section of the admin panel manually? That should renumber them.

On Sat, Jul 2, 2022, 2:47 PM Alex @.***> wrote:

Jellyfin:10.8.1 YoutubeMetaData: 1.0.3.7

I was downloading playlist using TheFrenchGhosty's archivist (no comments) script and I was having issues getting the videos in the correct order. For example downloading this playlist https://www.youtube.com/playlist?list=PLkG-zhy1pVunIm7wdYvIXDPuYjA_iltO8 and then moving it into a jellyfin shows library using the following directory structure:

Youtube

└── Angory Tom

             ├── Warhammer Total War - Warlord Tom vs King Ben - (Angory Tom)\

                      ├── 20170209 - Total War - Warhammer - First Blood! - Part #2\

                              ├── 20170209 - Total War - Warhammer - First Blood! - Part #2 [VtiI1QL0K0A]description

                              ├── 20170209 - Total War - Warhammer - First Blood! - Part #2 [VtiI1QL0K0A].info.json

                              ├── 20170209 - Total War - Warhammer - First Blood! - Part #2 [VtiI1QL0K0A].mkv

                              ├── 20170209 - Total War - Warhammer - First Blood! - Part #2 [VtiI1QL0K0A].webp

                      ├── 20170212 - Total War - Warhammer - How to be a Warlord - Part #3

                              ├── ...

                      ├── ...

Gives the following in jellyfin:

[image: image] https://user-images.githubusercontent.com/28536677/177016962-acb2500f-295f-455c-aff7-fcae2e188fba.png

Where every episode is listed as "1" instead of the order they appear in the playlist.

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/57, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLS4DLXHUWS5PWXBJZ3VSC2GVANCNFSM52PU66TA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

alexpattyn commented 2 years ago

Same issue :/ I do want to note that I don't have yt-dlp on my server. I am just relying on the local metadata.

alexpattyn commented 2 years ago

Another thing I want to note, they appear in the correct order. Just the episode number is off.

ankenyr commented 2 years ago

Can you turn on debug logging and see if the logs tell us anything?

On Sun, Jul 3, 2022, 5:35 AM Alex @.***> wrote:

Another thing I want to note, they appear in the correct order. Just the episode number is off.

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/57#issuecomment-1173075302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLRW3XRM3RFNCE4BOC3VSGCJZANCNFSM52PU66TA . You are receiving this because you commented.Message ID: @.***>

alexpattyn commented 2 years ago
[2022-07-03 12:17:01.896 -04:00] [INF] [50] Emby.Server.Implementations.IO.LibraryMonitor: "Angory Tom" ("/media/youtube/Angory Tom") will be refreshed.
[2022-07-03 12:17:04.200 -04:00] [ERR] [55] MediaBrowser.Providers.TV.SeriesMetadataService: Error in "YoutubeMetadata"
System.IO.FileNotFoundException: youtube-dl not found on path!
   at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDL ydl)
   at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, String url, CancellationToken cancellationToken)
   at NYoutubeDL.YoutubeDL.DownloadAsync(String videoUrl)
   at Jellyfin.Plugin.YoutubeMetadata.Utils.SearchChannel(String query, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLSeriesProvider.GetAndCacheMetadata(String name, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLSeriesProvider.GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken)
[2022-07-03 12:17:04.208 -04:00] [ERR] [55] MediaBrowser.Providers.Manager.ProviderManager: "YTDLSeriesImageProvider" failed in GetImageInfos for type "Series" at "/media/youtube/Angory Tom"
System.IO.FileNotFoundException: youtube-dl not found on path!
   at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDL ydl)
   at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, String url, CancellationToken cancellationToken)
   at NYoutubeDL.YoutubeDL.DownloadAsync(String videoUrl)
   at Jellyfin.Plugin.YoutubeMetadata.Utils.YTDLMetadata(String id, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YoutubeDL.YTDLSeriesImageProvider.GetImages(BaseItem item, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.GetImages(BaseItem item, IRemoteImageProvider provider, String preferredLanguage, Boolean includeAllLanguages, CancellationToken cancellationToken, Nullable`1 type)
[2022-07-03 12:17:06.753 -04:00] [WRN] [94] Jellyfin.Server.Middleware.ResponseTimeMiddleware: Slow HTTP Response from "http://192.168.10.18:8096/Items/e3b37c7ee3c9a3f40db3e80c9e174ae6/Images/Backdrop?fillHeight=267&fillWidth=474&quality=96&tag=ad0e1a68fb91acb8b4f9e6a29b5a00ce" to "192.168.10.19" in 0:00:46.612073 with Status Code 200
[2022-07-03 12:17:12.279 -04:00] [ERR] [62] MediaBrowser.Providers.TV.SeriesMetadataService: Error in "YoutubeMetadata"
System.IO.FileNotFoundException: youtube-dl not found on path!
   at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDL ydl)
   at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, String url, CancellationToken cancellationToken)
   at NYoutubeDL.YoutubeDL.DownloadAsync(String videoUrl)
   at Jellyfin.Plugin.YoutubeMetadata.Utils.SearchChannel(String query, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLSeriesProvider.GetAndCacheMetadata(String name, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLSeriesProvider.GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken)
[2022-07-03 12:17:12.287 -04:00] [ERR] [62] MediaBrowser.Providers.Manager.ProviderManager: "YTDLSeriesImageProvider" failed in GetImageInfos for type "Series" at "/media/youtube/Angory Tom"
System.IO.FileNotFoundException: youtube-dl not found on path!
   at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDL ydl)
   at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, String url, CancellationToken cancellationToken)
   at NYoutubeDL.YoutubeDL.DownloadAsync(String videoUrl)
   at Jellyfin.Plugin.YoutubeMetadata.Utils.YTDLMetadata(String id, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YoutubeDL.YTDLSeriesImageProvider.GetImages(BaseItem item, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.GetImages(BaseItem item, IRemoteImageProvider provider, String preferredLanguage, Boolean includeAllLanguages, CancellationToken cancellationToken, Nullable`1 type)
[2022-07-03 12:17:57.957 -04:00] [ERR] [50] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: ffmpeg image extraction failed for "file:\"/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1 [eAdKHEs-KXY].mkv\""
[2022-07-03 12:17:57.957 -04:00] [ERR] [50] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: I-frame image extraction failed, will attempt standard way. Input: "file:\"/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1 [eAdKHEs-KXY].mkv\""
MediaBrowser.Common.FfmpegException: ffmpeg image extraction failed for file:"/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1 [eAdKHEs-KXY].mkv"
   at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.ExtractImageInternal(String inputPath, String container, MediaStream videoStream, Nullable`1 imageStreamIndex, Nullable`1 threedFormat, Nullable`1 offset, Boolean useIFrame, Nullable`1 targetFormat, CancellationToken cancellationToken)
   at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.ExtractImage(String inputFile, String container, MediaStream videoStream, Nullable`1 imageStreamIndex, MediaSourceInfo mediaSource, Boolean isAudio, Nullable`1 threedFormat, Nullable`1 offset, Nullable`1 targetFormat, CancellationToken cancellationToken)
[2022-07-03 12:18:09.064 -04:00] [INF] [32] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Killing ffmpeg process
[2022-07-03 12:18:09.064 -04:00] [ERR] [32] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: ffmpeg image extraction failed for "file:\"/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1 [eAdKHEs-KXY].mkv\""
[2022-07-03 12:18:09.065 -04:00] [ERR] [32] Emby.Server.Implementations.MediaEncoder.EncodingManager: Error extracting chapter images for "/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1 [eAdKHEs-KXY].mkv"
MediaBrowser.Common.FfmpegException: ffmpeg image extraction failed for file:"/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1 [eAdKHEs-KXY].mkv"
   at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.ExtractImageInternal(String inputPath, String container, MediaStream videoStream, Nullable`1 imageStreamIndex, Nullable`1 threedFormat, Nullable`1 offset, Boolean useIFrame, Nullable`1 targetFormat, CancellationToken cancellationToken)
   at MediaBrowser.MediaEncoding.Encoder.MediaEncoder.ExtractImage(String inputFile, String container, MediaStream videoStream, Nullable`1 imageStreamIndex, MediaSourceInfo mediaSource, Boolean isAudio, Nullable`1 threedFormat, Nullable`1 offset, Nullable`1 targetFormat, CancellationToken cancellationToken)
   at Emby.Server.Implementations.MediaEncoder.EncodingManager.RefreshChapterImages(Video video, IDirectoryService directoryService, IReadOnlyList`1 chapters, Boolean extractImages, Boolean saveChapters, CancellationToken cancellationToken)
[2022-07-03 12:18:10.077 -04:00] [ERR] [32] MediaBrowser.Providers.Manager.ProviderManager: "YTDLImageProvider" failed in GetImageInfos for type "Episode" at "/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1 [eAdKHEs-KXY].mkv"
System.IO.FileNotFoundException: youtube-dl not found on path!
   at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDL ydl)
   at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, String url, CancellationToken cancellationToken)
   at NYoutubeDL.YoutubeDL.DownloadAsync(String videoUrl)
   at Jellyfin.Plugin.YoutubeMetadata.Utils.YTDLMetadata(String id, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YoutubeDL.YTDLImageProvider.GetImages(BaseItem item, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.GetImages(BaseItem item, IRemoteImageProvider provider, String preferredLanguage, Boolean includeAllLanguages, CancellationToken cancellationToken, Nullable`1 type)
[2022-07-03 12:18:13.993 -04:00] [WRN] [55] Jellyfin.Server.Middleware.ResponseTimeMiddleware: Slow HTTP Response from "http://192.168.10.18:8096/Items/3cb58d5f3ac9a39207de44a29e798a12/Images/Primary?fillHeight=446&fillWidth=297&quality=96&tag=ab6f236eaa286d9c77993811f857eec3" to "192.168.10.19" in 0:01:44.9245991 with Status Code 200
[2022-07-03 12:18:14.201 -04:00] [ERR] [32] MediaBrowser.Providers.TV.SeriesMetadataService: Error in "YoutubeMetadata"
System.IO.FileNotFoundException: youtube-dl not found on path!
   at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDL ydl)
   at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, String url, CancellationToken cancellationToken)
   at NYoutubeDL.YoutubeDL.DownloadAsync(String videoUrl)
   at Jellyfin.Plugin.YoutubeMetadata.Utils.SearchChannel(String query, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLSeriesProvider.GetAndCacheMetadata(String name, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLSeriesProvider.GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken)
[2022-07-03 12:18:14.219 -04:00] [ERR] [32] MediaBrowser.Providers.Manager.ProviderManager: "YTDLSeriesImageProvider" failed in GetImageInfos for type "Series" at "/media/youtube/Angory Tom"
System.IO.FileNotFoundException: youtube-dl not found on path!
   at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDL ydl)
   at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, String url, CancellationToken cancellationToken)
   at NYoutubeDL.YoutubeDL.DownloadAsync(String videoUrl)
   at Jellyfin.Plugin.YoutubeMetadata.Utils.YTDLMetadata(String id, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YoutubeDL.YTDLSeriesImageProvider.GetImages(BaseItem item, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.GetImages(BaseItem item, IRemoteImageProvider provider, String preferredLanguage, Boolean includeAllLanguages, CancellationToken cancellationToken, Nullable`1 type)
[2022-07-03 12:21:12.321 -04:00] [INF] [94] Emby.Server.Implementations.IO.LibraryMonitor: "TOMB KINGS - BOOK WARS Versus Campaign - Part 1" ("/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1 [eAdKHEs-KXY].mkv") will be refreshed.
[2022-07-03 12:21:12.322 -04:00] [INF] [94] Emby.Server.Implementations.IO.LibraryMonitor: "20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1" ("/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)/20180203 - TOMB KINGS - BOOK WARS Versus Campaign - Part 1") will be refreshed.
[2022-07-03 12:21:12.322 -04:00] [INF] [94] Emby.Server.Implementations.IO.LibraryMonitor: "Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)" ("/media/youtube/Angory Tom/Book Wars - Versus Campaign - Warhammer Total War 2 - (Angory Tom)") will be refreshed.
[2022-07-03 12:21:14.525 -04:00] [INF] [94] Emby.Server.Implementations.ScheduledTasks.TaskManager: Executing "YoutubeMetadata"
[2022-07-03 12:21:14.579 -04:00] [INF] [94] Emby.Server.Implementations.ScheduledTasks.TaskManager: "YoutubeMetadata" Completed after 0 minute(s) and 0 seconds
[2022-07-03 12:21:14.711 -04:00] [INF] [94] Emby.Server.Implementations.ScheduledTasks.TaskManager: ExecuteQueuedTasks
wjbridge commented 2 years ago

I am having a similar problem with the episodes not ordering correctly. I think it is because it is sorting them based on alphabetical order. https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/blob/d98d101be7aa1e6087d4b6c1fc05c2d36cbf808f/Jellyfin.Plugin.YoutubeMetadata/EpisodeIndexer.cs#L87

Is there a way to order them by date %(upload_date)s or do they need to be in a folder in themselves? I would prefer not because I do use the media deletion plugin to delete older videos I do not want to keep after I have watched them. "%(uploader)s/%(uploader)s - %(upload_date)s - %(title)s/%(uploader)s - %(upload_date)s - %(title)s [%(id)s].%(ext)s"

Log Output

[20:44:04] [DBG] [96] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show Gamer Meld
[20:44:04] [DBG] [96] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 1 as index 1
[20:44:04] [DBG] [96] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode AMD CONFIRMS Insane Specs For RX 7000 GPUs! should now be index 1
[20:44:04] [DBG] [96] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode AMD Has A HUGE Surprise For Nvidia! should now be index 2
[20:44:04] [DBG] [96] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Do NOT Buy Nvidia’s New GPU! should now be index 3
[20:44:04] [DBG] [96] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Nvidia And AMD Just Did The UNTHINKABLE! should now be index 4
[20:44:04] [DBG] [96] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Nvidia And AMD Won’t Like THIS! should now be index 5
[20:44:04] [DBG] [96] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Nvidia’s NEW GPU Is Even WORSE Than We Thought! should now be index 6

File Structure image

alexpattyn commented 2 years ago

@wjbridge I'll correct the title. Because my episodes are in the correct order they are just not labeled properly (e.g. every episode is labeled as 1). Although this may be related if the episode number is in the info.json file and youtubemetadata is not using it.

alexpattyn commented 2 years ago

I uploaded another playlist and it's having the weird issue of some episodes being labeled and others all being 1. Will give more info and images later today.

wjbridge commented 2 years ago

@alexpattyn Thanks for the response. I have seen that problem with all being labeled as 1. I am going to try to do more testing today.

ankenyr commented 2 years ago

So I am getting this on my server also, weird. I swear it was working. @wjbridge you need to look a bit further down. The one you link to is for the seasons https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/blob/d98d101be7aa1e6087d4b6c1fc05c2d36cbf808f/Jellyfin.Plugin.YoutubeMetadata/EpisodeIndexer.cs#L106

I am using Name for sorting which iirc is the file name. This was with the assumption that the naming in the file system using the method I use to name will always have them in their natural order due to the date being at the beginning.

I will need to see why there was a regression here. Testing should be added here. Honestly if anyone knows a good way to do an integration test for this plugin I would love to hear.

alexpattyn commented 2 years ago

@ankenyr glad this is reproducible on your system at least. But I agree that just sorting it using the Name should be good enough if using the defaults from TheFrenchGhostys scripts.

I have another playlist uploaded and I get the following: image

Where multiple are listed as episode 1, and others just have the default file name. More interestingly when I go into Findroid that same playlist looks like this:

Screenshot_20220705-181112

So for some reason Findroid sees some of the episodes numbered correctly (while the others are still 1).

alexpattyn commented 2 years ago

We may be able to use playlist_index from info.json to number the episodes.

ankenyr commented 2 years ago

I would need to know more about that piece inside the info.json before I could use it. The edge case I have is what happens when some old video that may have not bee archived appears. A lot of my content gets strikes even though they are fair use.

alexpattyn commented 2 years ago

Gotcha, its best to keep the current implementation.

ankenyr commented 2 years ago

Like this one CGP_Grey - 20140212 - The_Law_You_Won_t_Be_Told [uqH_Y1TupoQ].info.json

The playlist_index shows 122 but I would expect it to be around 40. Is that possibly counting down where the latest video is 0?

alexpattyn commented 2 years ago

Looking at the info.json files I have it seems to be counting up (first video = 1 last = end). But if it isn't robust then it may just cause more problems than it is worth.

wjbridge commented 2 years ago

So I am getting this on my server also, weird. I swear it was working. @wjbridge you need to look a bit further down. The one you link to is for the seasons

https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/blob/d98d101be7aa1e6087d4b6c1fc05c2d36cbf808f/Jellyfin.Plugin.YoutubeMetadata/EpisodeIndexer.cs#L106

I am using Name for sorting which iirc is the file name. This was with the assumption that the naming in the file system using the method I use to name will always have them in their natural order due to the date being at the beginning.

I will need to see why there was a regression here. Testing should be added here. Honestly if anyone knows a good way to do an integration test for this plugin I would love to hear.

You are absolutely right. My C# is rusty lol

I tried to use the video_autonumber from yt-dlp but I am not getting sequential numbers from each playlist. The behavior I am seeing from the following file names:

image

[17:40:42] [DBG] [38] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show NetworkChuck
[17:40:42] [DBG] [38] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 01 as index 1
[17:40:42] [DBG] [38] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode ditch Google!! (build your own PRIVATE search engine) should now be index 1
[17:40:42] [DBG] [38] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode i KILLED my Linux computer!! (to teach you something) should now be index 2
[17:40:42] [DBG] [38] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode let’s play with a ZERO-DAY vulnerability “follina” should now be index 3
[17:40:42] [DBG] [38] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode the $0.30 Hacking Lab should now be index 4
[17:40:42] [DBG] [38] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode you need to HACK faster!! (Linux Terminal hacks YOU NEED!!) should now be index 5

It is stripping out the entire first part NetworkChuck - S01EXX - and sorting it based on alphabetical name. Does the x.Name ,y.Name, and episode.Name represent the title of the video or the filename of the video? Based on what I am seeing, it looks to be the title of the video not filename. I have tried different combinations of filenames but it is consistently ordered the same.

Maybe it should be episode.FileNameWithoutExtension?https://github.com/jellyfin/jellyfin/blob/79f39f7336646758f1797f6fa8c1f7e16c59dfdf/MediaBrowser.Controller/Entities/BaseItem.cs#L366

ankenyr commented 2 years ago

For those of you having this issue. Can you look in the series (channel) metadata for the presence or absence of the channel id? image

For a channel of mine that was having this issue, that was missing and it is what I key off of to determine if a show is controlled by my plugin.

alexpattyn commented 2 years ago

@ankenyr I also had some issues with the title not carrying over (it just stays as the filename). But it also appears to be an issue with a missing ID:

image

alexpattyn commented 2 years ago

This appears to be an issue for all my videos more or less.

ankenyr commented 2 years ago

Can you try and do a full scan replacing all metadata and supply the logs from that?

alexpattyn commented 2 years ago

jelly-logs.txt

ankenyr commented 2 years ago

Looks like yt-dlp is not installed. In this case it isn't going to get anything for you.

[2022-07-09 16:32:41.991 -04:00] [ERR] [29] MediaBrowser.Providers.TV.SeriesMetadataService: Error in "YoutubeMetadata"
System.IO.FileNotFoundException: youtube-dl not found on path!
   at NYoutubeDL.Services.PreparationService.SetupPrepare(YoutubeDL ydl)
   at NYoutubeDL.Services.InfoService.GetDownloadInfoAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.PreparationService.PrepareDownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, CancellationToken cancellationToken)
   at NYoutubeDL.Services.DownloadService.DownloadAsync(YoutubeDL ydl, String url, CancellationToken cancellationToken)
   at NYoutubeDL.YoutubeDL.DownloadAsync(String videoUrl)
   at Jellyfin.Plugin.YoutubeMetadata.Utils.SearchChannel(String query, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLSeriesProvider.GetAndCacheMetadata(String name, IServerApplicationPaths appPaths, CancellationToken cancellationToken)
   at Jellyfin.Plugin.YoutubeMetadata.Providers.YTDLSeriesProvider.GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken)
wjbridge commented 2 years ago

I am hoping I am providing the right information @ankenyr. Let me know if not. This is log output of a show being sorted by version 1.0.3.8.

Problem

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show Linus Tech Tips
[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 2022 as index 1
[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode I Await Sony’s Cease and Desist should now be index 1
[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode I saved the best for last should now be index 2
[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Take down this video, Nintendo. I dare you. should now be index 3
[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode The Mac Studio Rival that has it all? #SHORTS #macstudio should now be index 4
[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode This Budget Gaming PC Is AWESOME should now be index 5
[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode This can't be legal... #SHORTS #steamdeck #nintendoswitch should now be index 6
[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode You’re cooling your PC wrong. should now be index 7

Actual Date of Episodes (don't match) image

External Ids of series is populated image

Investigation / Experiment I did experiment and replaced the following lines, compiled the plugin, and ran the indexer again.

episodes.Sort(delegate (BaseItem x, BaseItem y)
{
    if (x.FileNameWithoutExtension == null && y.FileNameWithoutExtension == null) return 0;
    else if (x.FileNameWithoutExtension == null) return -1;
    else if (y.FileNameWithoutExtension == null) return 1;
    else return x.FileNameWithoutExtension.CompareTo(y.FileNameWithoutExtension);
});

The date ordering is now correct (matches the file names).

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show Linus Tech Tips
[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 2022 as index 1
[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220704 - I_Await_Sony_s_Cease_and_Desist [0Hr8aqGp5mk] should now be index 1
[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220705 - This_Budget_Gaming_PC_Is_AWESOME [fuiAJFf0EJI] should now be index 2
[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220706 - I_saved_the_best_for_last [pyVZ05SO0Ic] should now be index 3
[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220707 - Take_down_this_video_Nintendo._I_dare_you. [oIYvPNtWZ34] should now be index 4
[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220707 - This_can_t_be_legal..._SHORTS_steamdeck_nintendoswitch [y5IqC6G974A] should now be index 5
[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220709 - The_Mac_Studio_Rival_that_has_it_all_SHORTS_macstudio [S1FHTrA89Ns] should now be index 6
[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220709 - You_re_cooling_your_PC_wrong. [T1ZnAwUg9CU] should now be index 7

I did notice the "sort title" in the metadata for each episode but I don't think it is being used in the plugin?? and don't even know how it gets populated / parsed. image

I have noticed on a couple of shows it is not loading the main picture of the series image

but the id is populated for the series image

ankenyr commented 2 years ago

Are there any other metadata agents enabled? Can you show me what your library config looks like?

On Sat, Jul 9, 2022, 6:05 PM wjbridge @.***> wrote:

I am hoping I am providing the right information @ankenyr https://github.com/ankenyr. Let me know if not. This is log output of a show being sorted by version 1.0.3.8.

Problem

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show Linus Tech Tips

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 2022 as index 1

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode I Await Sony’s Cease and Desist should now be index 1

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode I saved the best for last should now be index 2

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Take down this video, Nintendo. I dare you. should now be index 3

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode The Mac Studio Rival that has it all? #SHORTS #macstudio should now be index 4

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode This Budget Gaming PC Is AWESOME should now be index 5

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode This can't be legal... #SHORTS #steamdeck #nintendoswitch should now be index 6

[20:49:34] [DBG] [22] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode You’re cooling your PC wrong. should now be index 7

Actual Date of Episodes (don't match) [image: image] https://user-images.githubusercontent.com/5856635/178127242-800b4d7d-3ec4-4fb8-a344-2f933a209b9f.png

External Ids of series is populated [image: image] https://user-images.githubusercontent.com/5856635/178127260-699b7f54-3c27-4350-9a6a-43ee0bb51048.png

Investigation / Experiment I did experiment and replaced the following lines, compiled the plugin, and ran the indexer again.

episodes.Sort(delegate (BaseItem x, BaseItem y)

{

if (x.FileNameWithoutExtension == null && y.FileNameWithoutExtension == null) return 0;

else if (x.FileNameWithoutExtension == null) return -1;

else if (y.FileNameWithoutExtension == null) return 1;

else return x.FileNameWithoutExtension.CompareTo(y.FileNameWithoutExtension);

});

The date ordering is now correct (matches the file names).

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show Linus Tech Tips

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 2022 as index 1

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220704 - I_Await_Sony_s_Cease_and_Desist [0Hr8aqGp5mk] should now be index 1

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220705 - This_Budget_Gaming_PC_Is_AWESOME [fuiAJFf0EJI] should now be index 2

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220706 - I_saved_the_best_for_last [pyVZ05SO0Ic] should now be index 3

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220707 - Take_down_this_video_Nintendo._I_dare_you. [oIYvPNtWZ34] should now be index 4

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220707 - This_can_t_be_legal..._SHORTS_steamdeck_nintendoswitch [y5IqC6G974A] should now be index 5

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220709 - The_Mac_Studio_Rival_that_has_it_all_SHORTS_macstudio [S1FHTrA89Ns] should now be index 6

[20:57:15] [DBG] [8] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Epsiode Linus_Tech_Tips - 20220709 - You_re_cooling_your_PC_wrong. [T1ZnAwUg9CU] should now be index 7

I did notice the "sort title" in the metadata for each episode but I don't think it is being used in the plugin?? and don't even know how it gets populated / parsed. [image: image] https://user-images.githubusercontent.com/5856635/178127432-8492ad82-6406-4f3b-b481-791e5a833ed3.png

I have noticed on a couple of shows it is not loading the main picture of the series [image: image] https://user-images.githubusercontent.com/5856635/178127365-acd73127-01e1-4ee6-b158-0657794f5815.png

but the id is populated for the series [image: image] https://user-images.githubusercontent.com/5856635/178127379-c5521128-8765-4683-a1b2-ac9558f2e0e0.png

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/57#issuecomment-1179631798, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLT2GCHNHKSWCNCHXMTVTIOT3ANCNFSM52PU66TA . You are receiving this because you were mentioned.Message ID: @.***>

wjbridge commented 2 years ago

Nope, see below. If there is a better way to share the library config. Let me know :)

image

image

image

image

image

ankenyr commented 2 years ago

https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/blob/master/Jellyfin.Plugin.YoutubeMetadata/Utils.cs#L245 is where I set the sort name.

The code snippet you have is possibly correct but only for file names in the same structure as you an I. There is a pending issue desiring for Tube Archivist compatibility. Their naming is a lot different. Sorting is essentially based on the premiere date. So the snippet should look more like

episodes.Sort(delegate (BaseItem x, BaseItem y)
{
    if (x.PremiereDate == null && y.PremiereDate == null) return 0;
    else if (x.PremiereDate == null) return -1;
    else if (y.PremiereDate == null) return 1;
    else return x.PremiereDate .CompareTo(y.PremiereDate );
});
wjbridge commented 2 years ago

Thanks for referencing that code! So basically what I proposed would solve the problem for you and me but not for Tube Archivist compatibility. I am assuming that there will be some configuration options for both scenarios at some point?

I am assuming that the ForcedSortName is used when filtering the videos based on date? I tried to change the code as you mentioned but got the following error. I am not knowledgeable enough in C#. Is there anything you would like me to test?

Jellyfin.Plugin.YoutubeMetadata\EpisodeIndexer.cs(106,52): error CS7036: There is no argument given that corresponds to the required formal paramete
r 'comparisonType' of 'MemoryExtensions.CompareTo(ReadOnlySpan<char>, ReadOnlySpan<char>, StringComparison)'

One other use case also is that I don't keep all the youtube shows I get. I use this docker image for obtaining the youtube videos. One problem is that when youtube videos get deleted (i.e. watched and 7 days later) the indexer will index the new videos again. Since I have "watched" S01E0X it will not mark it as unwatch because that episode number was already used. I am trying to think of solutions to this problem.

EDIT: I think I solved the error but I am not a C# master :)

episodes.Sort(delegate (BaseItem x, BaseItem y)
{
    if (!x.PremiereDate.HasValue && !y.PremiereDate.HasValue) return 0;
    else if (!x.PremiereDate.HasValue) return -1;
    else if (!y.PremiereDate.HasValue) return 1;
    else return DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value);
});
ankenyr commented 2 years ago

The solution would work if switched to comparing premiere date for both. The code snippet was just an example. Comparisons of dates work different from comparing strings as you see from the error. Off hand I didn't know the exact syntax so I just switched the variables to give an idea. Sorry that was not clear.

Deletion of media is not something I will be considering as a feature. It breaks a lot of conventions in my perspective. A possible solution would be to make the files empty but named the same. That frees up storage if that is your concern. If you want to discuss this further please open a different issue as to not pollute this one.

On Sun, Jul 10, 2022, 11:03 AM wjbridge @.***> wrote:

So basically what I proposed would solve the problem for you and me but not for Tube Archivist compatibility. I am assuming that there will be some configuration options for both scenarios at some point?

I am assuming that the ForcedSortName is used when filtering the videos based on date? I tried to change the code as you mentioned but got the following error. I am not knowledgeable enough in C#. Is there anything you would like me to test?

Jellyfin.Plugin.YoutubeMetadata\EpisodeIndexer.cs(106,52): error CS7036: There is no argument given that corresponds to the required formal paramete r 'comparisonType' of 'MemoryExtensions.CompareTo(ReadOnlySpan, ReadOnlySpan, StringComparison)'

One other use case also is that I don't keep all the youtube shows I get. I use this docker image https://github.com/Jeeaaasus/youtube-dl for obtaining the youtube videos. One problem is that when youtube videos get deleted (i.e. watched and 7 days later) the indexer will index the new videos again. Since I have "watched" S01E06 it will not mark it as unwatch because that episode number was already used. I am trying to think of solutions to this problem.

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/57#issuecomment-1179772805, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLSM47EQGXIXWW7OGX3VTMF57ANCNFSM52PU66TA . You are receiving this because you were mentioned.Message ID: @.***>

wjbridge commented 2 years ago

I think I solved the error but I am not a C# pro :). Sorry about mixing issues. You are absolutely right got carried away there. If I may ask, what is the plan going forward to fix the order of episodes? As demonstrated, it does not order them based on date or filename until I change the code. I know this solution won't work for Tube Archivist at this time but wondered if you had a plan or anything I could help / assist you.

episodes.Sort(delegate (BaseItem x, BaseItem y)
{
    if (!x.PremiereDate.HasValue && !y.PremiereDate.HasValue) return 0;
    else if (!x.PremiereDate.HasValue) return -1;
    else if (!y.PremiereDate.HasValue) return 1;
    else return DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value);
});
ankenyr commented 2 years ago

The solution is to sort based on premiere date I believe. That is set based on the date the video was.made available on YouTube either via the info.json file local, what yt-dlp downloads, or what tube archivist had in it's database. The code snippet will need to be fixed to compare dates rather than strings. I should be able to fix this tonight provided I get the time.

On Sun, Jul 10, 2022, 11:25 AM wjbridge @.***> wrote:

I think I solved the error but I am not a C# pro :). Sorry about mixing issues. You are absolutely right got carried away there. If I may ask, what is the plan going forward to fix the order of episodes? As demonstrated, it does not order them based on date or filename until I change the code. I know this solution won't work for Tube Archivist at this time but wondered if you had a plan or anything I could help / assist you.

episodes.Sort(delegate (BaseItem x, BaseItem y) { if (!x.PremiereDate.HasValue && !y.PremiereDate.HasValue) return 0; else if (!x.PremiereDate.HasValue) return -1; else if (!y.PremiereDate.HasValue) return 1; else return DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value); });

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/57#issuecomment-1179776339, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLQNOKCNZCWSTS552G3VTMIQXANCNFSM52PU66TA . You are receiving this because you were mentioned.Message ID: @.***>

wjbridge commented 2 years ago

I actually got it fixed based on the PremiereDate. I put a little more logging to make it easier. Feel free to change the warning to debug though. I want to see in the logs if a show does not have a PremiereDate populated as it should. I can attempt to do a fork and push request (been awhile though lol) if you like. Again @ankenyr, thank you so much for this plugin. I have been so frustrated with Plex these days and I needed my Youtube stuff working in Jellyfin.

episodes.Sort(delegate (BaseItem x, BaseItem y)
{
    if (!x.PremiereDate.HasValue && !y.PremiereDate.HasValue) {
        _logger.LogWarning("Episode [{Name}] does not have 'PremiereDate'", x.FileNameWithoutExtension);
        _logger.LogWarning("Episode [{Name}] does not have 'PremiereDate'", y.FileNameWithoutExtension);
        return 0;
    } else if (!x.PremiereDate.HasValue) {
        _logger.LogWarning("Episode [{Name}] does not have 'PremiereDate'", x.FileNameWithoutExtension);
        return -1;
    } else if (!y.PremiereDate.HasValue) {
        _logger.LogWarning("Episode [{Name}] does not have 'PremiereDate'", y.FileNameWithoutExtension);
        return 1;
    } else {
        return DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value);
    }
});
var eindex = 1;
foreach (var episode in episodes)
{
    if (episode.PremiereDate.HasValue) {
        _logger.LogDebug("Episode [{Name} - {Date:MM/dd/yyyy}] should now be index {Index}", episode.Name, episode.PremiereDate, eindex);
    } else {
        _logger.LogDebug("Episode {Name} should now be index {Index}", episode.Name, eindex);
    }
    episode.IndexNumber = eindex;
    episode.ParentIndexNumber = sindex;
    await _libmanager.UpdateItemAsync(episode, season, ItemUpdateType.MetadataEdit, cancellationToken);
    eindex++;
}
sindex++;
}

Compile Output

jellyfin-youtube-metadata-plugin>dotnet build --configuration Release --no-restore
Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

jellyfin-youtube-metadata-plugin\Jellyfin.Plugin.YoutubeMetadata\Providers\YoutubeDL\YTDLSeriesProvider.cs(64,49): warning CS0168: The variable 'e' is declared but never used [jellyfin-youtube-metadata-plugin\Jellyfin.Plugin.YoutubeMetadata\Jellyfin.Plugin.YoutubeMetadata.csproj]
  Jellyfin.Plugin.YoutubeMetadata -> jellyfin-youtube-metadata-plugin\Jellyfin.Plugin.YoutubeMetadata\bin\Release\net6.0\Jellyfin.Plugin.YoutubeMetadata.dll
  Jellyfin.Plugin.YoutubeMetadata.Tests -> jellyfin-youtube-metadata-plugin\Jellyfin.Plugin.YoutubeMetadata.Providers.Tests\bin\Release\net6.0\Jellyfin.Plugin.YoutubeMetadata.Tests.
  dll

Build succeeded.

jellyfin-youtube-metadata-plugin\Jellyfin.Plugin.YoutubeMetadata\Providers\YoutubeDL\YTDLSeriesProvider.cs(64,49): warning CS0168: The variable 'e' is declared but never used [jellyfin-youtube-metadata-plugin\Jellyfin.Plugin.YoutubeMetadata\Jellyfin.Plugin.YoutubeMetadata.csproj]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.73

Example Log Output

[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show Learn Linux TV
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 2022 as index 1
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [Linux Crash Course - The df and du Commands - 06/23/2022] should now be index 1
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [HP Dev One Full Review (Part 2) - Upgrading RAM, Running Other Distros & More! - 06/27/2022] should now be index 2
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [Mycroft's Mimic 3  - A Privacy-focused, open-source Text to Speech Engine - 06/29/2022] should now be index 3
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [Linux Crash Course - The head and tail Commands - 07/08/2022] should now be index 4
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show JayzTwoCents
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 2022 as index 1
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [I thought I wasted my money... Turns out I needed this all along! - 06/29/2022] should now be index 1
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [Things EVERY Tech Parent should know! - 06/30/2022] should now be index 2
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [This PC case just won the Internet! - 07/03/2022] should now be index 3
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [They can't be allowed to get away with this! - 07/05/2022] should now be index 4
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [This is terrible GPU news... I'm actually mad if this is true... - 07/07/2022] should now be index 5
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [This is the most SATISFYING PC video you will ever watch... - 07/10/2022] should now be index 6
[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show SmarterEveryDay
ankenyr commented 2 years ago

Have not taken a look but feel free to send as a PR for credit.

On Sun, Jul 10, 2022, 6:35 PM wjbridge @.***> wrote:

I actually got it fixed based on the PremiereDate. I put a little more logging to make it easier. Feel free to change the warning to debug though. I want to see in the logs if a show does not have a premium date populated like it should.

episodes.Sort(delegate (BaseItem x, BaseItem y) { if (!x.PremiereDate.HasValue && !y.PremiereDate.HasValue) { _logger.LogWarning("Episode [{Name}] does not have 'PremiereDate'", x.FileNameWithoutExtension); _logger.LogWarning("Episode [{Name}] does not have 'PremiereDate'", y.FileNameWithoutExtension); return 0; } else if (!x.PremiereDate.HasValue) { _logger.LogWarning("Episode [{Name}] does not have 'PremiereDate'", x.FileNameWithoutExtension); return -1; } else if (!y.PremiereDate.HasValue) { _logger.LogWarning("Episode [{Name}] does not have 'PremiereDate'", y.FileNameWithoutExtension); return 1; } else { return DateTime.Compare(x.PremiereDate.Value, y.PremiereDate.Value); } }); var eindex = 1; foreach (var episode in episodes) { if (episode.PremiereDate.HasValue) { _logger.LogDebug("Episode [{Name} - {Date:MM/dd/yyyy}] should now be index {Index}", episode.Name, episode.PremiereDate, eindex); } else { _logger.LogDebug("Episode {Name} should now be index {Index}", episode.Name, eindex); } episode.IndexNumber = eindex; episode.ParentIndexNumber = sindex; await _libmanager.UpdateItemAsync(episode, season, ItemUpdateType.MetadataEdit, cancellationToken); eindex++; } sindex++; }

Example Log Output

[21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show Learn Linux TV [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 2022 as index 1 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [Linux Crash Course - The df and du Commands - 06/23/2022] should now be index 1 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [HP Dev One Full Review (Part 2) - Upgrading RAM, Running Other Distros & More! - 06/27/2022] should now be index 2 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [Mycroft's Mimic 3 - A Privacy-focused, open-source Text to Speech Engine - 06/29/2022] should now be index 3 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [Linux Crash Course - The head and tail Commands - 07/08/2022] should now be index 4 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show JayzTwoCents [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing season Season 2022 as index 1 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [I thought I wasted my money... Turns out I needed this all along! - 06/29/2022] should now be index 1 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [Things EVERY Tech Parent should know! - 06/30/2022] should now be index 2 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [This PC case just won the Internet! - 07/03/2022] should now be index 3 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [They can't be allowed to get away with this! - 07/05/2022] should now be index 4 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [This is terrible GPU news... I'm actually mad if this is true... - 07/07/2022] should now be index 5 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Episode [This is the most SATISFYING PC video you will ever watch... - 07/10/2022] should now be index 6 [21:29:39] [DBG] [15] Jellyfin.Plugin.YoutubeMetadata.EpisodeIndexer: Indexing show SmarterEveryDay

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/57#issuecomment-1179864338, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLSKXXONJMQDNUWG4Y3VTN265ANCNFSM52PU66TA . You are receiving this because you were mentioned.Message ID: @.***>

alexpattyn commented 2 years ago

Is this issue now resolved due to https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/pull/60? If so would it be possible to get a release?

ankenyr commented 2 years ago

Can you confirm if this was fixed now?

wjbridge commented 2 years ago

The ordering for me was fixed with this change.

ankenyr commented 1 year ago

@wjbridge thanks for that. Need to look closer later when I get.to my desk at both posts but that gives me something to work with possibly.

On Sat, Jul 9, 2022, 6:10 PM wjbridge @.***> wrote:

Nope, see below. If there is a better way to share the library config. Let me know :)

[image: image] https://user-images.githubusercontent.com/5856635/178127509-ebd45d1f-96c2-44b7-abb0-b027acaaad5a.png

[image: image] https://user-images.githubusercontent.com/5856635/178127516-35a5334e-c761-4260-a5cf-c8d97e8cb485.png

[image: image] https://user-images.githubusercontent.com/5856635/178127520-5e3a3ae7-94d0-4c10-80ca-b50968ebaf65.png

[image: image] https://user-images.githubusercontent.com/5856635/178127525-0ac8ccaa-3063-4141-92bf-4693388c7372.png

[image: image] https://user-images.githubusercontent.com/5856635/178127529-a7ec359c-8d5e-4893-9489-b907aefaecd5.png

— Reply to this email directly, view it on GitHub https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/57#issuecomment-1179632309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYWLSGOTFFCPUVCBEEVVTVTIPI5ANCNFSM52PU66TA . You are receiving this because you were mentioned.Message ID: @.***>

nothing2obvi commented 1 year ago

The issues of wrong ordering and all videos having 1. before them were fixed for me after I uninstalled 1.0.3.9 (though it seems to be labeled as 1.0.3.8), re-installed it, and did a full library scan.

ankenyr commented 4 months ago

I am going to close this one, I have not seen this issue in a long time myself and there has been a new release. If people experience it again please reopen.