-
This commit is contained in:
@@ -25,8 +25,8 @@ namespace mpvnet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex mutex = new Mutex(true, "mpvnetProcessInstance", out bool isFirst);
|
|
||||||
App.Init();
|
App.Init();
|
||||||
|
Mutex mutex = new Mutex(true, "mpvnetProcessInstance", out bool isFirst);
|
||||||
|
|
||||||
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
|
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
|
||||||
{
|
{
|
||||||
@@ -49,6 +49,7 @@ namespace mpvnet
|
|||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex.Dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -574,26 +574,21 @@ namespace mpvnet
|
|||||||
else
|
else
|
||||||
mp.commandv("loadfile", files[i], "append");
|
mp.commandv("loadfile", files[i], "append");
|
||||||
|
|
||||||
mp.LoadFolder(files[0]);
|
Thread.Sleep(50); // user reported race condition
|
||||||
}
|
string path = files[0];
|
||||||
|
if (files.Length != 1 || !File.Exists(path)) return;
|
||||||
static void LoadFolder(string path)
|
List<string> filesInFolder = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
|
||||||
{
|
filesInFolder = filesInFolder.Where((file) =>
|
||||||
if (get_property_int("playlist-count") == 1)
|
App.VideoTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) ||
|
||||||
{
|
|
||||||
if (!File.Exists(path)) return;
|
|
||||||
List<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
|
|
||||||
files = files.Where((file) => App.VideoTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) ||
|
|
||||||
App.AudioTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower())).ToList();
|
App.AudioTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower())).ToList();
|
||||||
files.Sort(new StringLogicalComparer());
|
filesInFolder.Sort(new StringLogicalComparer());
|
||||||
int index = files.IndexOf(path);
|
int index = filesInFolder.IndexOf(path);
|
||||||
files.Remove(path);
|
filesInFolder.Remove(path);
|
||||||
foreach (string i in files)
|
foreach (string i in filesInFolder)
|
||||||
commandv("loadfile", i, "append");
|
commandv("loadfile", i, "append");
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
commandv("playlist-move", "0", (index + 1).ToString());
|
commandv("playlist-move", "0", (index + 1).ToString());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
|
static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user