for URLs the media title is shown in the title bar

This commit is contained in:
Frank Skare
2019-10-01 01:19:01 +02:00
parent 8935101058
commit 68626fa536
5 changed files with 19 additions and 13 deletions

View File

@@ -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 - new: 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: 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 ### 5.4.1.1

View File

@@ -73,8 +73,8 @@ namespace mpvnet
{ {
if (RememberVolume) if (RememberVolume)
{ {
mp.set_property_int("volume", RegHelp.GetInt(App.RegPath, "Volume")); mp.set_property_int("volume", RegHelp.GetInt(App.RegPath, "Volume", 70));
mp.set_property_string("mute", RegHelp.GetString(App.RegPath, "Mute")); mp.set_property_string("mute", RegHelp.GetString(App.RegPath, "Mute", "no"));
} }
} }

View File

@@ -116,6 +116,10 @@ namespace mpvnet
string performer, title, album, genre, date, duration, text = ""; string performer, title, album, genre, date, duration, text = "";
long fileSize = 0; long fileSize = 0;
string path = mp.get_property_string("path"); 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 width = mp.get_property_int("video-params/w");
int height = mp.get_property_int("video-params/h"); int height = mp.get_property_int("video-params/h");

View File

@@ -111,25 +111,25 @@ namespace mpvnet
rk.SetValue(name, value); 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 ""; if (val == null || !(val is string)) return "";
return val.ToString(); 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; if (val == null || !(val is int)) return 0;
return (int)val; 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))) using (RegistryKey rk = GetRootKey(path).OpenSubKey(path.Substring(5)))
if (rk != null) if (rk != null)
return rk.GetValue(name, ""); return rk.GetValue(name, defaultValue);
else else
return null; return null;
} }

View File

@@ -381,7 +381,7 @@ namespace mpvnet
BeginInvoke(new Action(() => { BeginInvoke(new Action(() => {
if (path.Contains("://")) 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("\\\\")) else if (path.Contains(":\\") || path.StartsWith("\\\\"))
Text = path.FileName() + " - mpv.net " + Application.ProductVersion; Text = path.FileName() + " - mpv.net " + Application.ProductVersion;
else else