several improvements
This commit is contained in:
@@ -5,6 +5,15 @@ not yet released
|
||||
- Custom conf folder location feature removed.
|
||||
- Inno Setup replaced with Microsoft Store setup.
|
||||
- Fix script-opts files being ingnored.
|
||||
- Showing the recent list in the command palette,
|
||||
the top item gets auto selected.
|
||||
https://github.com/stax76/mpv.net/issues/328#issuecomment-1057296054
|
||||
- If the play list is empty, the most recent file
|
||||
gets loaded when pressing space.
|
||||
https://github.com/stax76/mpv.net/issues/328#issuecomment-1057296054
|
||||
- Ctrl+v (previously u) opens files (or URLs) from the clipboard,
|
||||
previously it had to be a file path (format string) and now
|
||||
it can also be the clipboard format of type file.
|
||||
- libmpv zhongfly 2022-02-27
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace mpvnet
|
||||
case "open-files": OpenFiles(args); break;
|
||||
case "open-optical-media": Open_DVD_Or_BD_Folder(); break;
|
||||
case "open-url": OpenURL(); break;
|
||||
case "play-pause": PlayPause(); break;
|
||||
case "playlist-first": PlaylistFirst(); break;
|
||||
case "playlist-last": PlaylistLast(); break;
|
||||
case "reg-file-assoc": RegisterFileAssociations(args[0]); break;
|
||||
@@ -117,6 +118,25 @@ namespace mpvnet
|
||||
Core.SetPropertyInt("playlist-pos", count - 1);
|
||||
}
|
||||
|
||||
public static void PlayPause()
|
||||
{
|
||||
int count = Core.GetPropertyInt("playlist-count");
|
||||
|
||||
if (count > 0)
|
||||
Core.Command("cycle pause");
|
||||
else if (App.Settings.RecentFiles.Count > 0)
|
||||
{
|
||||
foreach (string i in App.Settings.RecentFiles)
|
||||
{
|
||||
if (i.Contains("://") || File.Exists(i))
|
||||
{
|
||||
Core.LoadFiles(new[] { i }, true, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShowHistory()
|
||||
{
|
||||
if (File.Exists(Core.ConfigFolder + "history.txt"))
|
||||
@@ -217,16 +237,24 @@ namespace mpvnet
|
||||
public static void OpenURL()
|
||||
{
|
||||
App.InvokeOnMainThread(new Action(() => {
|
||||
string clipboard = System.Windows.Forms.Clipboard.GetText();
|
||||
|
||||
if (string.IsNullOrEmpty(clipboard) || (!clipboard.Contains("://") && !File.Exists(clipboard)) ||
|
||||
clipboard.Contains("\n"))
|
||||
if (WinForms.Clipboard.ContainsFileDropList())
|
||||
{
|
||||
App.ShowError("No URL found, the clipboard does not contain a valid URL or file.");
|
||||
return;
|
||||
string[] files = WinForms.Clipboard.GetFileDropList().Cast<string>().ToArray();
|
||||
Core.LoadFiles(files, false, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
}
|
||||
else
|
||||
{
|
||||
string clipboard = WinForms.Clipboard.GetText();
|
||||
|
||||
Core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
if (string.IsNullOrEmpty(clipboard) || (!clipboard.Contains("://") && !File.Exists(clipboard)) ||
|
||||
clipboard.Contains("\n"))
|
||||
{
|
||||
App.ShowError("No URL found, the clipboard does not contain a valid URL or file.");
|
||||
return;
|
||||
}
|
||||
|
||||
Core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -449,7 +477,7 @@ namespace mpvnet
|
||||
|
||||
public static void ShowRecent() => App.InvokeOnMainThread(ShowRecentInternal);
|
||||
|
||||
public static void ShowRecentInternal()
|
||||
static void ShowRecentInternal()
|
||||
{
|
||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||
|
||||
@@ -468,6 +496,7 @@ namespace mpvnet
|
||||
|
||||
CommandPalette.Instance.SetItems(items);
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
CommandPalette.Instance.SelectFirst();
|
||||
}
|
||||
|
||||
public static void RegisterFileAssociations(string perceivedType)
|
||||
|
||||
@@ -713,7 +713,8 @@ namespace mpvnet
|
||||
if (App.Settings.RecentFiles.Contains(path))
|
||||
App.Settings.RecentFiles.Remove(path);
|
||||
|
||||
App.Settings.RecentFiles.Insert(0, path);
|
||||
if (path != @"bd://" && path != @"dvd://")
|
||||
App.Settings.RecentFiles.Insert(0, path);
|
||||
|
||||
while (App.Settings.RecentFiles.Count > App.RecentCount)
|
||||
App.Settings.RecentFiles.RemoveAt(App.RecentCount);
|
||||
@@ -1138,8 +1139,7 @@ namespace mpvnet
|
||||
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
Core.LoadFiles(e.Data.GetData(DataFormats.FileDrop) as String[], true, ModifierKeys.HasFlag(Keys.Control));
|
||||
|
||||
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||
else if (e.Data.GetDataPresent(DataFormats.Text))
|
||||
Core.LoadFiles(new[] { e.Data.GetData(DataFormats.Text).ToString() }, true, ModifierKeys.HasFlag(Keys.Control));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# https://mpv.io/manual/master/#input
|
||||
|
||||
o script-message mpv.net open-files #menu: Open > Open Files...
|
||||
u script-message mpv.net open-url #menu: Open > Open URL or file path from clipboard
|
||||
Ctrl+v script-message mpv.net open-url #menu: Open > Open URL or file from clipboard
|
||||
_ script-message mpv.net open-optical-media #menu: Open > Open DVD/Blu-ray Drive/Folder...
|
||||
_ ignore #menu: Open > -
|
||||
Alt+a script-message mpv.net load-audio #menu: Open > Load external audio files...
|
||||
@@ -31,11 +31,11 @@ _ script-message mpv.net open-files append #menu: Open > Add files to
|
||||
_ ignore #menu: Open > -
|
||||
_ ignore #menu: Open > Recent
|
||||
|
||||
_ ignore #menu: -
|
||||
Space cycle pause #menu: Play/Pause
|
||||
Ctrl+s stop #menu: Stop
|
||||
_ ignore #menu: -
|
||||
Enter cycle fullscreen #menu: Toggle Fullscreen
|
||||
_ ignore #menu: -
|
||||
Space script-message mpv.net play-pause #menu: Play/Pause
|
||||
Ctrl+s stop #menu: Stop
|
||||
_ ignore #menu: -
|
||||
Enter cycle fullscreen #menu: Toggle Fullscreen
|
||||
f cycle fullscreen
|
||||
|
||||
F11 playlist-prev; set pause no #menu: Navigate > Previous File
|
||||
|
||||
Reference in New Issue
Block a user