mpv icon indicating copy to clipboard operation
mpv copied to clipboard

loadfile: clip long track titles

Open guidocella opened this issue 1 month ago • 8 comments

When a track information is longer than the terminal width, clip it and add ellipsis. Useful for long URLs.

Fixes #10975 along with #17021.

guidocella avatar Nov 14 '25 10:11 guidocella

Note that track metadata comes after URLs so that will get clipped too. Not sure if that is worth it or the issue should be a wontfix. ${term-clip-cc} will not work for clipping only the URL indipendently of the rest of the line.

guidocella avatar Nov 14 '25 11:11 guidocella

I haven't read the previous PRs closely, but wouldn't it be better if we stripped the parameters from URL filenames? The current behavior for an URL like https://example.com/some/path/image.jpg?some=param&other=param is that we use filename image.jpg?some=param&other=param for %F

edit: disregard this, it fails if the url is instead https://example.com/?file=some_anime_girl.png

llyyr avatar Nov 14 '25 11:11 llyyr

Actually I don't think track lines necessarily have to fit exactly on 1 line. Changed it to just clip track titles longer than 99 characters.

guidocella avatar Nov 14 '25 12:11 guidocella

I just checked...I have many tracks that are close to 200 characters or more...I think many OS's do a fine job of limiting it to 255 or so. I just have a tooltip to show entire track name in uosc. Useful when fuzzy searching for particular terms otherwise user wouldn't be able to see certain matches. Does this patch just clip tracks for the built-in mpv playlist..if so no big deal.

mrfragger avatar Nov 15 '25 00:11 mrfragger

No, the track title itself is clipped. Which is also useful to not hide metadata in the track menu.

guidocella avatar Nov 15 '25 06:11 guidocella

Are you confusing tracks and playlist items? External track titles are usually just something like "en.srt".

guidocella avatar Nov 16 '25 15:11 guidocella

yea it I was thinking audio tracks as in chapters in audio.....sub tracks... ok. Still not quite sure if I can limit them to 99 but will try but think there definitely are cases where they exceeed. Just don't want it to affect autoloading subs. Also I have usoc to display 3 or 4 lines or whatever it takes to show all files in a playlist in this case only OS affects length of filenames, subs.

mrfragger avatar Nov 17 '25 02:11 mrfragger

This has no relation to the playlist.

guidocella avatar Nov 17 '25 06:11 guidocella