use mpvnet instead of mpv to create playlist from folder
This commit is contained in:
@@ -518,6 +518,9 @@ namespace mpvnet
|
||||
Action = () => Core.SetPropertyInt("playlist-pos", index)
|
||||
};
|
||||
|
||||
if (string.IsNullOrEmpty(item.Text))
|
||||
item.Text = file;
|
||||
|
||||
items.Add(item);
|
||||
|
||||
if (currentPath.ToLowerEx() == file.ToLowerEx())
|
||||
|
||||
@@ -1194,17 +1194,24 @@ namespace mpvnet
|
||||
{
|
||||
string file = files[i];
|
||||
|
||||
if (string.IsNullOrEmpty(file))
|
||||
continue;
|
||||
|
||||
if (file.Contains("|"))
|
||||
file = file.Substring(0, file.IndexOf("|"));
|
||||
|
||||
if (file.Ext() == "avs")
|
||||
string ext = file.Ext();
|
||||
|
||||
if (ext == "avs")
|
||||
LoadAviSynth();
|
||||
|
||||
if (file.Ext() == "iso")
|
||||
if (ext == "iso")
|
||||
LoadISO(file);
|
||||
else if(SubtitleTypes.Contains(file.Ext()))
|
||||
else if(SubtitleTypes.Contains(ext))
|
||||
CommandV("sub-add", file);
|
||||
else if (file.Ext().Length != 3 && File.Exists(System.IO.Path.Combine(file, "BDMV\\index.bdmv")))
|
||||
else if (ext == "" && !file.Contains("://") && Directory.Exists(file))
|
||||
{
|
||||
if (File.Exists(System.IO.Path.Combine(file, "BDMV\\index.bdmv")))
|
||||
{
|
||||
Command("stop");
|
||||
Thread.Sleep(500);
|
||||
@@ -1212,6 +1219,13 @@ namespace mpvnet
|
||||
CommandV("loadfile", @"bd://");
|
||||
}
|
||||
else
|
||||
{
|
||||
files = GetMediaFiles(Directory.GetFiles(file, "*.*", SearchOption.AllDirectories)).ToArray();
|
||||
LoadFiles(files, loadFolder, append);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == 0 && !append)
|
||||
CommandV("loadfile", file);
|
||||
@@ -1300,13 +1314,7 @@ namespace mpvnet
|
||||
if (path.Contains("\\"))
|
||||
dir = System.IO.Path.GetDirectoryName(path);
|
||||
|
||||
List<string> files = Directory.GetFiles(dir).ToList();
|
||||
|
||||
files = files.Where(file =>
|
||||
VideoTypes.Contains(file.Ext()) ||
|
||||
AudioTypes.Contains(file.Ext()) ||
|
||||
ImageTypes.Contains(file.Ext())).ToList();
|
||||
|
||||
List<string> files = GetMediaFiles(Directory.GetFiles(dir)).ToList();
|
||||
files.Sort(new StringLogicalComparer());
|
||||
int index = files.IndexOf(path);
|
||||
files.Remove(path);
|
||||
@@ -1319,6 +1327,13 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<string> GetMediaFiles(IEnumerable<string> files)
|
||||
{
|
||||
return files.Where(i => VideoTypes.Contains(i.Ext()) ||
|
||||
AudioTypes.Contains(i.Ext()) ||
|
||||
ImageTypes.Contains(i.Ext()));
|
||||
}
|
||||
|
||||
bool WasAviSynthLoaded;
|
||||
|
||||
void LoadAviSynth()
|
||||
|
||||
Reference in New Issue
Block a user