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

mark truncated filenames with ellipsis "…" in -o template if length exceeds x bytes #6983

Open
6 of 9 tasks
chrizilla opened this issue May 3, 2023 · 3 comments
Open
6 of 9 tasks
Labels
enhancement New feature or request triage Untriaged issue

Comments

@chrizilla
Copy link

chrizilla commented May 3, 2023

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I intentionally remove or skip any mandatory* field

Checklist

Provide a description that is worded well enough to be understood

(Asking here so as not to lead #1136 further off-topic.)

In #1136 (comment) a solution was proposed to mark truncated filenames in -o template:

Add a %(title.201&…|)s - read as "if title.201 (201'th char) exists, then (&) add , else (|) add nothing"

This works for character count but apparently not for the subsequently discussed byte count (which may be more useful when dealing with unicode chars):

yt-dlp ZYlALC1Pmv4 --skip-download --no-config --print "%(title).50s%(title.51&…|)s"
Hubble Space Telescope, Planet 9, Curiosity Mars R…    # truncates at 50 chars and detects 51st char

yt-dlp ZYlALC1Pmv4 --skip-download --no-config --print "%(title).50B%(title.51B&…|)s"
Hubble Space Telescope, Planet 9, Curiosity Mars R     # truncates at 50 bytes but doesn't detect 51st byte

I guess this is either the wrong syntax or not yet possible to do.
In the latter case, would it be worth considering this new syntax as an enhancement ?

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • If using API, add 'verbose': True to YoutubeDL params instead
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

No response

@mikkovedru
Copy link
Contributor

I confirm your bug report. The format %(title|).160B%(title.161B&…|)s doesn't work on my system either, despite it being suggested in many topics.

@clusterized
Copy link

Shouldn't "%(title).50B%(title.51&…|)B" do the trick?

@mikkovedru
Copy link
Contributor

Shouldn't "%(title).50B%(title.51&…|)B" do the trick?

It actually did. Thank you @clusterized !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage Untriaged issue
Projects
Status: No status
Development

No branches or pull requests

3 participants