pressing shift key suppresses auto-load-folder
This commit is contained in:
@@ -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
|
### 5.4.2
|
||||||
|
|
||||||
- new: the [scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting#powershell) was improved
|
- new: the [scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting#powershell) was improved
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace mpvnet
|
|||||||
public static bool RememberVolume { get; set; } = true;
|
public static bool RememberVolume { get; set; } = true;
|
||||||
public static bool AutoLoadFolder { get; set; } = true;
|
public static bool AutoLoadFolder { get; set; } = true;
|
||||||
public static bool ThemedMenu { get; set; }
|
public static bool ThemedMenu { get; set; }
|
||||||
|
public static bool Queue { get; set; }
|
||||||
|
|
||||||
public static int StartThreshold { get; set; } = 1500;
|
public static int StartThreshold { get; set; } = 1500;
|
||||||
public static int RecentCount { get; set; } = 15;
|
public static int RecentCount { get; set; } = 15;
|
||||||
@@ -121,6 +122,7 @@ namespace mpvnet
|
|||||||
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
|
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
|
||||||
case "themed-menu": ThemedMenu = value == "yes"; return true;
|
case "themed-menu": ThemedMenu = value == "yes"; return true;
|
||||||
case "recent-count": RecentCount = value.Int(); return true;
|
case "recent-count": RecentCount = value.Int(); return true;
|
||||||
|
case "queue": Queue = value == "yes"; return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,12 @@ namespace mpvnet
|
|||||||
files.Add(App.ProcessInstance);
|
files.Add(App.ProcessInstance);
|
||||||
|
|
||||||
foreach (string arg in args)
|
foreach (string arg in args)
|
||||||
|
{
|
||||||
if (!arg.StartsWith("--") && (arg == "-" || arg.Contains("://") || arg.Contains(":\\") || arg.StartsWith("\\\\")))
|
if (!arg.StartsWith("--") && (arg == "-" || arg.Contains("://") || arg.Contains(":\\") || arg.StartsWith("\\\\")))
|
||||||
files.Add(arg);
|
files.Add(arg);
|
||||||
|
else if (arg == "--queue")
|
||||||
|
files[0] = "queue";
|
||||||
|
}
|
||||||
|
|
||||||
Process[] procs = Process.GetProcessesByName("mpvnet");
|
Process[] procs = Process.GetProcessesByName("mpvnet");
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ options = [{ name = "yes" },
|
|||||||
name = "auto-load-folder"
|
name = "auto-load-folder"
|
||||||
default = "yes"
|
default = "yes"
|
||||||
filter = "Playback"
|
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" },
|
options = [{ name = "yes" },
|
||||||
{ name = "no" }]
|
{ name = "no" }]
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void ProcessProperty(string name, string value)
|
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)
|
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("://"))
|
if (files.Count == 0 || files[0].Contains("://"))
|
||||||
{
|
{
|
||||||
@@ -665,7 +666,9 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void Load(string[] files, bool loadFolder, bool append)
|
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();
|
HideLogo();
|
||||||
|
|
||||||
if ((DateTime.Now - LastLoad).TotalMilliseconds < 500)
|
if ((DateTime.Now - LastLoad).TotalMilliseconds < 500)
|
||||||
@@ -685,15 +688,18 @@ namespace mpvnet
|
|||||||
if (string.IsNullOrEmpty(get_property_string("path")))
|
if (string.IsNullOrEmpty(get_property_string("path")))
|
||||||
set_property_int("playlist-pos", 0);
|
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()
|
public static void LoadFolder()
|
||||||
{
|
{
|
||||||
if (!App.AutoLoadFolder) return;
|
if (!App.AutoLoadFolder || Control.ModifierKeys.HasFlag(Keys.Shift))
|
||||||
|
return;
|
||||||
Thread.Sleep(200); // user reported race condition
|
Thread.Sleep(200); // user reported race condition
|
||||||
string path = get_property_string("path");
|
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<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
|
List<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
|
||||||
files = files.Where(file =>
|
files = files.Where(file =>
|
||||||
App.VideoTypes.Contains(file.ShortExt()) ||
|
App.VideoTypes.Contains(file.ShortExt()) ||
|
||||||
@@ -704,7 +710,8 @@ namespace mpvnet
|
|||||||
files.Remove(path);
|
files.Remove(path);
|
||||||
foreach (string i in files)
|
foreach (string i in files)
|
||||||
commandv("loadfile", i, "append");
|
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)
|
public static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
|
||||||
|
|||||||
Reference in New Issue
Block a user