New menu item and binding: File > Add files to playlist from clipboard (Ctrl+Shift+v)
This commit is contained in:
@@ -153,12 +153,15 @@ public class GuiCommand
|
||||
|
||||
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())
|
||||
{
|
||||
string[] files = System.Windows.Forms.Clipboard.GetFileDropList().Cast<string>().ToArray();
|
||||
Player.LoadFiles(files, false, append);
|
||||
|
||||
if (append)
|
||||
Player.CommandV("show-text", _("Files/URLs were added to the playlist"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -171,11 +174,14 @@ public class GuiCommand
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Player.LoadFiles(files.ToArray(), false, append);
|
||||
|
||||
if (append)
|
||||
Player.CommandV("show-text", _("Files/URLs were added to the playlist"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,9 @@ public static class InputHelp
|
||||
new (_("File"), _("Add external subtitle files..."), "script-message-to mpvnet load-sub", "Alt+s"),
|
||||
new (_("File"), "-"),
|
||||
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"), _("Recent Files")),
|
||||
new (_("File"), _("Exit"), "quit", "Esc"),
|
||||
|
||||
new (_("Playback"), _("Play/Pause"), "script-message-to mpvnet play-pause", "Space"),
|
||||
|
||||
Reference in New Issue
Block a user