refactoring
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
- 'Tools > Execute mpv command' was removed,
|
||||
[mpv-repl](https://github.com/rossy/mpv-repl) is currently the best choice
|
||||
- many [wiki pages](https://github.com/stax76/mpv.net/wiki) were improved
|
||||
- the logo/icon had a very small cosmetic change
|
||||
- the help in the context menu was improved
|
||||
- config options specific to mpv.net are now available from the command line
|
||||
|
||||
### 5.0
|
||||
|
||||
|
||||
29
README.md
29
README.md
@@ -219,40 +219,31 @@ Third party components:
|
||||
|
||||
[Support thread in VideoHelp forum](https://forum.videohelp.com/threads/392514-mpv-net-a-extendable-media-player-for-windows)
|
||||
|
||||
[Issue tracker to report bugs and request features](https://github.com/stax76/mpv.net/issues)
|
||||
[Issue tracker, feel free to use for anything mpv.net related](https://github.com/stax76/mpv.net/issues)
|
||||
|
||||
[frank.skare.de@gmail.com](mailto:frank.skare.de@gmail.com?Subject=mpv.net%20support)
|
||||
|
||||
Please click on the star at the top of the page and like mpv.net at [alternativeto.net](https://alternativeto.net/software/mpv-net/).
|
||||
|
||||
If you like you can express your appreciation for my player by sending little beer money with paypal.
|
||||
If you want to support the development of mpv.net you can do so with a donation.
|
||||
|
||||
<https://www.paypal.me/stax76>
|
||||
|
||||
### Links
|
||||
|
||||
mpv manual: <https://mpv.io/manual/master/>
|
||||
|
||||
mpv wiki: <https://github.com/mpv-player/mpv/wiki>
|
||||
|
||||
mpv.net wiki: <https://github.com/stax76/mpv.net/wiki>
|
||||
|
||||
mpv apps: <https://github.com/mpv-player/mpv/wiki/Applications-using-mpv>
|
||||
|
||||
mpv user scripts: <https://github.com/mpv-player/mpv/wiki/User-Scripts>
|
||||
|
||||
mpv default key bindings: <https://github.com/mpv-player/mpv/blob/master/etc/input.conf>
|
||||
|
||||
mpv.net default key bindings: <https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt>
|
||||
|
||||
mpv download: <https://mpv.io/installation/>
|
||||
|
||||
mpv.net download: <https://github.com/stax76/mpv.net/releases>
|
||||
|
||||
mpv bugs and requests: <https://mpv.io/bug-reports/>
|
||||
|
||||
mpv.net bugs and requests: <https://github.com/stax76/mpv.net/issues>
|
||||
|
||||
mpv manual: <https://mpv.io/manual/master/>
|
||||
mpv wiki: <https://github.com/mpv-player/mpv/wiki>
|
||||
mpv apps: <https://github.com/mpv-player/mpv/wiki/Applications-using-mpv>
|
||||
mpv user scripts: <https://github.com/mpv-player/mpv/wiki/User-Scripts>
|
||||
mpv default key bindings: <https://github.com/mpv-player/mpv/blob/master/etc/input.conf>
|
||||
mpv download: <https://mpv.io/installation/>
|
||||
mpv bugs and requests: <https://mpv.io/bug-reports/>
|
||||
|
||||
### Changelog
|
||||
|
||||
[Changelog](Changelog.md)
|
||||
|
||||
@@ -84,50 +84,24 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
public static void ProcessProperty(string name, string value)
|
||||
public static bool ProcessProperty(string name, string value)
|
||||
{
|
||||
switch (name)
|
||||
switch (name) // return true instead of break!
|
||||
{
|
||||
case "remember-position": RememberPosition = value == "yes"; break;
|
||||
case "start-size": RememberHeight = value == "previous"; break;
|
||||
case "process-instance": ProcessInstance = value; break;
|
||||
case "dark-mode": DarkMode = value; break;
|
||||
case "debug-mode": DebugMode = value == "yes"; break;
|
||||
case "dark-color": DarkColor = value.Trim('\'', '"'); break;
|
||||
case "light-color": LightColor = value.Trim('\'', '"'); break;
|
||||
case "url-whitelist":
|
||||
UrlWhitelist = value.Split(' ', ',', ';');
|
||||
break;
|
||||
case "remember-position": RememberPosition = value == "yes"; return true;
|
||||
case "start-size": RememberHeight = value == "previous"; return true;
|
||||
case "process-instance": ProcessInstance = value; return true;
|
||||
case "dark-mode": DarkMode = value; return true;
|
||||
case "debug-mode": DebugMode = value == "yes"; return true;
|
||||
case "dark-color": DarkColor = value.Trim('\'', '"'); return true;
|
||||
case "light-color": LightColor = value.Trim('\'', '"'); return true;
|
||||
case "url-whitelist": UrlWhitelist = value.Split(' ', ',', ';'); return true;
|
||||
case "start-threshold":
|
||||
int.TryParse(value, out int result);
|
||||
StartThreshold = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ProcessCommandLineEarly()
|
||||
{
|
||||
var args = Environment.GetCommandLineArgs().Skip(1);
|
||||
|
||||
foreach (string i in args)
|
||||
{
|
||||
if (i.StartsWith("--"))
|
||||
{
|
||||
if (i.Contains("="))
|
||||
{
|
||||
string left = i.Substring(2, i.IndexOf("=") - 2);
|
||||
string right = i.Substring(left.Length + 3);
|
||||
mp.ProcessProperty(left, right);
|
||||
ProcessProperty(left, right);
|
||||
}
|
||||
else
|
||||
{
|
||||
string name = i.Substring(2);
|
||||
mp.ProcessProperty(name, "yes");
|
||||
ProcessProperty(name, "yes");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,13 +155,21 @@
|
||||
Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Toggle Hardware Decoding
|
||||
_ script-message mpv.net manage-file-associations #menu: Tools > Manage File Associations...
|
||||
|
||||
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > Show mpv manual
|
||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: Help > Show mpv default keys
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt #menu: Help > Show mpv.net default keys
|
||||
_ script-message mpv.net shell-execute https://mpv-net.github.io/mpv.net-web-site/ #menu: Help > Show mpv.net web site
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/Manual.md #menu: Help > Show mpv.net manual
|
||||
_ ignore #menu: Help > -
|
||||
_ script-message mpv.net show-about #menu: Help > About mpv.net
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/Manual.md #menu: Help > mpv.net Manual
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net #menu: Help > mpv.net GitHub
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/wiki #menu: Help > mpv.net Wiki
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net#support #menu: Help > mpv.net Support
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/releases #menu: Help > mpv.net Download
|
||||
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt #menu: Help > mpv.net Default Key Bindings
|
||||
_ ignore #menu: Help > -
|
||||
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > mpv Manual
|
||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/wiki #menu: Help > mpv Wiki
|
||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/wiki/User-Scripts #menu: Help > mpv User Scripts
|
||||
_ script-message mpv.net shell-execute https://mpv.io/bug-reports/ #menu: Help > mpv Bugs and Requests
|
||||
_ script-message mpv.net shell-execute https://mpv.io/installation/ #menu: Help > mpv Download
|
||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: Help > mpv Default Key Bindings
|
||||
_ ignore #menu: Help > -
|
||||
_ script-message mpv.net show-about #menu: Help > About mpv.net
|
||||
|
||||
_ ignore #menu: -
|
||||
Esc quit #menu: Exit
|
||||
|
||||
@@ -50,8 +50,6 @@ namespace mpvnet
|
||||
ContextMenu.Opened += ContextMenu_Opened;
|
||||
ContextMenu.Opening += ContextMenu_Opening;
|
||||
|
||||
App.ProcessCommandLineEarly();
|
||||
|
||||
if (mp.Screen == -1) mp.Screen = Array.IndexOf(Screen.AllScreens, Screen.PrimaryScreen);
|
||||
int targetIndex = mp.Screen;
|
||||
Screen[] screens = Screen.AllScreens;
|
||||
|
||||
@@ -104,6 +104,7 @@ namespace mpvnet
|
||||
set_property_string("input-media-keys", "yes");
|
||||
mpv_initialize(Handle);
|
||||
ShowLogo();
|
||||
LoadMpvScripts();
|
||||
ProcessCommandLine();
|
||||
Task.Run(() => { EventLoop(); });
|
||||
}
|
||||
@@ -213,6 +214,15 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadMpvScripts()
|
||||
{
|
||||
string[] startupScripts = Directory.GetFiles(Application.StartupPath + "\\Scripts");
|
||||
|
||||
foreach (string scriptPath in startupScripts)
|
||||
if (scriptPath.EndsWith(".lua") || scriptPath.EndsWith(".js"))
|
||||
commandv("load-script", $"{scriptPath}");
|
||||
}
|
||||
|
||||
public static void LoadScripts()
|
||||
{
|
||||
|
||||
@@ -220,10 +230,6 @@ namespace mpvnet
|
||||
{
|
||||
string[] startupScripts = Directory.GetFiles(Application.StartupPath + "\\Scripts");
|
||||
|
||||
foreach (string scriptPath in startupScripts)
|
||||
if (scriptPath.EndsWith(".lua") || scriptPath.EndsWith(".js"))
|
||||
commandv("load-script", $"{scriptPath}");
|
||||
|
||||
foreach (string scriptPath in startupScripts)
|
||||
if (Path.GetExtension(scriptPath) == ".py")
|
||||
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
|
||||
@@ -562,10 +568,17 @@ namespace mpvnet
|
||||
{
|
||||
string left = i.Substring(2, i.IndexOf("=") - 2);
|
||||
string right = i.Substring(left.Length + 3);
|
||||
set_property_string(left, right, true);
|
||||
mp.ProcessProperty(left, right);
|
||||
if (!App.ProcessProperty(left, right))
|
||||
set_property_string(left, right, true);
|
||||
}
|
||||
else
|
||||
set_property_string(i.Substring(2), "yes", true);
|
||||
{
|
||||
string name = i.Substring(2);
|
||||
mp.ProcessProperty(name, "yes");
|
||||
if (!App.ProcessProperty(name, "yes"))
|
||||
set_property_string(name, "yes", true);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user