Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
thorhop opened this issue Jul 24, 2015 · 36 comments

Comments

@thorhop
Copy link

thorhop commented Jul 24, 2015

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 thorhop changed the title [Feature Request] Add media to queue/playlist instead of playing the media instantly Dragging media on to mpv should add the media queue/playlist instead of playing the media instantly Jul 24, 2015
@thorhop thorhop changed the title Dragging media on to mpv should add the media queue/playlist instead of playing the media instantly Dragging media on to mpv should add the media to queue/playlist (or at least as an option) Jul 24, 2015
@thorhop thorhop changed the title Dragging media on to mpv should add the media to queue/playlist (or at least as an option) Add the option to append media to playback queue instead of playing media instantly Jul 24, 2015
@kevmitch
Copy link
Member

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.

@ChrisK2
Copy link
Member

ChrisK2 commented Jul 24, 2015

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

@mia-0
Copy link
Member

mia-0 commented Jul 24, 2015

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
Copy link

ghost commented Jul 24, 2015

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

No.

@ChrisK2
Copy link
Member

ChrisK2 commented Jul 24, 2015

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

And this should probably also work without the OSC.

@ghost
Copy link

ghost commented Jul 27, 2015

So, what do you want?

@ghost ghost added the meta:info-needed label Jul 27, 2015
@kevmitch
Copy link
Member

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.

@mc4man
Copy link

mc4man commented Jul 30, 2015

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

@ghost
Copy link

ghost commented Jul 30, 2015

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.)

@kevmitch
Copy link
Member

kevmitch commented Aug 6, 2015

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
Copy link
Member

kevmitch commented Aug 6, 2015

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?

@mc4man
Copy link

mc4man commented Aug 7, 2015

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..

@kevmitch
Copy link
Member

kevmitch commented Aug 7, 2015

@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?

@mc4man
Copy link

mc4man commented Aug 7, 2015

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]

@kevmitch
Copy link
Member

kevmitch commented Aug 7, 2015

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
Copy link
Member

kevmitch commented Aug 7, 2015

adding to osc.lua

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

seems to cause the arrows to appear right away.

@ghost
Copy link

ghost commented Aug 7, 2015

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.

@mc4man
Copy link

mc4man commented Aug 7, 2015

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

@ChrisK2
Copy link
Member

ChrisK2 commented Aug 7, 2015

  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.

@Argon-
Copy link
Member

Argon- commented Aug 7, 2015

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

@kevmitch
Copy link
Member

Append to playlist is now implemented on X11 and Windows when dropping with the shift key.

Leaving this open as it still needs to be implemented on MacOS and Wayland. I can probably figure out Wayland in the next day or so, but I have no way of testing on MacOS, so someone else will have to do that.

@kevmitch
Copy link
Member

kevmitch commented Sep 2, 2015

As far as I can tell, Wayland suffers from the same problem as X11 in that the drag destination doesn't get any direct information about modifier keys. In contrast, this is something that Windows got dead right.

Furthermore, unlike X11 Wayland does not currently have the concept of drag and drop actions, although it looks like this is being planned / discussed. Therefore, I don't think it is currently possible to implement this for Wayland.

@kevmitch
Copy link
Member

So OSX remains the only platform to do (if it's even possible there). Marking as stalled, since no one seems interested. I may one day be able to beg/borrow/steal a Mac, but no promises.

@vitorgalvao
Copy link
Contributor

Just to clarify, it’s currently possible to append to the playlist with ⇧+drag-and-drop on the window on every OS but OS X.

However, it’s not possible to append to the running playlist via the CLI. Is that correct?

@ghost
Copy link

ghost commented Jun 13, 2016

Just to clarify, it’s currently possible to append to the playlist with ⇧+drag-and-drop on the window on every OS but OS X.

Seems so.

However, it’s not possible to append to the running playlist via the CLI. Is that correct?

You can via Lua scripting or the JSON IPC, but there's no higher level builtin support for it with the normal "user interface".

@vitorgalvao
Copy link
Contributor

but there's no higher level builtin support for it with the normal "user interface"

Yes, that’s what I meant. Thank you for the fast reply.

@haasn
Copy link
Member

haasn commented Jun 13, 2016

As an end-user the way I would like to see this issue resolved is by making the drag-and-drop event a customizable keybinding, so I could decide what to do. (The path would be expanded somehow)

Not sure if that makes any sense in the mpv input frame work, but it would certainly be the most elegant way to let users decide whether to replace or append new files.

@ghost
Copy link

ghost commented Jun 14, 2016

As an end-user the way I would like to see this issue resolved is by making the drag-and-drop event a customizable keybinding, so I could decide what to do. (The path would be expanded somehow)

Passing the path is exactly the problem.

@Rick-74
Copy link

Rick-74 commented Dec 11, 2016

@Akemi
Since you're doing many cocoa-related things lately, there is any chance you could take a look at this long-stalled issue?

Akemi added a commit to Akemi/mpv that referenced this issue Dec 13, 2016
When dropping a file on mpv, either on the window
or the App bundle icon, while holding the shift
key the dropped files will be appended to the
playlist.

Fixes mpv-player#2166
@Akemi
Copy link
Member

Akemi commented Dec 13, 2016

that should do it.

@vitorgalvao
Copy link
Contributor

@Akemi Thank you for this. Still no way to do it via CLI, is that correct?

@Akemi
Copy link
Member

Akemi commented Dec 13, 2016

just the ways that were already mentioned i believe. i just took care of the missing cocoa part.

@vitorgalvao
Copy link
Contributor

just the ways that were already mentioned i believe.

Asking because the original request (top post) included it (emphasis added):

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

But yes, as I understand it, it doesn’t do that in any OS. Was just checking.

Again, thank you for implementing it.

@Akemi Akemi closed this as completed in 3bb0615 Dec 13, 2016
@Rick-74
Copy link

Rick-74 commented Dec 14, 2016

Thank you very much!

@GreyAsteroid
Copy link

Alright! So I need this to be configurable 😃

Would it be best if I made a new feature request or no?

@captain
Copy link

captain commented Nov 2, 2022

Couldn't you just use "mpv playlist.m3u" and then "cat filename >> playlist.m3u" with things you want to append to it? The nice thing about that is you can also "cat playlist.m3u" to SEE what's on it and even "vi playlist.m3u" to modify it! :-)
PS: This should also work on MacOS.

Sadly, no. It looks like mpv reads in the playlist at program start time and doesn't look at it again. :-(

But I see that shift-drag-drop from Finder to mpv's "art window" now works on MacOS to build an invisible playlist on the fly. ¯_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests