Code Monkey home page Code Monkey logo

Comments (6)

pukkandan avatar pukkandan commented on May 18, 2024 1

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

from yt-dlp.

pukkandan avatar pukkandan commented on May 18, 2024

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

from yt-dlp.

kade-robertson avatar kade-robertson commented on May 18, 2024

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

from yt-dlp.

pukkandan avatar pukkandan commented on May 18, 2024

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

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

from yt-dlp.

pukkandan avatar pukkandan commented on May 18, 2024

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

from yt-dlp.

pukkandan avatar pukkandan commented on May 18, 2024

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

from yt-dlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.