[Feature Request] Turn Channel Playlists Into "Seasons"
For importing into a media server such as Jellyfin it would be useful if more was done to denote the playlists a channel has when it deals with many types of content.
I can think of two approaches and ideally both could be implemented:
-
It appears Jellyfin handles sub-folders as seasons, so adding a toggle to "create subfolders for playlists" would be great. This would be a simple way to manage it from an end-user perspective and it seems at least Jellyfin handles it intelligently.
-
Include playlist info in NFO file when that option is selected (I'm not very familiar with the limits of that format though)
Thanks for all the hard work so far!
EDIT: Or would this be possible using a naming scheme such as{playlist_title}/{yyyymmdd}_{source}_{title}_{format}.{ext}? I haven't tested that myself.
Thanks for the issue. This has been requested and investigated several times. As nice as this would be it's simply not technically possible. When you index the videos on a channel the each video can be in zero or multiple playlists. There is no definitive playlist name you can use. The playlist name for media items is not available in the metadata to use. There might be some sort of guesswork where you can index a channel then index the playlists then check for corresponding video IDs to see if the video appears just once in a playlist created by the channel owner, but that would be pretty prone to breaking and very index resource intensive. I can't see a sane solution to this being available any time soon unfortunately. If there becomes a good way to build this it would be high priority as I would also use this myself.
@meeb Oh shoot, sorry I did some quick looking through the Issues but didn't see the others.
Hmm okay, that's totally reasonable if it's a pain!
Spitballing ideas though:
When you index the videos is the "in a playlist" a global count of all users on YouTube that have that video in a playlist then?
If so, (and this would certainly need some word-smithing) I can think of two, almost equally ugly, workarounds:
-
A "only sync videos not in channel playlists" and then manually create sources for each playlist. Downside: Fairly manual and a bit strange.
-
"Sync all playlist channels (this may create duplicate files)" option. (Lots of IFs as I haven't looked a youtube-dl code options recently) step 1 Download all the channel's videos in 0 channel playlists step 2 tubesync lists all channel's playlists step 3 tubesync creates sources for itself for all the channel playlists (duplicating all the settings but using a sub-folder as the default name). Getting fancy/bonus feature: If there's a way to note the video ID has already been downloaded somewhere else, you could make a hardlink to the file so both sources think it's downloaded but it wouldn't take up extra space.
Thanks for the issue. This has been requested and investigated several times. As nice as this would be it's simply not technically possible. When you index the videos on a channel the each video can be in zero or multiple playlists. There is no definitive playlist name you can use. The playlist name for media items is not available in the metadata to use. There might be some sort of guesswork where you can index a channel then index the playlists then check for corresponding video IDs to see if the video appears just once in a playlist created by the channel owner, but that would be pretty prone to breaking and very index resource intensive. I can't see a sane solution to this being available any time soon unfortunately. If there becomes a good way to build this it would be high priority as I would also use this myself.
I would index the playlists first. Then the channel last. I had a manual script doing something similar in the past.
Basically I:
- Grabbed a list of playlists from a channel.
- The starting at playlist 1, I'd download those videos. Then playlist 2, download those. And so on.
- Finally, to ensure I wasn't missing any videos, I would index the channel, and download the missing videos.
Sure this has some disadvantages. Such as:
- When a video is in multiple playlists, it only gets "matched" to the first playlist it appears in. I guess you could include a toggle to allow users to decide how to handle this. Such as "download copy for each playlist", "download for first", "download for last", "download for x playlist", "where video appears in multiple playlists, download only as part of all videos batch".
- When a video moves playlists, how do we handle it's movements in our downloaded structure? Personally this would be the biggest win to solve to finally allow dumping YouTube's UI altogether. Many channels will post videos under "All Videos", then many weeks like finally "organise" it into a playlist. The ideal solution would be to pick this up, and move the video to the correct playlist.
Tbh, this is the biggest deficiency in any YouTube syncing workflow at the moment, that is mirroring playlists in Plex/Jellyfin/Emby. If this was worked out effectively, many of us would finally be able to cast off YouTube's apps altogether.
2. Getting fancy/bonus feature: If there's a way to note the video ID has already been downloaded somewhere else, you could make a hardlink to the file so both sources think it's downloaded but it wouldn't take up extra space.
This would be cool where users are using either TubeSync or their local folder structure for browsing content. But how would Plex/Jellyfin/Emby handle the "duplicate". I doubt it'd sync watch status between the items would it? (So watching a video in one playlist, marks it as watched in the others). Would it treat the hardlink's as different files, and import them as "duplicates", with different back end ID's, so different play states?
I can have a look at what playlist metadata is available, however even in the best case situation this is going to be complicated to implement and would require sub-sources to be added as a feature to track all the required metadata. If possible this would be a long term goal at best.
Instead of a Plex playlist, what about setting a collection tag? Setting the collection to be the name of the source in TubeSync might allow some semblance of order in Plex. I was hoping that it would sort things like TV Shows, but it's dumping them in like Movies, so even though I have 3 YT sources right now, they're just all plopped in the same library with no organization so it makes it somewhat difficult to navigate.
Plex collections could work, it would require quite a bit more integration with Plex servers and manually indexing media items from Plex. I'll add it to the wishlist.
Thanks! And - the Python-PlexAPI might help lighten the load?
A little, PlexAPI is certainly comprehensive. Currently tubesync just uses requests and makes a manual HTTP request to trigger the library refresh. To tag items with a collection I assume the process would be pretty extensive such as:
- Save media to disk
- Trigger Plex library rescan
- Use Plex API to scan all the files in the library to find the media item we've just added
- Identify the file maybe by unique key (YouTube ID) in the filename
- Use PlexAPI to tag the media item with a collection
I've not done much more than skim the PlexAPI docs but there doesn't appear to be a less intensive way of doing it short of keeping a cross-index of Plex media item IDs inside the tubesync database which probably isn't going to happen. I don't think there's a way to add a single media item to a library with a collection up front. Either way, I'll consider it, but making it sensible in overhead is going to be annoying and it's not an insignificant amount of work.