Compare commits

...

6 Commits
5.1 ... 5.2.1

Author SHA1 Message Date
Frank Skare
1447636eb7 fixed race condition causing various features to fail 2019-08-07 13:16:05 +02:00
Frank Skare
966f96a02b 5.2 Release 2019-08-06 18:44:40 +02:00
Frank Skare
954c014708 bug fix for logo not shown on start 2019-08-06 01:49:51 +02:00
Frank Skare
ad30dc5ae2 command line processing was improved 2019-08-05 03:06:40 +02:00
Frank Skare
3f74344b99 terminal screenshot 2019-08-01 20:29:43 +02:00
Frank Skare
96d8d88d09 readme update 2019-08-01 12:54:15 +02:00
15 changed files with 110 additions and 57 deletions

View File

@@ -1,3 +1,21 @@
### 5.2.1
- fixed race condition causing various features to fail
### 5.2
- bug fix for single-instance not working with unicode filenames
- 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
- libmpv was updated to shinchiro 2019-08-04
- in case mpv.net was started from a terminal it sets now the mpv property input-terminal to yes,
this means mpv.net will now receive and handle input keys from the terminal
- certain command line properties didn't 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
- the dialog that asks for a config folder has now a cancel option
### 5.1 ### 5.1
- 'Tools > Execute mpv command' was replaced with [mpv-repl](https://github.com/rossy/mpv-repl) - 'Tools > Execute mpv command' was replaced with [mpv-repl](https://github.com/rossy/mpv-repl)
@@ -12,7 +30,7 @@
- 'Tools > Manage File Associations' was replaced by 'Tools > OS Setup', - 'Tools > Manage File Associations' was replaced by 'Tools > OS Setup',
it has now a feature to add and remove mpv.net to and from the Path it has now a feature to add and remove mpv.net to and from the Path
environment variable and the OS default apps settings can be opened (Win 10 only) environment variable and the OS default apps settings can be opened (Win 10 only)
- startup folder and config folder beeing identical was causing a critical issue - startup folder and config folder being identical was causing a critical issue
as mpv.net was loading extensions twice and scripts four times, now identical as mpv.net was loading extensions twice and scripts four times, now identical
folders are no longer permitted folders are no longer permitted
- error messages are shown when unknown scripts and extensions are found in the startup folder - error messages are shown when unknown scripts and extensions are found in the startup folder

View File

@@ -63,6 +63,7 @@ Table of contents
- On Screen Controler (OSC, play control buttons) - On Screen Controler (OSC, play control buttons)
- [Command Line Interface](https://mpv.io/manual/master/#options) - [Command Line Interface](https://mpv.io/manual/master/#options)
- If started from a PowerShell terminal mpv.net will attach to the terminal and print status and debug output - If started from a PowerShell terminal mpv.net will attach to the terminal and print status and debug output
- [OSD REPL](https://github.com/rossy/mpv-repl)
- DXVA2 video decoding acceleration - DXVA2 video decoding acceleration
- OpenGL based video output capable of features loved by videophiles, such as video scaling with popular high quality algorithms, color management, frame timing, interpolation, HDR, and more - OpenGL based video output capable of features loved by videophiles, such as video scaling with popular high quality algorithms, color management, frame timing, interpolation, HDR, and more
- Search feature powered by [Everything](https://www.voidtools.com) to find and play media ([Screenshot](#media-search-screenshot)) - Search feature powered by [Everything](https://www.voidtools.com) to find and play media ([Screenshot](#media-search-screenshot))
@@ -100,6 +101,12 @@ A searchable config editor as alternative to edit the mpv.conf file manually.
![](https://raw.githubusercontent.com/stax76/mpv.net/master/img/ConfEditor.png) ![](https://raw.githubusercontent.com/stax76/mpv.net/master/img/ConfEditor.png)
#### Terminal and REPL Screenshot
mpv.net attached to a PowerShell terminal showing the [OSD REPL](https://github.com/rossy/mpv-repl).
![](https://raw.githubusercontent.com/stax76/mpv.net/master/img/Terminal.png)
#### Input Editor Screenshot #### Input Editor Screenshot
A searchable key and mouse binding editor. A searchable key and mouse binding editor.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/Terminal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -15,7 +15,7 @@ namespace mpvnet
public static string[] UrlWhitelist { get; set; } = { "tube", "vimeo", "ard", "zdf" }; public static string[] UrlWhitelist { get; set; } = { "tube", "vimeo", "ard", "zdf" };
public static string RegPath { get; } = @"HKCU\Software\" + Application.ProductName; public static string RegPath { get; } = @"HKCU\Software\" + Application.ProductName;
public static string ConfPath { get; } = mp.ConfigFolder + "\\mpvnet.conf"; public static string ConfPath { get => mp.ConfigFolder + "mpvnet.conf"; }
public static string DarkMode { get; set; } = "always"; public static string DarkMode { get; set; } = "always";
public static string ProcessInstance { get; set; } = "single"; public static string ProcessInstance { get; set; } = "single";
public static string DarkColor { get; set; } public static string DarkColor { get; set; }
@@ -49,7 +49,7 @@ namespace mpvnet
{ {
try try
{ {
string filePath = mp.ConfigFolder + "\\mpvnet-debug.log"; string filePath = mp.ConfigFolder + "mpvnet-debug.log";
if (File.Exists(filePath)) File.Delete(filePath); if (File.Exists(filePath)) File.Delete(filePath);
Trace.Listeners.Add(new TextWriterTraceListener(filePath)); Trace.Listeners.Add(new TextWriterTraceListener(filePath));
Trace.AutoFlush = true; Trace.AutoFlush = true;

View File

@@ -34,7 +34,7 @@ namespace mpvnet
} }
} }
dir = mp.ConfigFolder + "Extensions"; dir = mp.ConfigFolder + "extensions";
if (Directory.Exists(dir)) if (Directory.Exists(dir))
foreach (string i in Directory.GetDirectories(dir)) foreach (string i in Directory.GetDirectories(dir))

View File

@@ -18,6 +18,8 @@ namespace mpvnet
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
if (mp.ConfigFolder == "") return;
string[] args = Environment.GetCommandLineArgs().Skip(1).ToArray(); string[] args = Environment.GetCommandLineArgs().Skip(1).ToArray();
if (args.Length == 2 && args[0] == "--reg-file-assoc") if (args.Length == 2 && args[0] == "--reg-file-assoc")

View File

@@ -88,7 +88,7 @@ namespace mpvnet
{ {
public IntPtr dwData; public IntPtr dwData;
public int cbData; public int cbData;
[MarshalAs(UnmanagedType.LPStr)] [MarshalAs(UnmanagedType.LPTStr)]
public string lpData; public string lpData;
} }
} }

View File

@@ -359,7 +359,7 @@ public class TaskDialog<T> : TaskDialogNative, IDisposable
public void AddCommandLink(string text, T value) public void AddCommandLink(string text, T value)
{ {
int n = 1000 + IdValueDic.Count + 1; int n = 1000 + IdValueDic.Count + 1;
IdValueDic[n] = value == null ? (T)(object)text : value; IdValueDic[n] = value;
IdTextDic[n] = text; IdTextDic[n] = text;
Buttons.Add(new TaskDialogNative.TASKDIALOG_BUTTON(n, text)); Buttons.Add(new TaskDialogNative.TASKDIALOG_BUTTON(n, text));
Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_USE_COMMAND_LINKS; Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_USE_COMMAND_LINKS;

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.1.0.0")] [assembly: AssemblyVersion("5.2.1.0")]
[assembly: AssemblyFileVersion("5.1.0.0")] [assembly: AssemblyFileVersion("5.2.1.0")]

View File

@@ -23,7 +23,7 @@ options = [{ name = "no", help = "always use software decoding" },
name = "gpu-api" name = "gpu-api"
default = "auto" default = "auto"
filter = "Video" filter = "Video"
help = "Controls which type of graphics APIs will be accepted." help = "Controls which type of graphics APIs will be accepted. Auto uses d3d11, it should only be changed in case of problems."
options = [{ name = "auto", help = "Use any available API" }, options = [{ name = "auto", help = "Use any available API" },
{ name = "opengl", help = "Allow only OpenGL (requires OpenGL 2.1+ or GLES 2.0+)" }, { name = "opengl", help = "Allow only OpenGL (requires OpenGL 2.1+ or GLES 2.0+)" },
{ name = "vulkan", help = "Allow only Vulkan (requires a valid/working spirv-compiler)" }, { name = "vulkan", help = "Allow only Vulkan (requires a valid/working spirv-compiler)" },

View File

@@ -4,13 +4,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" 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"> WindowStartupLocation="CenterOwner" ResizeMode="NoResize">
<Grid> <Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontSize="48" HorizontalAlignment="Center" Margin="0,0,0,10">mpv.net</TextBlock> <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 HorizontalAlignment="Center">Copyright (c) 2017-2019 Frank Skare (stax76)</TextBlock>
<TextBlock Name="Version" HorizontalAlignment="Center" /> <TextBlock Name="Version" HorizontalAlignment="Center" />
<TextBlock Name="mpvVersion" HorizontalAlignment="Center" />
<TextBlock HorizontalAlignment="Center" Margin="0,0,0,20">MIT License</TextBlock> <TextBlock HorizontalAlignment="Center" Margin="0,0,0,20">MIT License</TextBlock>
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

@@ -1,4 +1,5 @@
using System.Windows; using System.IO;
using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
@@ -9,7 +10,8 @@ namespace mpvnet
public AboutWindow() public AboutWindow()
{ {
InitializeComponent(); 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(); protected override void OnPreviewKeyDown(KeyEventArgs e) => Close();

View File

@@ -507,10 +507,16 @@ namespace mpvnet
})); }));
} }
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (mp.get_property_int("playlist-count") == 0) mp.ShowLogo();
}
protected override void OnShown(EventArgs e) protected override void OnShown(EventArgs e)
{ {
base.OnShown(e); base.OnShown(e);
if (mp.GPUAPI == "vulkan") mp.ProcessCommandLine(); if (mp.GPUAPI == "vulkan") mp.ProcessCommandLine(false);
var wpfColor = WPF.WPF.ThemeColor; var wpfColor = WPF.WPF.ThemeColor;
Color color = Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B); Color color = Color.FromArgb(wpfColor.A, wpfColor.R, wpfColor.G, wpfColor.B);
ToolStripRendererEx.InitColors(color, App.IsDarkMode, App.ThemedMenu); ToolStripRendererEx.InitColors(color, App.IsDarkMode, App.ThemedMenu);

View File

@@ -70,8 +70,8 @@ namespace mpvnet
public static AutoResetEvent ShutdownAutoResetEvent { get; set; } = new AutoResetEvent(false); public static AutoResetEvent ShutdownAutoResetEvent { get; set; } = new AutoResetEvent(false);
public static AutoResetEvent VideoSizeAutoResetEvent { get; set; } = new AutoResetEvent(false); public static AutoResetEvent VideoSizeAutoResetEvent { get; set; } = new AutoResetEvent(false);
public static string InputConfPath { get; } = ConfigFolder + "\\input.conf"; public static string InputConfPath { get => ConfigFolder + "input.conf"; }
public static string ConfPath { get; } = ConfigFolder + "\\mpv.conf"; public static string ConfPath { get => ConfigFolder + "mpv.conf"; }
public static string Sid { get; set; } = ""; public static string Sid { get; set; } = "";
public static string Aid { get; set; } = ""; public static string Aid { get; set; } = "";
public static string Vid { get; set; } = ""; public static string Vid { get; set; } = "";
@@ -98,6 +98,7 @@ namespace mpvnet
if (App.IsStartedFromTerminal) if (App.IsStartedFromTerminal)
{ {
set_property_string("terminal", "yes"); set_property_string("terminal", "yes");
set_property_string("input-terminal", "yes");
set_property_string("msg-level", "osd/libass=fatal"); set_property_string("msg-level", "osd/libass=fatal");
} }
@@ -108,11 +109,11 @@ namespace mpvnet
set_property_string("config-dir", ConfigFolder); set_property_string("config-dir", ConfigFolder);
set_property_string("config", "yes"); set_property_string("config", "yes");
ProcessCommandLine(true);
mpv_initialize(Handle); mpv_initialize(Handle);
Initialized?.Invoke(); Initialized?.Invoke();
ShowLogo();
LoadMpvScripts(); LoadMpvScripts();
if (GPUAPI != "vulkan") ProcessCommandLine(); if (GPUAPI != "vulkan") ProcessCommandLine(false);
} }
public static void ProcessProperty(string name, string value) public static void ProcessProperty(string name, string value)
@@ -165,10 +166,15 @@ namespace mpvnet
td.AddCommandLink(@"AppData\Roaming\mpv", appdataFolderMpv, appdataFolderMpv); td.AddCommandLink(@"AppData\Roaming\mpv", appdataFolderMpv, appdataFolderMpv);
td.AddCommandLink("<startup>\\portable_config", portableFolder, portableFolder); td.AddCommandLink("<startup>\\portable_config", portableFolder, portableFolder);
td.AddCommandLink("Choose custom folder", "custom"); td.AddCommandLink("Choose custom folder", "custom");
td.AllowCancel = false;
_ConfigFolder = td.Show(); _ConfigFolder = td.Show();
} }
if (_ConfigFolder == null)
{
_ConfigFolder = "";
return "";
}
if (_ConfigFolder == "custom") if (_ConfigFolder == "custom")
{ {
using (var d = new WinForms.FolderBrowserDialog()) using (var d = new WinForms.FolderBrowserDialog())
@@ -195,14 +201,14 @@ namespace mpvnet
if (!_ConfigFolder.Contains("portable_config")) if (!_ConfigFolder.Contains("portable_config"))
RegHelp.SetObject(App.RegPath, "ConfigFolder", _ConfigFolder); RegHelp.SetObject(App.RegPath, "ConfigFolder", _ConfigFolder);
if (!File.Exists(_ConfigFolder + "\\input.conf")) if (!File.Exists(_ConfigFolder + "input.conf"))
File.WriteAllText(_ConfigFolder + "\\input.conf", Properties.Resources.inputConf); File.WriteAllText(_ConfigFolder + "input.conf", Properties.Resources.inputConf);
if (!File.Exists(_ConfigFolder + "\\mpv.conf")) if (!File.Exists(_ConfigFolder + "mpv.conf"))
File.WriteAllText(_ConfigFolder + "\\mpv.conf", Properties.Resources.mpvConf); File.WriteAllText(_ConfigFolder + "mpv.conf", Properties.Resources.mpvConf);
if (!File.Exists(_ConfigFolder + "\\mpvnet.conf")) if (!File.Exists(_ConfigFolder + "mpvnet.conf"))
File.WriteAllText(_ConfigFolder + "\\mpvnet.conf", Properties.Resources.mpvNetConf); File.WriteAllText(_ConfigFolder + "mpvnet.conf", Properties.Resources.mpvNetConf);
} }
return _ConfigFolder; return _ConfigFolder;
} }
@@ -260,8 +266,8 @@ namespace mpvnet
} }
} }
if (Directory.Exists(ConfigFolder + "Scripts")) if (Directory.Exists(ConfigFolder + "scripts"))
foreach (string scriptPath in Directory.GetFiles(ConfigFolder + "Scripts")) foreach (string scriptPath in Directory.GetFiles(ConfigFolder + "scripts"))
if (scriptPath.EndsWith(".py")) if (scriptPath.EndsWith(".py"))
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath))); PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
else if (scriptPath.EndsWith(".ps1")) else if (scriptPath.EndsWith(".ps1"))
@@ -565,9 +571,51 @@ namespace mpvnet
StringPropChangeActions.Add(new KeyValuePair<string, Action<string>>(name, action)); 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); var args = Environment.GetCommandLineArgs().Skip(1);
//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)
{
string arg = i;
if (arg.StartsWith("--"))
{
try
{
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))
{
mp.ProcessProperty(left, right);
if (!App.ProcessProperty(left, right))
set_property_string(left, right, true);
}
else if (!preInit && !preInitProperties.Contains(left))
{
mp.ProcessProperty(left, right);
if (!App.ProcessProperty(left, right))
set_property_string(left, right, true);
}
}
catch (Exception e)
{
Msg.ShowException(e);
}
}
}
if (!preInit)
{
List<string> files = new List<string>(); List<string> files = new List<string>();
foreach (string i in args) foreach (string i in args)
@@ -579,35 +627,6 @@ namespace mpvnet
} }
} }
foreach (string i in args)
{
if (i.StartsWith("--"))
{
try
{
if (i.Contains("="))
{
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
{
string name = i.Substring(2);
mp.ProcessProperty(name, "yes");
if (!App.ProcessProperty(name, "yes"))
set_property_string(name, "yes", true);
}
}
catch (Exception e)
{
Msg.ShowException(e);
}
}
}
Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control)); Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control));
if (files.Count == 0 || files[0].Contains("://")) if (files.Count == 0 || files[0].Contains("://"))
@@ -616,6 +635,7 @@ namespace mpvnet
VideoSizeChanged?.Invoke(); VideoSizeChanged?.Invoke();
} }
} }
}
public static DateTime LastLoad; public static DateTime LastLoad;
@@ -714,11 +734,8 @@ namespace mpvnet
if (File.Exists(LastHistoryPath) && totalMinutes > 1) if (File.Exists(LastHistoryPath) && totalMinutes > 1)
{ {
string historyFilepath = ConfigFolder + "history.txt"; File.AppendAllText(ConfigFolder + "history.txt", DateTime.Now.ToString().Substring(0, 16) +
" " + totalMinutes.ToString().PadLeft(3) + " " + Path.GetFileNameWithoutExtension(LastHistoryPath) + "\r\n");
File.AppendAllText(historyFilepath, DateTime.Now.ToString().Substring(0, 16) +
" " + totalMinutes.ToString().PadLeft(3) + " " +
Path.GetFileNameWithoutExtension(LastHistoryPath) + "\r\n");
} }
LastHistoryPath = path; LastHistoryPath = path;