command line processing was improved
This commit is contained in:
11
Changelog.md
11
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
|
||||
|
||||
|
||||
BIN
img/Avatar.png
BIN
img/Avatar.png
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -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")]
|
||||
|
||||
@@ -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">
|
||||
<Grid>
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock FontSize="48" HorizontalAlignment="Center" Margin="0,0,0,10">mpv.net</TextBlock>
|
||||
<TextBlock HorizontalAlignment="Center">Copyright (c) 2017-2019 Frank Skare (stax76)</TextBlock>
|
||||
<TextBlock Name="Version" HorizontalAlignment="Center" />
|
||||
<TextBlock Name="mpvVersion" HorizontalAlignment="Center" />
|
||||
<TextBlock HorizontalAlignment="Center" Margin="0,0,0,20">MIT License</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<string, Action<string>>(name, action));
|
||||
}
|
||||
|
||||
public static void ProcessCommandLine()
|
||||
public static void ProcessCommandLine(bool preInit)
|
||||
{
|
||||
var args = Environment.GetCommandLineArgs().Skip(1);
|
||||
List<string> files = new List<string>();
|
||||
|
||||
//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<string> files = new List<string>();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user