diff --git a/Changelog.md b/Changelog.md index cb6c266..cf8e106 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,8 +1,15 @@ ### - bug fix for single-instance not working with unicode filenames -- bug fix for logo not shown -- bug fix osd-visibility.js script causing memory leak +- bug fix for logo not shown on start +- osd-visibility.js script was removed because the OSC uses too much memory +- youtube-dl was updated +- in case mpv.net is started from a terminal it sets now the mpv property input-terminal to yes, + this means mpv.net will now receive input keys from the terminal +- command line processing was improved, certain properties didn't work, now they should work: + (input-terminal, terminal, input-file, config, config-dir, input-conf, + load-scripts, script, scripts, player-operation-mode) +- the about dialog shows now the mpv version and build date ### 5.1 diff --git a/img/Avatar.png b/img/Avatar.png index 7b26fef..98ad90c 100644 Binary files a/img/Avatar.png and b/img/Avatar.png differ diff --git a/mpv.net/Properties/AssemblyInfo.cs b/mpv.net/Properties/AssemblyInfo.cs index 25c4b19..21c4123 100644 --- a/mpv.net/Properties/AssemblyInfo.cs +++ b/mpv.net/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("5.1.0.0")] -[assembly: AssemblyFileVersion("5.1.0.0")] +[assembly: AssemblyVersion("5.1.0.1")] +[assembly: AssemblyFileVersion("5.1.0.1")] diff --git a/mpv.net/WPF/AboutWindow.xaml b/mpv.net/WPF/AboutWindow.xaml index ed640ec..c316cf8 100644 --- a/mpv.net/WPF/AboutWindow.xaml +++ b/mpv.net/WPF/AboutWindow.xaml @@ -4,13 +4,14 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - Title="About mpv.net" Height="230" Width="420" FontSize="16" ShowInTaskbar="False" + Title="About mpv.net" Height="230" Width="500" FontSize="16" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" ResizeMode="NoResize"> mpv.net Copyright (c) 2017-2019 Frank Skare (stax76) + MIT License diff --git a/mpv.net/WPF/AboutWindow.xaml.cs b/mpv.net/WPF/AboutWindow.xaml.cs index b79c910..b3ba7ae 100644 --- a/mpv.net/WPF/AboutWindow.xaml.cs +++ b/mpv.net/WPF/AboutWindow.xaml.cs @@ -1,4 +1,5 @@ -using System.Windows; +using System.IO; +using System.Windows; using System.Windows.Input; using System.Windows.Media; @@ -9,7 +10,8 @@ namespace mpvnet public AboutWindow() { InitializeComponent(); - Version.Text = $"Version {System.Windows.Forms.Application.ProductVersion}"; + Version.Text = $"mpv.net Version {System.Windows.Forms.Application.ProductVersion}"; + mpvVersion.Text = $"{mp.get_property_string("mpv-version")} ({File.GetLastWriteTime(PathHelp.StartupPath + "mpv-1.dll").ToShortDateString()})"; } protected override void OnPreviewKeyDown(KeyEventArgs e) => Close(); diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index 0eeac4d..4db0ef6 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -511,7 +511,7 @@ namespace mpvnet protected override void OnShown(EventArgs e) { base.OnShown(e); - if (mp.GPUAPI == "vulkan") mp.ProcessCommandLine(); + if (mp.GPUAPI == "vulkan") mp.ProcessCommandLine(false); var wpfColor = WPF.WPF.ThemeColor; Color color = Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B); ToolStripRendererEx.InitColors(color, App.IsDarkMode, App.ThemedMenu); diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 4fb89d7..3d472e9 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -98,6 +98,7 @@ namespace mpvnet if (App.IsStartedFromTerminal) { set_property_string("terminal", "yes"); + set_property_string("input-terminal", "yes"); set_property_string("msg-level", "osd/libass=fatal"); } @@ -108,10 +109,11 @@ namespace mpvnet set_property_string("config-dir", ConfigFolder); set_property_string("config", "yes"); + ProcessCommandLine(true); mpv_initialize(Handle); Initialized?.Invoke(); LoadMpvScripts(); - if (GPUAPI != "vulkan") ProcessCommandLine(); + if (GPUAPI != "vulkan") ProcessCommandLine(false); } public static void ProcessProperty(string name, string value) @@ -564,40 +566,40 @@ namespace mpvnet StringPropChangeActions.Add(new KeyValuePair>(name, action)); } - public static void ProcessCommandLine() + public static void ProcessCommandLine(bool preInit) { var args = Environment.GetCommandLineArgs().Skip(1); - List files = new List(); + + //Msg.Show(string.Join("\n", args)); + + string[] preInitProperties = { "input-terminal", "terminal", "input-file", "config", "config-dir", "input-conf", "load-scripts", "scripts", "player-operation-mode" }; foreach (string i in args) { - if (!i.StartsWith("--") && (i == "-" || i.Contains("://") || File.Exists(i))) - { - files.Add(i); - if (i.Contains("://")) RegHelp.SetObject(App.RegPath, "LastURL", i); - } - } + string arg = i; - foreach (string i in args) - { - if (i.StartsWith("--")) + if (arg.StartsWith("--")) { try { - if (i.Contains("=")) + if (!arg.Contains("=")) arg += "=yes"; + + string left = arg.Substring(2, arg.IndexOf("=") - 2); + string right = arg.Substring(left.Length + 3); + + if (left == "script") left = "scripts"; + + if (preInit && preInitProperties.Contains(left)) { - string left = i.Substring(2, i.IndexOf("=") - 2); - string right = i.Substring(left.Length + 3); mp.ProcessProperty(left, right); if (!App.ProcessProperty(left, right)) set_property_string(left, right, true); } - else + else if (!preInit && !preInitProperties.Contains(left)) { - string name = i.Substring(2); - mp.ProcessProperty(name, "yes"); - if (!App.ProcessProperty(name, "yes")) - set_property_string(name, "yes", true); + mp.ProcessProperty(left, right); + if (!App.ProcessProperty(left, right)) + set_property_string(left, right, true); } } catch (Exception e) @@ -607,12 +609,26 @@ namespace mpvnet } } - Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control)); - - if (files.Count == 0 || files[0].Contains("://")) + if (!preInit) { - VideoSizeAutoResetEvent.Set(); - VideoSizeChanged?.Invoke(); + List files = new List(); + + foreach (string i in args) + { + if (!i.StartsWith("--") && (i == "-" || i.Contains("://") || File.Exists(i))) + { + files.Add(i); + if (i.Contains("://")) RegHelp.SetObject(App.RegPath, "LastURL", i); + } + } + + Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control)); + + if (files.Count == 0 || files[0].Contains("://")) + { + VideoSizeAutoResetEvent.Set(); + VideoSizeChanged?.Invoke(); + } } }