New menu item and binding: File > Add files to playlist from clipboard (Ctrl+Shift+v)

This commit is contained in:
stax76
2023-12-26 09:22:27 +01:00
parent 86c823bfde
commit 1048dbed40
4 changed files with 17 additions and 6 deletions

View File

@@ -7,8 +7,9 @@
- The conf file reader/writer detects if the user prefers space before and after the equal sign. - The conf file reader/writer detects if the user prefers space before and after the equal sign.
- The portable download includes like the installer debug symbols. - The portable download includes like the installer debug symbols.
- Setup questions on startup removed. - Setup questions on startup removed.
- Pressing shift while drag and drop (and clipboard import) appends - Pressing shift while drag and drop appends instead of replaces
instead of replaces files in the playlist. mpv supports this as well. files in the playlist. mpv supports this as well.
- New menu item and binding: `File > Add files to playlist from clipboard` `Ctrl+Shift+v`.
- All list operation suffixes are available on the command line. - All list operation suffixes are available on the command line.
- Improved layout in conf editor. - Improved layout in conf editor.

View File

@@ -241,10 +241,13 @@ Shows a folder browser dialog to open a DVD or BD folder.
ISO images don't have to be mounted, but instead can be ISO images don't have to be mounted, but instead can be
opened directly with the open-files command. opened directly with the open-files command.
### open-clipboard ### open-clipboard [\<flags\>]
Opens a single URL or filepath from the clipboard, Opens a single URL or filepath from the clipboard,
or multiple files in the file clipboard format. or multiple files in the file clipboard format.
**append**
Appends files/URLs to the playlist.
### play-pause ### play-pause
Cycles the pause property. In case the playlist is empty, Cycles the pause property. In case the playlist is empty,
the most recent file from the recent files list is loaded. the most recent file from the recent files list is loaded.

View File

@@ -153,12 +153,15 @@ public class GuiCommand
public void OpenFromClipboard(IList<string> args) public void OpenFromClipboard(IList<string> args)
{ {
bool append = Control.ModifierKeys == Keys.Shift; bool append = args.Count == 1 && args[0] == "append";
if (System.Windows.Forms.Clipboard.ContainsFileDropList()) if (System.Windows.Forms.Clipboard.ContainsFileDropList())
{ {
string[] files = System.Windows.Forms.Clipboard.GetFileDropList().Cast<string>().ToArray(); string[] files = System.Windows.Forms.Clipboard.GetFileDropList().Cast<string>().ToArray();
Player.LoadFiles(files, false, append); Player.LoadFiles(files, false, append);
if (append)
Player.CommandV("show-text", _("Files/URLs were added to the playlist"));
} }
else else
{ {
@@ -171,11 +174,14 @@ public class GuiCommand
if (files.Count == 0) if (files.Count == 0)
{ {
Terminal.WriteError("The clipboard does not contain a valid URL or file."); Terminal.WriteError(_("The clipboard does not contain a valid URL or file."));
return; return;
} }
Player.LoadFiles(files.ToArray(), false, append); Player.LoadFiles(files.ToArray(), false, append);
if (append)
Player.CommandV("show-text", _("Files/URLs were added to the playlist"));
} }
} }

View File

@@ -17,8 +17,9 @@ public static class InputHelp
new (_("File"), _("Add external subtitle files..."), "script-message-to mpvnet load-sub", "Alt+s"), new (_("File"), _("Add external subtitle files..."), "script-message-to mpvnet load-sub", "Alt+s"),
new (_("File"), "-"), new (_("File"), "-"),
new (_("File"), _("Add files to playlist..."), "script-message-to mpvnet open-files append"), new (_("File"), _("Add files to playlist..."), "script-message-to mpvnet open-files append"),
new (_("File"), _("Recent Files")), new (_("File"), _("Add files to playlist from clipboard"), "script-message-to mpvnet open-clipboard append", "Ctrl+Shift+v"),
new (_("File"), "-"), new (_("File"), "-"),
new (_("File"), _("Recent Files")),
new (_("File"), _("Exit"), "quit", "Esc"), new (_("File"), _("Exit"), "quit", "Esc"),
new (_("Playback"), _("Play/Pause"), "script-message-to mpvnet play-pause", "Space"), new (_("Playback"), _("Play/Pause"), "script-message-to mpvnet play-pause", "Space"),