mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Add the option to append media to playback queue instead of playing media instantly

Open thorhop opened this issue 11 years ago • 36 comments

Add option for the user to add files to a playback queue when dragging and dropping files/URLs on to mpv or launching a new mpv with a command line switch which will add media to the playlist of an already running mpv process.

Right now there doesn't seem to be an option to change the default behaviour of mpv if a file/URL should be dropped on to it. Case in point:

input/event.c - line 23

Thanks!

thorhop avatar Jul 24 '15 02:07 thorhop

I second this. It would remove half the motivation for a playlist gui. Currently, all but the simplest playlists (all files in same directory) are impossible to build except from the command line.

kevmitch avatar Jul 24 '15 02:07 kevmitch

How about making this use a modifier key? Normal dropping replaces, dropping with Shift pressed adds?

ChrisK2 avatar Jul 24 '15 02:07 ChrisK2

Or, to make it a bit more intuitive, make the OSC show visual hints, e.g. so that depending on which part of the screen the files are dropped in, mpv will replace the playlist and start playing instantly, or add them to the current playlist, or something else…

I may or may not be volunteering. Does the API expose something like a drag-enter event yet?

ghost avatar Jul 24 '15 22:07 ghost

Does the API expose something like a drag-enter event yet?

No.

ghost avatar Jul 24 '15 22:07 ghost

now we are starting to escalate things a bit ...

And this should probably also work without the OSC.

ChrisK2 avatar Jul 24 '15 22:07 ChrisK2

So, what do you want?

ghost avatar Jul 27 '15 19:07 ghost

I think it would be sufficient to interpret drags into a window already playing something as enqueue. It could be an opt-in command line / config option if there is desire to maintain the old behaviour.

kevmitch avatar Jul 28 '15 03:07 kevmitch

I would like to see an append-play command for mpv directly (to be used via DnD on a .desktop launcher Though admittedly that would be of limited user base useability

mc4man avatar Jul 30 '15 13:07 mc4man

The command exists, it's just not used by the drop code. (Actually it does use it if multiple files are dropped: for each file a loadfile command is run, and only the first file wipes the previous playlist.)

ghost avatar Jul 30 '15 13:07 ghost

Wow, that was easy

-                (i == 0) ? "replace" : "append",
+                (i == 0) ? "append-play" : "append",

On the other hand if this should not be the default behaviour, we need either a modifier key (+ modiified event) or an option. Opinions?

kevmitch avatar Aug 06 '15 06:08 kevmitch

I'd be fine without any further changes than that. The drawback might be that dragging files to a playing window gives no notification that the files were added to the play list. Should there be some sort of osd notification?

kevmitch avatar Aug 06 '15 23:08 kevmitch

above works fine here when mpv is started on a playlist or at least 2 files. So dumb ? of the month - is there anyway to have this work when mpv is opened on a single file? (- I guess for opening via the .desktop I could add /dev/null to the Exec= line though maybe that's a poor idea..

mc4man avatar Aug 07 '15 01:08 mc4man

@mc4man I don't understand.

Are you saying that the above doesn't work when mpv is started with mpv file.mkv? What happens then?

kevmitch avatar Aug 07 '15 01:08 kevmitch

Ok , re- checking, if starting with a single file it does 'work' - [cplayer] Run command: loadfile, flags=1, args=[file:///home/doug/Videos/amostviolentyear-clip1_h1080p.mov, append-play, ] but I have to wait until the 1st. file finishes. (no playlist arrows in Osc) or use a keyboard binding If mpv is started with 2 files then those & any DnD files can be switched at will from those little arrows in the Osc So I guess that was what I was looking for from a single file, ie. the Osc playlist arrows.., sorry about my confusion here.

Ot - is there anyway to stop the 'spamming' when using -v from simple cursor movement in window? (- [cplayer] Run command: ignore, flags=9, args=[] & if exposing the Osc [cplayer] Run command: script-binding, flags=9, args=[osc/__keybinding1] [cplayer] Run command: script-binding, flags=9, args=[osc/__keybinding2]

mc4man avatar Aug 07 '15 01:08 mc4man

I see what you mean. So the OSC doesn't get updated by the drop event I guess.

Looks like once the next file is loaded the arrows appear.

There doesn't seem to be a documented event that the osc could listen to for this. file-loaded sounds like the new file has to start playing.

kevmitch avatar Aug 07 '15 06:08 kevmitch

adding to osc.lua

mp.observe_property("playlist", nil, request_init)

seems to cause the arrows to appear right away.

kevmitch avatar Aug 07 '15 07:08 kevmitch

So I see the following possibilities:

  1. we switch to the new behavior, and the old behavior is not possible anymore
  2. we make it configurable
  3. something with shift modifiers deciding the behavior or so
  4. somehow implement it in the OSC

I don't like 2. input.conf is not flexible enough for this (unless you have a suggestion), and I'd like to avoid another global config option. Plus, I can't imagine anyone actually bothering to find and use this setting.

We could do 3., which would be pretty simple, but also requires modifications in 4 platform backends (x11, wayland, osx, win).

Option 4 would implement it in the OSC and possibly allow fancy interactions (like visually indicating the action the drop will have), but it also sounds very complicated, and I don't volunteer to do the osc.lua part of the implementation.

ghost avatar Aug 07 '15 13:08 ghost

I like 1 but obviously a certain % would disagree & want a new DnD to start immediately. 3 seems ok, again here would prefer the modifier to be for 'old' behavior as I'd take a guess the majority would like the 'new' behavior. (- I could do a quick test & push new behavior to one ppa & see how many complaints I get (or you get.. Right now I'd say there are 1400 or so very active users so that's not a huge sampling but could be representative

mc4man avatar Aug 07 '15 16:08 mc4man

  1. will probably get some people angry "MAKE IT CONFIGURABLE!!11"

  2. (global config option) or 3) sound like the best solutions to me.

  3. would shut out all people who disable the OSC, besides sounding like a bit much of a PITA to implement.

ChrisK2 avatar Aug 07 '15 21:08 ChrisK2

3 would without doubt result in people requesting a config option to reverse the shift/no-shift behavior.

Argon- avatar Aug 07 '15 21:08 Argon-