Jeeaaasus / youtube-dl

Automated yt-dlp Docker image
https://hub.docker.com/r/jeeaaasustest/youtube-dl/
MIT License
258 stars 33 forks source link

Trying to use the date variable in the output options. #76

Closed Dax333 closed 1 year ago

Dax333 commented 1 year ago

From inside the container in the /downloads folder I'm able to use:

yt-dlp -o S01E$(date +"%Y%m%d")'-/downloads/%(uploader)s-%(title)s-%(id)s.%(ext)s' 'https://www.youtube.com/playlist?list=PLq4GeMnWONsS8bLDYF8zvpfz1fEyk22T9' -i and yt-dlp -o "S01E$(date +"%Y%m%d")'-/downloads/%(uploader)s-%(title)s-%(id)s.%(ext)s'" 'https://www.youtube.com/playlist?list=PLq4GeMnWONsS8bLDYF8zvpfz1fEyk22T9' -i

but in the args.conf file if I use --output '/downloads/S01E$(date +"%Y%m%d")'-%(uploader)s-%(title)s-%(id)s.%(ext)s''

The resulting file doesn't actually have the date.

Is my syntax wrong?

Jeeaaasus commented 1 year ago

Hi there @Dax333!

When you do $(date), it's called a shell expansion. This is where the shell (bash in this case) substitutes this text for the output of the command inside the parentheses.

Not being bash, yt-dlp cannot do shell expansions like this, however with 954fb8b I made it so that if you have a shell expansion in your output argument inside args.conf, it gets added to the commandline where it will get expanded. (unsure how this interacts with the "additional args added after URL feature")

If you update to newest image, I successfully used this in my args.conf

--output "/downloads/$(date +'%Y%m%d')/%(uploader)s/%(title)s.%(ext)s"

Let me know if anything is unclear :)