diff --git a/Changelog.md b/Changelog.md index 9f29caf..f5af873 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,9 +1,11 @@ -TODO: fix volume/mute being initialized muted - ### -- the [scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting#powershell) was improved -- Toggle Shuffle has been added to the menu defaults +- new: the [scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting#powershell) was improved +- new: Toggle Shuffle has been added to the menu defaults +- new: for URLs the media title is shown in the title bar and the info command + instead of displaying the URL +- fix: on the very first start volume was set to 0 and mute was set to yes, + now reasonable defaults are set, volume = 70, mute = no ### 5.4.1.1 diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index cff141c..2fffc82 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -73,8 +73,8 @@ namespace mpvnet { if (RememberVolume) { - mp.set_property_int("volume", RegHelp.GetInt(App.RegPath, "Volume")); - mp.set_property_string("mute", RegHelp.GetString(App.RegPath, "Mute")); + mp.set_property_int("volume", RegHelp.GetInt(App.RegPath, "Volume", 70)); + mp.set_property_string("mute", RegHelp.GetString(App.RegPath, "Mute", "no")); } } diff --git a/mpv.net/Misc/Command.cs b/mpv.net/Misc/Command.cs index 1f2b05e..48f5cd6 100644 --- a/mpv.net/Misc/Command.cs +++ b/mpv.net/Misc/Command.cs @@ -116,6 +116,10 @@ namespace mpvnet string performer, title, album, genre, date, duration, text = ""; long fileSize = 0; string path = mp.get_property_string("path"); + + if (path.Contains("://")) + path = mp.get_property_string("media-title"); + int width = mp.get_property_int("video-params/w"); int height = mp.get_property_int("video-params/h"); diff --git a/mpv.net/Misc/Misc.cs b/mpv.net/Misc/Misc.cs index 13f62d0..3e58380 100644 --- a/mpv.net/Misc/Misc.cs +++ b/mpv.net/Misc/Misc.cs @@ -111,25 +111,25 @@ namespace mpvnet rk.SetValue(name, value); } - public static string GetString(string path, string name) + public static string GetString(string path, string name, string defaultValue = "") { - object val = GetObject(path, name); + object val = GetObject(path, name, defaultValue); if (val == null || !(val is string)) return ""; return val.ToString(); } - public static int GetInt(string path, string name) + public static int GetInt(string path, string name, int defaultValue = 0) { - object val = GetObject(path, name); + object val = GetObject(path, name, defaultValue); if (val == null || !(val is int)) return 0; return (int)val; } - public static object GetObject(string path, string name) + public static object GetObject(string path, string name, object defaultValue = null) { using (RegistryKey rk = GetRootKey(path).OpenSubKey(path.Substring(5))) if (rk != null) - return rk.GetValue(name, ""); + return rk.GetValue(name, defaultValue); else return null; } diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index 676e042..39594db 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -381,7 +381,7 @@ namespace mpvnet BeginInvoke(new Action(() => { if (path.Contains("://")) - Text = path + " - mpv.net " + Application.ProductVersion; + Text = mp.get_property_string("media-title") + " - mpv.net " + Application.ProductVersion; else if (path.Contains(":\\") || path.StartsWith("\\\\")) Text = path.FileName() + " - mpv.net " + Application.ProductVersion; else