pinchflat
pinchflat copied to clipboard
{{playlist_title}} not being detected/used correctly
Describe the bug I'm trying to download a bunch of playlists into their own folders with the output template:
/{{ uploader }}/{{ playlist_title }}/e%(upload_date>%Y%m%d)S - {{ title }}[{{ id }}].{{ ext }}
With the goal it should go under: Youtube Channel/Playlist Title/e202400101 - Test.mp4
But no matter what I try the
To Reproduce
- Created new Profile:
id: 1 name: Testing inserted_at: 2024-05-25T19:11:11Z updated_at: 2024-05-26T01:18:48Z download_nfo: true output_path_template: /{{ uploader }}/{{ playlist_title }}/e%(upload_date>%Y%m%d)S - {{ title }}[{{ id }}].{{ ext }} preferred_resolution: 1080p sponsorblock_categories: sponsorblock_behaviour: disabled download_thumbnail: true embed_thumbnail: true download_auto_subs: false download_subs: true embed_subs: false sub_langs: en download_metadata: true embed_metadata: true download_source_images: true livestream_behaviour: exclude redownload_delay_days: shorts_behaviour: exclude
- Add New source:
https://www.youtube.com/playlist?list=PLwXY3ipyXQw5WEV0F-b5m4Lkf0nTOGm6f
Expected behavior Videos should download into:
.../pitchflat/downloads/LDShadowLady/Minecraft SOS/e20240224 - New World | Ep. 1 | Minecraft S0S[oYT8M9IfEhU].mp4
But they are going into
.../pitchflat/downloads/LDShadowLady/NA/e20240224 - New World | Ep. 1 | Minecraft S0S[oYT8M9IfEhU].mp4
I want to try and fix it myself, but Elixir is a brand new language for me, any chance you could link the the instructions to set up a dev environment?
Hey there! Thanks for the report (:
I'm out of the house for the entire weekend, but I can take a deeper look when I'm home. I suspect the issue is because indexing and downloading are completely discrete steps so all context (like playlist information) from the indexing step is lost when it comes to actually downloading.
I've had to add workarounds to maintain this context and I think in this case you'd want to use {{ source_collection_name }}. I'll think about adding that as an alias for playlist_title but I'm hesitant since I don't want to overwrite yt-dlp attribute names. I'll think about it!
Thanks for the interest! I'm always happy to talk about elixir if there's interest in contributing. There's a little quickstart here which should work but please let me know if I missed anything!
I've decided I don't think it's a good idea to have my custom output template variable names overlap with yt-dlp variable names, so I think this ticket is good to close.
Please feel free to reopen if the fix didn't work for you or if I missed something!
I may take a look at this, this is actually downstream from another feature I want to add where playlists get downloaded with a season/episode format for direct import into plex.
Sounds good! Out of curiosity, have you noticed issues with the existing season/episode organization scheme for Plex? Definitely open to new features, but if there is an issue or limitation with the existing implementation please let me know because I try to keep that feature running smoothly!
Basically, it comes down to how I want plex to take in my YT content. I want channels treated as "TV Show", playlists treated as "Season Number" and playlist index treated as "episode number". Right now (if I'm reading everything correctly) the only auto generated S##E## format is generated from the date the video is uploaded.
But if a channel is updating multiple playlists weekly the the episodes would be mixed into a common season based the upload date which isn't what I want
My goal is to end up with a single preset that outputs files similar to this:
/{{ uploader }}/Season {{ playlist_season }}/s{{ playlist_season }}e%(upload_date>%Y%m%d)S - {{ title }}[{{ id }}].{{ ext }}
And then add base channels to my sources:
https://www.youtube.com/@GeminiTayMC
And have pinch flat:
- Scan the channel and create a unique season number associated with every playlist
- Download all content in playlists to unique seasons (which can be renamed from (season 01 -> playlist title in plex)
- Download any content not in a playlist into "Season 00"
Looking at the code I think two things would need to change to make this happen:
- Stop using yt-dlp for output naming format directly, download to a tmp folder, build the output name in pinchflat based on the yt-dlp metadata file so we can add some additional functionality, then move the files to the final location as a post download task.
- Store playlists in the database so they can be assigned unique, incrementing season numbers that can be key-ed off of channel_id, playlist_id for querying.
Oddly, plex will let you add a string "Title" to a season as a post indexing task but it will only take it in as a TV show if you give it a Season # as an integer.
Got it! I've had similar requests to this a few times but there have been a few blockers I've found so far:
- I don't think yt-dlp has a way to collect all playlists and their entries with a single command. I'm not certain about this though
- a single source can't have duplicate copies of a media item (as enforced by a unique compound index). This isn't just a nice-to-have - it's an integral part of several critical app features. I bring this up because the same video can appear across multiple playlists or even on the same playlist
- it'll probably be pretty hard to determine which videos to put in the
00playlist. ie: figuring out which videos don't exist in any playlist so you're not hella duplicating downloads
I'm not sure if this is a good approach, but the first place my mind goes is that maybe it'd be best to find a way to automatically create one source per-playlist and then all the existing per-source logic will work as currently designed
Are you aware of any other apps that can do this? I think this would be a killer feature if done well and it'd be useful to look at how other apps have gone about this
Stop using yt-dlp for output naming format directly
This is likely a non-starter, unfortunately. The yt-dlp naming engine is so powerful that I don't think it's wise to reimplement its functionality. That'd also be a backward compatibility/migration nightmare.
Ultimately, the app really is a command generator more than anything and I truly believe that's one of its strengths. That's not to say I haven't written a lot of code, but most of it is built to support and enhance yt-dlp's capabilities rather than replace them
edit: I thought I closed this issue earlier which is why I closed it just now - unrelated to what we're talking about!
Here's a solution that I hate but it kind of works:
I include '/' in my source so I can define the directory and season right in there:
/{{ source_custom_name }}e%(upload_date>%Y%m%d)S - {{ title }}[{{ id }}].{{ ext }}
Source Name:impulseSV/Season 01/s01
Nevermind that's a terrible solution, I just noticed I can add per source output names, that's much cleaner 🤣