1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-17 04:58:06 +00:00
Commit Graph

31 Commits

Author SHA1 Message Date
Guido Cella
73b84595a8 select.lua: change the --save-watch-history warning text
The current warning was fine when you select history directly, but
giving more information can be useful when you happen to see it by right
clicking the title without prior information.

Fixes https://github.com/mpv-player/mpv/pull/15655#discussion_r1948053973
2025-02-09 23:30:54 +01:00
Guido Cella
3e0b3373df select.lua: add a miscellaneous menu 2025-01-27 21:06:50 +01:00
Guido Cella
e2090533cf select.lua: select from the watch history with g-h
Implement selection of the entries in the watch history.

The last entry in the selector deletes the history file.
2025-01-27 18:53:28 +01:00
Guido Cella
20375d1133 select.lua: show the ID of editions without title
MKV editions can have no title. Print "Edition" and their IDs instead of
showing an empty selection.
2025-01-24 04:35:36 +00:00
Guido Cella
7a59a12b76 select.lua: select files with watch later files with g-w
Implement selection of files to resume playing from watch later config
files. Requires --write-filename-in-watch-later-config.
2025-01-05 23:21:50 +01:00
Guido Cella
0c3c4a315b select.lua: use mp.msg.warn for unavailable messages 2025-01-05 23:21:50 +01:00
Guido Cella
50a3da73b7 select.lua: fix select-edition crash on non-MKVs
In files other than MKVs edition-list is an empty table, not nil. It is
current-edition that is nil.

However nil still needs to be checked to not crash with mpv --idle.
2024-12-31 10:13:38 +01:00
Guido Cella
5e4b825a48 select.lua: abort edition selection when there's only 1
MKVs have 1 edition by default so don't show an empty edition selection
in that case.
2024-12-13 03:46:03 +01:00
Guido Cella
43f4568816 select.lua: select editions 2024-12-02 21:44:18 +01:00
Guido Cella
e3eeaec813 select.lua: don't use add_forced_key_binding
There's no advantage in using the forced version here. It is a leftover
from when this was an external script and forced was necessary to bind
key sequences reliably until 3f83671f20.
2024-09-19 13:57:39 +00:00
Guido Cella
ee05804bfa {osc,select}.lua: show playlist entries with trailing /
If a playlist entry ends with a slash these scripts only show the
basename which is empty. Fix this by stripping trailing slashes so that
the last directory component becomes the basename.
2024-08-06 20:27:33 +02:00
Guido Cella
5f768a688b loadfile,select.lua: print only one bitrate
Print demux-bitrate if available, else hls-bitrate, not both (as
demux-bitrate is generally more reliable). This avoids printing "HLS
kbps" which looks weird.

Fixes
https://github.com/mpv-player/mpv/pull/14453#discussion_r1700550385
2024-08-02 08:41:43 +02:00
Guido Cella
5f8ac5b862 loadfile,select.lua: print bitrates of tracks 2024-07-18 22:52:35 +02:00
Guido Cella
7bcd525dce various: sync shown track flags
Show the same flags in loadfile.c, select.lua and stats.lua. The only
differences are that only stats.lua prints both image and albumart
because it's supposed to show detailed track information, and select.lua
prints the image flag because pressing g-v doesn't show Video or Image
like in loadfile.c and stats.lua.
2024-07-18 22:52:35 +02:00
Guido Cella
2fd88ffbae various: print Image instead or Video for image tracks
Fixes #8561.
2024-07-18 22:52:35 +02:00
Guido Cella
82ffe8f425 loadfile: update the format of terminal track information
Stop making unselected tracks and editions grey because they can be hard
to read over a dark background (\033[2m would be hard to differentiate
from regular text with a light theme instead), and because there is no
way to not print the escape sequences in --log-file.

Just use the same circles as the OSD and OSC. We need to print the empty
circles for alignment on mlterm with East Asian fonts (we could also
make them invisible with \033[8m but it would still get added to log
files).

Add back the space before tracks and editions when printed after
"Playing..." or "Track switched" and similar, so they look like a
sub-section of it, consistently with the metadata which starts with
space which makes it look like a sub-section of the "File tags" line.

Leave 2 spaces between track columns.

Make the lang options only as long as the longest language.

Place hls-bitrate within the same parentheses as the other data.

Replace the incomprehensible (*) (f) and [P] with textual descriptions
within []. Also place external there.

Stop converting Hz to kHz for consistency with other log messages, e.g.
AO: [pipewire] 48000Hz stereo 2ch floatp

Remove the space in "2 ch" so it doesn't look like 2 separate values (We
considered using mp_chmap_to_str(&s->codec->channels) but it prints
values like "unknown2").
2024-06-24 16:19:31 +02:00
Guido Cella
8873beabc3 select.lua: consider --sub-delay for the subtitle line selector
Preselect and seek to the correct subtitle line when there is a
sub-delay.

Also slightly increase the offset without a video track else it
occasionally doesn't seek to the selected line with non-0 sub-delay and
no video. This now uses the same offset as sub/sd.h.
2024-06-22 13:42:27 +00:00
Guido Cella
e3f496dbf5 select.lua: don't use sub-start to preselect subtitle lines
There is no need to compare sub-start now that we don't check for exact
matches with ffmpeg's timestamps. time-pos can always be used.

Comparing time-pos removes the need for the workaround of sub-start of
embedded subtitles being earlier than ffmpeg's timestamps, as time-pos
is always slightly after sub-start.

Removing this workaround also fixes a bug present since 4059d1832b,
which started comparing numerical values of timestamps instead of
strings to determine the preselected subtitle line, where the line after
the current one is preselected when sub-start is greater than ffmpeg's
timestamps because they have been rounded, e.g. sub-start 10.001 is >
than ffmpeg's 10.00.

This will also allow considering --sub-delay in the comparisons, as
comparing sub-start - sub-delay would preselect the wrong lines.
2024-06-22 13:42:27 +00:00
Guido Cella
dc998560aa options: add --osd-playlist-entry
Allow configuring whether to print the media-title, the filename or both
(as `<title> (<filename>)`) in show-text ${playlist}, the OSC playlist
and in the playlist selector.

Showing only titles hides information when files are badly tagged, or
when it hides the track numbers of album songs. But showing filenames is
not as useful as titles e.g. when playing URLs with media titles. This
option lets the user choose which one to show, or show both if switching
is inconvenient.

The OSC's playlist_media_title script-opt is removed because this option
is better since it works everywhere after configuring it once.

Closes #11653.

Also show the full URLs of playlist entries instead of their basenames
in osc.lua and select.lua, consistently with mp_property_playlist().

For simplicity, this just checks if entries contain :// instead of
replicating all of mp_is_url().

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2024-06-08 01:43:15 +02:00
Guido Cella
75645263dd select.lua: support extracting ytdl_hook subtitles
They don't work because they have EDL URLs, but we can attempt to
extract their real URLs.
2024-06-07 22:45:41 +02:00
Guido Cella
5657cd65b7 select.lua: hide the hour when it's 0
Omit the hour in the chapter and subtitle line selectors when the file
is shorter than an hour.
2024-06-07 22:45:41 +02:00
Guido Cella
8939bfc3ef select.lua: seek to the currect subtitle line when paused without video
Add an offset to sub seek correctly like in b35e34ae2f. The extra 0.01
offset apparently isn't necessary in this case.
2024-06-07 22:45:41 +02:00
Guido Cella
4059d1832b select.lua: preselect the correct sub line with duration >= 100 minutes
ffmpeg outputs timestamps like '100:00.00' in LRCs instead of adding
hours, and timestamps like '100:00' are < '10:00', so since these
strings are being compared, if there is no current subtitle line, there
are subtitle lines at >= 100 minutes, and time-pos is between 10 minutes
and 100 minutes, one of the last subtitle lines gets preselected.

Fix this by converting the timestamps to numbers before comparing them.

Also simplify the logic by merging the 2 loops to determine the default
line, and reformat the timestamps by adding hours to not print minutes >
60 in the selector, and by removing the hundredths of seconds. This
requires storing the accurate timestamps in a table to seek to them on
submit.
2024-06-07 22:45:41 +02:00
Kacper Michajłow
c3bf2c72a6 select.lua: allow ffmpeg to print errors if it fails
Also don't print subprocess result to OSD, as it is not comprehensible.
2024-05-20 18:32:22 +02:00
Guido Cella
b82d437ea4 select.lua: strip trailing zeros from FPS values
Show e.g. "30 fps" instead of "30.000 fps".

Also switch to %.4f for consistency with pretty_print_double().
2024-05-20 17:54:57 +02:00
Guido Cella
78b2de677b select.lua: handle sub-start being earlier than ffmpeg's timestamps 2024-05-20 17:54:40 +02:00
Guido Cella
8f596b44be select.lua: don't needlessly initialize default_item 2024-05-20 17:54:40 +02:00
Guido Cella
99fd55ad75 select.lua: preselect the previous sub line without a current line 2024-05-20 17:54:40 +02:00
Guido Cella
ce2f501c23 select.lua: fix preselecting the current subtitle line
Fixes 4d32db21c5.
2024-05-20 17:54:40 +02:00
Guido Cella
4d32db21c5 select.lua: strip brackets in select-subtitle-line 2024-05-13 16:36:27 +02:00
Guido Cella
61f72bd512 select.lua: add this script
This adds script messages to select playlist entries, tracks, chapters,
subtitle lines, bindings and properties using the newly introduced
mp.input.select().

This fully closes #13964.
2024-05-12 23:13:48 +02:00