diff --git a/Changelog.md b/Changelog.md index ea917a3..a7298f4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ - Load AviSynth DLL from environment variable AviSynthDLL in order to support AviSynth portable mode. - New option global-media-keys (next, previous, play/pause, stop) +- libmpv shinshiro 2020-11-22 5.4.8.4 Beta diff --git a/extensions/RatingExtension/RatingExtension.cs b/extensions/RatingExtension/RatingExtension.cs index 2af2c41..808a8b6 100644 --- a/extensions/RatingExtension/RatingExtension.cs +++ b/extensions/RatingExtension/RatingExtension.cs @@ -96,7 +96,7 @@ namespace RatingExtension // the assembly name must end with 'Extension' { TimeSpan ts = DateTime.Now - DeleteTime; - if (FileToDelete == core.get_property_string("path") && ts.TotalSeconds < 5) + if (FileToDelete == core.get_property_string("path") && ts.TotalSeconds < 5 && File.Exists(FileToDelete)) { core.command("playlist-remove current"); Thread.Sleep(2000); diff --git a/mpv.net/DynamicGUI/Tommy.cs b/mpv.net/DynamicGUI/Tommy.cs index 9af7f11..d0e90d0 100644 --- a/mpv.net/DynamicGUI/Tommy.cs +++ b/mpv.net/DynamicGUI/Tommy.cs @@ -381,7 +381,8 @@ namespace Tommy public override TomlNode this[string key] { get { - if (RawTable.TryGetValue(key, out var result)) return result; + if (RawTable.TryGetValue(key, out var result)) + return result; var lazy = new TomlLazy(this); RawTable[key] = lazy; diff --git a/mpv.net/Resources/mpv.conf.txt b/mpv.net/Resources/mpv.conf.txt index a22a874..7237d22 100644 --- a/mpv.net/Resources/mpv.conf.txt +++ b/mpv.net/Resources/mpv.conf.txt @@ -6,7 +6,7 @@ keep-open = yes keep-open-pause = no osd-duration = 2000 osd-playing-msg = '${filename}' -script-opts = osc-scalewindowed=1.5,osc-hidetimeout=2000,console-scale=1 +script-opts = osc-scalewindowed=1.5,osc-hidetimeout=2000,osc-greenandgrumpy=yes,console-scale=1 screenshot-directory = '~~desktop/' [protocol.https] diff --git a/mpv.net/WPF/EverythingWindow.xaml.cs b/mpv.net/WPF/EverythingWindow.xaml.cs index 9516a2a..0e18dfd 100644 --- a/mpv.net/WPF/EverythingWindow.xaml.cs +++ b/mpv.net/WPF/EverythingWindow.xaml.cs @@ -120,29 +120,28 @@ namespace mpvnet object LockObject = new object(); - void Search(string searchtext) + void Search(string searchText) { lock (LockObject) { try { List items = new List(); - UInt32 i; - const int bufsize = 500; - StringBuilder buf = new StringBuilder(bufsize); - Everything_SetSearch(searchtext); + StringBuilder sb = new StringBuilder(500); + Everything_SetSearch(searchText); Everything_SetRequestFlags(EVERYTHING_REQUEST_FILE_NAME | EVERYTHING_REQUEST_PATH); Everything_Query(true); + uint count = Everything_GetNumResults(); - for (i = 0; i < Everything_GetNumResults(); i++) + for (uint i = 0; i < count; i++) { - Everything_GetResultFullPathName(i, buf, bufsize); - string ext = buf.ToString().Ext(); + Everything_GetResultFullPathName(i, sb, (uint)sb.Capacity); + string ext = sb.ToString().Ext(); if (App.AudioTypes.Contains(ext) || App.VideoTypes.Contains(ext) || App.ImageTypes.Contains(ext)) - items.Add(buf.ToString()); + items.Add(sb.ToString()); if (items.Count > 100) break; diff --git a/mpv.net/mpv/Core.cs b/mpv.net/mpv/Core.cs index d7d6afb..e0d72ae 100644 --- a/mpv.net/mpv/Core.cs +++ b/mpv.net/mpv/Core.cs @@ -800,6 +800,29 @@ namespace mpvnet HandleError(err, throwException, $"error setting property: {name} = " + value); } + public string get_opt(string name, string defaultValue = "") + { + string value = get_property_string("script-opts"); + + if (string.IsNullOrEmpty(value)) + return defaultValue; + + string[] values = value.Split(','); + + foreach (string item in values) + { + if (item.Contains("=")) + { + string optionName = item.Substring(0, item.IndexOf("=")); + + if (optionName == name) + return item.Substring(item.IndexOf("=") + 1); + } + } + + return defaultValue; + } + public void observe_property_int(string name, Action action) { lock (IntPropChangeActions)