occivink / mpv-gallery-view

Gallery-view scripts for mpv
The Unlicense
195 stars 21 forks source link

Option to show all filenames #5

Open moqmar opened 6 years ago

moqmar commented 6 years ago

Unfortunately the gallery only shows the filename of the currently selected item, it would be great if there was an option to show all filenames.

occivink commented 6 years ago

That would be possible, but in case of long filenames it will cause some ugly overlap. There is just no reasonable way in ASS to know the bounding box of some text, so we can't truncate or wrap the text properly.

moqmar commented 6 years ago

Yeah, I guess the only way would be to count how many "W"s fit with the default font and cut the filename off after that. I guess that ASS thing is the worst thing about mpv... o.O

occivink commented 6 years ago

Yeah, I guess the only way would be to count how many "W"s fit with the default font and cut the filename off after that.

I'm not really fond of that, the default font is platform-dependent so it'd be pretty brittle. I guess I could let users specify the average width in pixels of a character (and allow up to thumb_width / avg characters), and cross fingers we won't run into edge-cases.

I guess that ASS thing is the worst thing about mpv... o.O

It's pretty nice actually. In case you didn't know, ASS is a (relatively) advanced subtitle format that lets you draw all sorts of geometric primitives (in addition to subtitles of course). The on-screen controller is drawn entirely with it, so it's pretty powerful.

moqmar commented 6 years ago

It's pretty nice actually. In case you didn't know, ASS is a (relatively) advanced subtitle format that lets you draw all sorts of geometric primitives (in addition to subtitles of course). The on-screen controller is drawn entirely with it, so it's pretty powerful.

I guess the problem is actually trying to build a GUI with a subtitle format then. :laughing:

What about just giving two settings:

show_filenames=yes|selection|no # "selection" would be the same as show_filename=yes currently
truncate_filenames=12 # max characters, "Big Buck Bunny.mp4" would be truncated to "Big Buck Bun…" with that value

Then, show_filename=yes could additionally show the complete filename of the selected item at the very top or bottom of the screen.

occivink commented 6 years ago

Yes that would be an acceptable solution. I suggested specifying the average character size because then it would handle dynamic thumbnail sizes, but maybe that's too complicated.