Fix auto-load-folder not working with user scripts

This commit is contained in:
stax76
2022-05-22 14:35:43 +02:00
parent 4c3c65dded
commit e8baa21d42
3 changed files with 14 additions and 5 deletions

View File

@@ -8,7 +8,8 @@
is created with defaults for osc and console. is created with defaults for osc and console.
- Support mpv idle property, see manual for remarks. - Support mpv idle property, see manual for remarks.
- Fix crash choosing Matroska edition in the menu. - Fix crash choosing Matroska edition in the menu.
- Fix auto-play not working with user scripts. - Fix auto-play and auto-load-folder not working
with user scripts.
- Fix slow startup using osd-scale-by-window=no. - Fix slow startup using osd-scale-by-window=no.
- Fix chapter time display in menu. - Fix chapter time display in menu.
- libmpv shinchiro 2022-05-17 with idle fix - libmpv shinchiro 2022-05-17 with idle fix

View File

@@ -259,15 +259,19 @@ namespace mpvnet
else else
{ {
string clipboard = WinForms.Clipboard.GetText(); string clipboard = WinForms.Clipboard.GetText();
List<string> files = new List<string>();
if (string.IsNullOrEmpty(clipboard) || (!clipboard.Contains("://") && !File.Exists(clipboard)) || foreach (string i in clipboard.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
clipboard.Contains("\n")) if (i.Contains("://") || File.Exists(i))
files.Add(i);
if (files.Count == 0)
{ {
App.ShowError("The clipboard does not contain a valid URL or file."); App.ShowError("The clipboard does not contain a valid URL or file.");
return; return;
} }
Core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control)); Core.LoadFiles(files.ToArray(), false, Control.ModifierKeys.HasFlag(Keys.Control));
} }
}); });

View File

@@ -583,6 +583,7 @@ namespace mpvnet
break; break;
case mpv_event_id.MPV_EVENT_START_FILE: case mpv_event_id.MPV_EVENT_START_FILE:
InvokeEvent(StartFile, StartFileAsync); InvokeEvent(StartFile, StartFileAsync);
App.RunTask(() => LoadFolder());
break; break;
case mpv_event_id.MPV_EVENT_AUDIO_RECONFIG: case mpv_event_id.MPV_EVENT_AUDIO_RECONFIG:
InvokeEvent(AudioReconfig, AudioReconfigAsync); InvokeEvent(AudioReconfig, AudioReconfigAsync);
@@ -1225,7 +1226,10 @@ namespace mpvnet
string dir = Environment.CurrentDirectory; string dir = Environment.CurrentDirectory;
if (path.Contains(Path.DirectorySeparatorChar)) if (path.Contains(":/") && !path.Contains("://"))
path = path.Replace("/", "\\");
if (path.Contains("\\"))
dir = Path.GetDirectoryName(path); dir = Path.GetDirectoryName(path);
List<string> files = Directory.GetFiles(dir).ToList(); List<string> files = Directory.GetFiles(dir).ToList();