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

README.md: Add logical (IF, OR, ELSEIF, ELSE) section and examples #8252

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mikkovedru
Copy link

@mikkovedru mikkovedru commented Sep 30, 2023

README.md: Add logical (IF, OR, ELSEIF, ELSE) section and examples

It took me a long time to understand how I could manipulate the output formats in a logical way. Even the realization that it was possible at all took the longest time. I hope that improving the documentation will save a lot of time for other people.

I used practical examples, that illustrate the logic, but also introduced a lot of useful yt-dlp's opportunities as well as provided a better understanding via demonstrating surprising gotchas and important caveats.

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

Copilot Summary

🤖 Generated by Copilot at 789ba9e

Summary

📝🗝️📋

Enhance output template syntax documentation in README.md. Add more explanation, keywords, and examples to help users customize their output filenames.

If you want to download some clips
And customize your output scripts
You'll appreciate
The template update
That adds keywords, examples, and tips

Walkthrough

  • Clarify the meaning of s and d format types in output template syntax (link)
  • Add logical keywords (IF, OR, ELSE) to output template syntax for more intuitive and readable expressions (link)
  • Provide examples of using logical output template syntax in different scenarios in README.md (link)

@bashonly bashonly added the docs/meta/cleanup related to docs, code cleanup, templates, devscripts etc label Oct 3, 2023
@bashonly
Copy link
Member

bashonly commented Oct 3, 2023

All of the pseudocode in the "logical code examples" section would cause confusion for most users, IMO

@coletdjnz
Copy link
Member

All of the pseudocode in the "logical code examples" section would cause confusion for most users, IMO

Maybe this would be better off in the wiki?

@mikkovedru
Copy link
Author

@bashonly

All of the pseudocode in the "logical code examples" section would cause confusion for most users, IMO

I disagree.

When learning a new programming/formatting language there are basic cornerstones that must be and are practically taught for beginners:

  1. How to print (Hello World!), how to modify the output.
  2. Variables and how to work with them (numbers, strings; how to modify them)
  3. How to control the flow logic of the program (how to check if a variable has a certain value and what to do depending on the result)

These are the basic things that every person (wanting to utilize the language) needs to know. And if the person already has programming experience, it is the first thing he is seeking for in the documentation.

This is the wiki for Python:
image

This is the content of the basic 4h video course on Python:
image
Control of the flow is a critical part of learning the language.

In yt-dlp's "output language" the basic case of 1st is handled automatically. The more complex cases are explained, but the explanation could be better. The 2nd is in a similar situation - whatever is applicable to yt-dlp - it is explained, but the easiness of explanation could definitely be improved. The third is partly explained, partly not; but even when it is formally presented, the explanations/order/language/terminology are very difficult to get through.

My PR is drastically improving the 3rd aspect, while also making the 1st and 2nd better by showing useful examples that the reader might actually want to get.

My pseudocode would cause confusion to people who are not in a position to receive this information. But they would get even less from the current explanatory list. But for people who seek this information and are theoretically capable of receiving it, the new section and examples would make it so much easier and better. Remember that I am not suggesting removing the current list and replacing it with my section. I am simply suggesting adding the new section in order to make the syntax much more approachable and easer/faster to understand.

@pukkandan pukkandan added the core-triage triage requested from a core dev label Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-triage triage requested from a core dev docs/meta/cleanup related to docs, code cleanup, templates, devscripts etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants