kieraneglin / pinchflat

Your next YouTube media manager
GNU Affero General Public License v3.0
880 stars 17 forks source link

[Triage] {{playlist_title}} not being detected/used correctly #261

Closed szadigian81 closed 4 months ago

szadigian81 commented 4 months ago

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 always ends up as NA

To Reproduce 1) 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

2) 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

pinchflat-logs-2024-05-26-6.txt

szadigian81 commented 4 months ago

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?

kieraneglin commented 4 months ago

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!

kieraneglin commented 4 months ago

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!

szadigian81 commented 4 months ago

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.

kieraneglin commented 4 months ago

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!

szadigian81 commented 4 months ago

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:

Screenshot 2024-05-26 at 7 19 25 PM
szadigian81 commented 4 months ago

Looking at the code I think two things would need to change to make this happen:

szadigian81 commented 4 months ago

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.

kieraneglin commented 4 months ago

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'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

kieraneglin commented 4 months ago

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!

szadigian81 commented 4 months ago

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

szadigian81 commented 4 months ago

Nevermind that's a terrible solution, I just noticed I can add per source output names, that's much cleaner 🤣