tomasklaen / uosc

Feature-rich minimalist proximity-based UI for MPV player.
GNU Lesser General Public License v2.1
1.85k stars 69 forks source link

Error when trying to paste local files and a request to edit the beahvior of paste slightly #983

Closed raziel711 closed 2 months ago

raziel711 commented 2 months ago

System information: OS: Windows 11 Pro 23H2 mpv version: mpv v0.38.0-746-gf02b8bc9 source: https://github.com/zhongfly/mpv-winbuild/releases uosc information: most recent lua files from the main branch, ziggy exe from the 5.5.0 release, all default values in uosc.conf

I'm not sure if this behavior is supported, but I'm having an issue when trying to use Ctrl+c on a video file in Windows Explorer, and then using the paste-to-playlist command to append that file to the playlist.

After copying the file and using paste-to-playlist, I get the following OSD message: mpv_MDVLwehdKB

I also get the following error in the console and even though it says that the operation was successful, the file is never appended to the playlist: mpv_OpVELOVwcU

Also, this only occurs with local files; I don't have any issues when pasting URLs.

Log file: log.txt

I also have a separate request regarding the behavior of the paste command. Would you consider changing the current behavior of adding to the playlist when playlist-count > 1 to playlist-count >= 1 instead? That would make it a more general command that could work for a wider variety of cases instead of having to potentially have keybinds set up for both paste-to-open and paste-to-playlist.

For instance:

  1. If I'm watching a streaming video and want to add additional videos to the playlist, I would have to make a keybind using paste-to-playlist at least for adding the first video to the playlist.
  2. If I have an instance of mpv open in idle mode and paste a URL, I would need to use a keybind for paste-to-open to start playing the video automatically, since paste-to-playlist will append the URL, but not start playing until manually selected.

However, if paste is changed to work with playlist-count >= 1, then that single command would work for both of the above scenarios, removing the need to have multiple keybinds.

tomasklaen commented 2 months ago

Pasting files not working

As documented, working with clipboard only supports paths or urls, i.e. strings. To my knowledge there's no go library that can work with file pointers/descriptors in clipboard in cross-platform manner, and I don't feel like writing one myself. Every time I've tried adding support for this in one of my apps it was a hornets nest. That's probably why there are no libraries for it.

But the error returned by the library is definitely not useful. I'll tweak that.

paste-to-playlist when count >= 1

Then the behavior of paste would always be adding to playlist pretty much. There's just no way to differentiate if the user treats one file open as a playlist or not, but in most cases, it isn't, so I find current paste behavior useful for majority cases.

Though we could make paste-to-playlist open the file as well if mpv is idle, which would behave the way you want paste to behave.

raziel711 commented 2 months ago

I've tested the new paste-to-playlist behavior, and it is working really well for me. Thank you.