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