Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add Date Option Patch #43

Closed
3 tasks done
kristofferR opened this issue Feb 1, 2021 · 6 comments · Fixed by #45
Closed
3 tasks done

[Feature Request] Add Date Option Patch #43

kristofferR opened this issue Feb 1, 2021 · 6 comments · Fixed by #45
Labels
enhancement New feature or request

Comments

@kristofferR
Copy link

Checklist

  • I'm reporting a feature request
  • I've verified that I'm running yt-dlp version 2021.01.29
  • I've searched the bugtracker for similar feature requests including closed ones

Description

There's a fork of youtube-dl by @kade-robertson with a great date option patch, which allows you to add the time/date when the video was uploaded to the filename:
https://github.com/kade-robertson/youtube-dl

Here's the relevant commit/patch:
ytdl-org/youtube-dl@4d6c8b1

It would be great if it could get merged in here. It's very useful.

@pukkandan
Copy link
Member

The patch given is a temporary measure at best. What if someone else wants this functionality for release_date instead? Adding all those extra fields only makes the code bloated and hard to maintain in future. I will see if it is possible to create a general solution for this using the output template itself. Maybe something like -o %(upload_date|yy-mm-dd)t

@pukkandan pukkandan added the enhancement New feature or request label Feb 1, 2021
@pukkandan
Copy link
Member

pukkandan commented Feb 1, 2021

Proof of concept: pukkandan/empty@4469558

Eg:

$youtube-dlc https://www.youtube.com/watch?v=N5di3IroHnY -o "duration=%(duration>%H-%M-%S)t, uploaded=%(upload_date>%Y day%j)t" --get-filename
duration=00-13-35, uploaded=2020 day309

@kade-robertson
Copy link

Since I got tagged I figured I would post the pull request I originally made for this feature that was closed for the exact reasons above, it's not a great solution. This properly implemented would be a good thing to get into upstream as well (I'm not sure how diverged yt-dlp is at this point).

ytdl-org/youtube-dl#13752

Note dsttfw's feedback:

The general idea is to allow something like %(field[:<field_specific_formatter>])<standard_formatter>.

@pukkandan
Copy link
Member

%(field[:<field_specific_formatter>])<standard_formatter>

Let me see if it is possible to make the date formatting work with the standard formatter

@pukkandan
Copy link
Member

pukkandan/empty@abb10ff

Now it should be possible to do formats like %(upload_date>%d).1d, although I don't understand why anyone would want to do that, considering how flexible strftime already is

I also changed it to use just %()s rather than %()t

@pukkandan
Copy link
Member

pukkandan commented Feb 1, 2021

Output templates are complicated and I would appreciate if someone could review the code. I'll make a PR so that it's easier to review

@pukkandan pukkandan mentioned this issue Feb 1, 2021
4 tasks
pukkandan added a commit that referenced this issue Feb 2, 2021
nswanberg pushed a commit to nswanberg/yt-dlp that referenced this issue Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants