mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.89k stars 2.87k forks source link

Add filename support for --playlist-start #10409

Open c02y opened 2 years ago

c02y commented 2 years ago

Before requesting a new feature make sure it hasn't been requested yet. https://github.com/mpv-player/mpv/labels/meta%3Afeature-request

Expected behavior of the wanted feature

--playlist-start only supports index and auto, but when I open a playlist, I need the playlist to be sorted by mtime. I can use ls -t | mpv --playlist=- to do that, but I need to start from the specific file instead of the first one if not providing index for --playlist-start, fetching the index is not easy, passing the file to it is easier.

Most of the time I use mpv to open a file inside ranger using Enter or Right key on a video file, the files list in the directory are sorted by mtime, and I hope to open a video file and the playlist is sorted by mtime like my ranger does.

Changing the line in ~/.config/ranger/rifle.conf:

mime ^video,        has mpv,      X, flag f = mpv -- "$@"

to

mime ^video,        has mpv,      X, flag f = /bin/ls -t | mpv --playlist=- -- "$@"

is ok for playlist to be sorted my mtime, but mpv won't play the video file when I hit Enter or Right key, and --playlist-start=10 doesn't seem to work.

If anyone can get an easy solution instead implementing filename for --playlist-start, it would be also OK.

Alternative behavior of the wanted feature

Log file

Even if you think it's not necessary at first, it might help us later to find possible issues. Make a log file made with -v -v or --log-file=output.txt, paste it to https://0x0.st/ or attach it to the github issue, and replace this text with a link to it.

UnkwUsr commented 10 months ago

This would be nice option. As example, another tool feh (image viewer) has option --start-at [filename] which allows opening any file from filemanager and then navigate through files inside feh (as now whole directory is playlist).

UPD: https://github.com/derf/feh/issues/502#issuecomment-577554998 says that there is mpv script that can automatically load other files from directory and add them to playlist: https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua