diff --git a/Changelog.md b/Changelog.md index d4d57f4..dd357e7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,11 @@ +### + +- pressing shift key suppresses auto-load-folder +- switch --queue added, this will not clear the playlist but append + and it will suppress auto-load-folder. The installer adds + a 'Add to mpv.net playlist' context menu item, people with + portable download might use [Open with++](https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist) + ### 5.4.2 - new: the [scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting#powershell) was improved diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index 99e5e42..24db1c6 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -28,6 +28,7 @@ namespace mpvnet public static bool RememberVolume { get; set; } = true; public static bool AutoLoadFolder { get; set; } = true; public static bool ThemedMenu { get; set; } + public static bool Queue { get; set; } public static int StartThreshold { get; set; } = 1500; public static int RecentCount { get; set; } = 15; @@ -121,6 +122,7 @@ namespace mpvnet case "auto-load-folder": AutoLoadFolder = value == "yes"; return true; case "themed-menu": ThemedMenu = value == "yes"; return true; case "recent-count": RecentCount = value.Int(); return true; + case "queue": Queue = value == "yes"; return true; } return false; } diff --git a/mpv.net/Misc/Program.cs b/mpv.net/Misc/Program.cs index 793b301..c56781a 100644 --- a/mpv.net/Misc/Program.cs +++ b/mpv.net/Misc/Program.cs @@ -40,8 +40,12 @@ namespace mpvnet files.Add(App.ProcessInstance); foreach (string arg in args) + { if (!arg.StartsWith("--") && (arg == "-" || arg.Contains("://") || arg.Contains(":\\") || arg.StartsWith("\\\\"))) files.Add(arg); + else if (arg == "--queue") + files[0] = "queue"; + } Process[] procs = Process.GetProcessesByName("mpvnet"); diff --git a/mpv.net/Resources/mpvNetConfToml.txt b/mpv.net/Resources/mpvNetConfToml.txt index b622521..d490719 100644 --- a/mpv.net/Resources/mpvNetConfToml.txt +++ b/mpv.net/Resources/mpvNetConfToml.txt @@ -58,7 +58,7 @@ options = [{ name = "yes" }, name = "auto-load-folder" default = "yes" filter = "Playback" -help = "For single files automatically load the entire directory into the playlist. (mpv.net specific setting)" +help = "For single files automatically load the entire directory into the playlist. Can be suppressed via shift key. (mpv.net specific setting)" options = [{ name = "yes" }, { name = "no" }] diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index bffe8e5..a67485c 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -117,7 +117,8 @@ namespace mpvnet public static void ProcessProperty(string name, string value) { - if (name.Any(char.IsUpper)) Msg.ShowError("Uppercase char detected: " + name, "mpv properties using the command line and the mpv.conf config file are required to be lowercase."); + if (name.Any(char.IsUpper)) + Msg.ShowError("Uppercase char detected: " + name, "mpv properties using the command line and the mpv.conf config file are required to be lowercase."); switch (name) { @@ -637,7 +638,7 @@ namespace mpvnet } } - Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control)); + Load(files.ToArray(), !App.Queue, Control.ModifierKeys.HasFlag(Keys.Control) || App.Queue); if (files.Count == 0 || files[0].Contains("://")) { @@ -665,7 +666,9 @@ namespace mpvnet public static void Load(string[] files, bool loadFolder, bool append) { - if (files is null || files.Length == 0) return; + if (files is null || files.Length == 0) + return; + HideLogo(); if ((DateTime.Now - LastLoad).TotalMilliseconds < 500) @@ -685,15 +688,18 @@ namespace mpvnet if (string.IsNullOrEmpty(get_property_string("path"))) set_property_int("playlist-pos", 0); - if (loadFolder && !append) Task.Run(() => LoadFolder()); // user reported race condition + if (loadFolder && !append) + Task.Run(() => LoadFolder()); // user reported race condition } public static void LoadFolder() { - if (!App.AutoLoadFolder) return; + if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift)) + return; Thread.Sleep(200); // user reported race condition string path = get_property_string("path"); - if (!File.Exists(path) || get_property_int("playlist-count") != 1) return; + if (!File.Exists(path) || get_property_int("playlist-count") != 1) + return; List files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList(); files = files.Where(file => App.VideoTypes.Contains(file.ShortExt()) || @@ -704,7 +710,8 @@ namespace mpvnet files.Remove(path); foreach (string i in files) commandv("loadfile", i, "append"); - if (index > 0) commandv("playlist-move", "0", (index + 1).ToString()); + if (index > 0) + commandv("playlist-move", "0", (index + 1).ToString()); } public static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)