diff --git a/docs/Changelog.md b/docs/Changelog.md
index d0a6fdf..b94fe45 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -1,5 +1,5 @@
-5.4.8.8 Beta (2021-03-??)
+5.4.8.8 Beta (not yet released)
=========================
- Improved window scaling.
@@ -7,6 +7,9 @@
- Command palette shows commands without assigned menu item.
- The code from the included JavaScript file was ported into the core player
because JavaScript is currently broken in the builds of shinshiro.
+- New option `--command=`, can be used in combination
+ with `process-instance=single` to control mpv.net via command line,
+ for instance to create global hotkeys with AutoHotkey.
- MediaInfo 21.3
- libmpv shinchiro 2021-04-04
diff --git a/docs/Manual.md b/docs/Manual.md
index 64523c2..831c010 100644
--- a/docs/Manual.md
+++ b/docs/Manual.md
@@ -172,20 +172,31 @@ A common task for the terminal is debugging scripts.
mpv.net specific options
------------------------
-All mpv.net specific options can be found in the conf editor searching for 'mpv.net'.
+mpv.net specific options can be found in the conf editor searching for 'mpv.net'.
The options are saved in the mpvnet.conf file.
-## Audio
+#### --queue
-### --remember-volume=\
+Adds files to the playlist, requires [--process-instance=single](#--process-instancevalue).
+[Open with++](#open-with) can be used to add files to the playlist using File Explorer.
+
+#### --command=
+
+Sends a input commands. Useful to control mpv.net from the command line, for instance
+to create global hotkeys with AutoHotkey, for that [process-instance=single](#--process-instancevalue)
+must be used. Spaces have to be escaped with quotes and quotes have to be escaped with double quotes.
+
+### Audio
+
+#### --remember-volume=\
Save volume and mute on exit and restore it on start. Default: yes
-## Screen
+### Screen
-### --start-size=\
+#### --start-size=\
Setting to remember the window height.
@@ -199,48 +210,48 @@ Window size is remembered but only in the current session. Default
Window size is always remembered.
-### --start-threshold=\
+#### --start-threshold=\
Threshold in milliseconds to wait for libmpv returning the video
resolution before the window is shown, otherwise default dimensions
are used as defined by autofit and start-size. Default: 1500
-### --minimum-aspect-ratio=\
+#### --minimum-aspect-ratio=\
Minimum aspect ratio, if the AR is smaller than the defined value then
the window AR is set to 16/9. This avoids a square window for Music
with cover art. Default: 1.2
-### --remember-position=\
+#### --remember-position=\
Save the window position on exit. Default: no
-## Playback
+### Playback
-### --auto-load-folder=\
+#### --auto-load-folder=\
For single files automatically load the entire directory into the playlist.
Can be suppressed via shift key. Default: yes
-## Input
+### Input
-### --global-media-keys=\
+#### --global-media-keys=\
Enable global media keys next track, previous track, play/pause, stop. Default: no
-## General
+### General
-### --update-check=\
+#### --update-check=\
Daily check for new version. (requires PowerShell 5 and curl.) Default: no
-### --process-instance=\
+#### --process-instance=\
Defines if more then one mpv.net process is allowed.
@@ -258,34 +269,34 @@ Force a single process everytime the shell starts mpv.net. Default
Force a single process and add files to playlist.
-### --recent-count=\
+#### --recent-count=\
Amount of recent files to be remembered. Default: 15
-### --video-file-extensions=\
+#### --video-file-extensions=\
Video file extensions used to create file associations and used by the auto-load-folder feature.
-### --audio-file-extensions=\
+#### --audio-file-extensions=\
Audio file extensions used to create file associations and used by the auto-load-folder feature.
-### --image-file-extensions=\
+#### --image-file-extensions=\
Image file extensions used to create file associations and used by the auto-load-folder feature.
-### --debug-mode=\
+#### --debug-mode=\
Enable this only when a developer asks for it. Default: no
-## UI
+### UI
-### --dark-mode=\
+#### --dark-mode=\
Enables a dark theme.
@@ -298,14 +309,14 @@ Available on Windows 10 or higher.
**never**
-### ---dark-theme=\
+#### ---dark-theme=\
Color theme used in dark mode. Default: dark
[Color Themes](#color-theme)
-### --light-theme=\
+#### --light-theme=\
Color theme used in light mode. Default: light
@@ -436,8 +447,8 @@ its complete internals, there are no compatibility guaranties.
extensions are like scripts located in your config folder, example:
`\extensions\ExampleExtension\ExampleExtension.dll`
- Also in the project properties choose the option **Start external program**
- in the Debug tab and define the path to mpvnet.exe. In the Debug tab you may
- also define command line arguments like a video file to be played when you start debugging.
+ in the Debug tab and define the path to mpvnet.exe. In the Debug tab you may also
+ define command line arguments like a video file to be played when you start debugging.
### Sample Code
@@ -541,14 +552,25 @@ mpv.net has currently implemented the following window features:
### Command Line Limitations
-mpv.net supports only property switches, it does not support non property switches.
+mpv.net supports only property switches, non property switches cannot be accessed
+from libmpv and therefore need a implementation in mpv.net, implemented so far are:
+
+--ad=help
+--audio-device=help
+--input-keylist
+--profile=help
+--vd=help
+--version
### mpv.net specific options
-Options that are specific to mpv.net can be found by entering _mpv.net_ in the search field of the config editor.
+Options that are specific to mpv.net can be found by entering _mpv.net_
+in the search field of the config editor, in the manual they are documented
+[here](#mpvnet-specific-options).
-mpv.net specific options are saved in the file mpvnet.conf and are just as mpv properties available on the command line.
+mpv.net specific options are saved in the file mpvnet.conf and are just
+as mpv properties available on the command line.
Technical Overview
@@ -942,7 +964,7 @@ Cycles the deinterlace property using the following command:
Cycles the aspect ratio using the following command:
-`cycle-values video-aspect "16:9" "4:3" "2.35:1" "-1"`
+`cycle-values video-aspect 16:9 4:3 2.35:1 -1`
[cycle-values command](https://mpv.io/manual/master/#command-interface-cycle-values)
diff --git a/src/Misc/Program.cs b/src/Misc/Program.cs
index 677c070..eb706ac 100644
--- a/src/Misc/Program.cs
+++ b/src/Misc/Program.cs
@@ -47,17 +47,22 @@ namespace mpvnet
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
{
- List files = new List();
- files.Add(App.ProcessInstance);
+ List args2 = new List();
+ args2.Add(App.ProcessInstance);
foreach (string arg in args)
{
if (!arg.StartsWith("--") && (arg == "-" || arg.Contains("://") ||
arg.Contains(":\\") || arg.StartsWith("\\\\")))
- files.Add(arg);
+ args2.Add(arg);
else if (arg == "--queue")
- files[0] = "queue";
+ args2[0] = "queue";
+ else if (arg.StartsWith("--command="))
+ {
+ args2[0] = "command";
+ args2.Add(arg.Substring(10));
+ }
}
Process[] procs = Process.GetProcessesByName("mpvnet");
@@ -70,7 +75,7 @@ namespace mpvnet
{
WinAPI.AllowSetForegroundWindow(proc.Id);
var data = new WinAPI.COPYDATASTRUCT();
- data.lpData = string.Join("\n", files.ToArray());
+ data.lpData = string.Join("\n", args2.ToArray());
data.cbData = data.lpData.Length * 2 + 1;
WinAPI.SendMessage(proc.MainWindowHandle, 0x004A /*WM_COPYDATA*/, IntPtr.Zero, ref data);
mutex.Dispose();
diff --git a/src/Release.ps1 b/src/Release.ps1
index 2e20da3..5c35085 100644
--- a/src/Release.ps1
+++ b/src/Release.ps1
@@ -1,6 +1,6 @@
$tmpDir = 'D:\Work'
-$exePath = $PSScriptRoot + '\mpv.net\bin\mpvnet.exe'
+$exePath = $PSScriptRoot + '\bin\mpvnet.exe'
$versionInfo = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath)
$inno = 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe'
$7z = 'C:\Program Files\7-Zip\7z.exe'
@@ -8,7 +8,7 @@ $7z = 'C:\Program Files\7-Zip\7z.exe'
$cloudDirectories = 'C:\Users\frank\OneDrive\Public\mpv.net\',
'C:\Users\frank\Dropbox\Public\mpv.net\'
-cd $PSScriptRoot
+# cd $PSScriptRoot
function UploadBeta($sourceFile)
{
@@ -32,11 +32,11 @@ function UploadBeta($sourceFile)
if ($versionInfo.FilePrivatePart -eq 0)
{
- & $inno setup.iss
+ & $inno $PSScriptRoot\setup.iss
if ($LastExitCode) { throw $LastExitCode }
$targetDir = $tmpDir + "\mpv.net-$($versionInfo.FileVersion)-portable"
- Copy-Item .\mpv.net\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
+ Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
& $7z a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"
if ($LastExitCode) { throw $LastExitCode }
@@ -47,7 +47,7 @@ if ($versionInfo.FilePrivatePart -eq 0)
else
{
$targetDir = "$tmpDir\mpv.net-$($versionInfo.FileVersion)-portable-beta"
- Copy-Item .\mpv.net\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
+ Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
& $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*"
if ($LastExitCode) { throw $LastExitCode }
UploadBeta "$targetDir.7z"
diff --git a/src/Resources/input.conf.txt b/src/Resources/input.conf.txt
index ec59b0a..33eb150 100644
--- a/src/Resources/input.conf.txt
+++ b/src/Resources/input.conf.txt
@@ -96,7 +96,7 @@
_ ignore #menu: Video > -
Ctrl+s async screenshot #menu: Video > Take Screenshot
d cycle deinterlace #menu: Video > Toggle Deinterlace
- a cycle-values video-aspect "16:9" "4:3" "2.35:1" "-1" #menu: Video > Cycle Aspect Ratio
+ a cycle-values video-aspect 16:9 4:3 2.35:1 -1 #menu: Video > Cycle Aspect Ratio
KP7 script-message mpv.net cycle-audio #menu: Audio > Cycle/Next
_ ignore #menu: Audio > -
@@ -163,9 +163,9 @@
F1 script-message mpv.net show-command-palette #menu: Tools > Show All Commands
h script-message mpv.net show-history #menu: Tools > Show History
l ab-loop #menu: Tools > Set/clear A-B loop points
- L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping
+ L cycle-values loop-file inf no #menu: Tools > Toggle infinite file looping
_ playlist-shuffle #menu: Tools > Shuffle Playlist
- Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Toggle Hardware Decoding
+ Ctrl+h cycle-values hwdec auto no #menu: Tools > Toggle Hardware Decoding
_ script-message mpv.net show-setup-dialog #menu: Tools > Setup...
_ script-message mpv.net shell-execute https://mpv.io #menu: Help > Website mpv
diff --git a/src/Setup.iss b/src/Setup.iss
index 005c971..fff5598 100644
--- a/src/Setup.iss
+++ b/src/Setup.iss
@@ -1,8 +1,8 @@
#define MyAppName "mpv.net"
#define MyAppExeName "mpvnet.exe"
-#define MyAppSourceDir "mpv.net\bin"
-#define MyAppVersion GetFileVersion("mpv.net\bin\mpvnet.exe")
+#define MyAppSourceDir "bin"
+#define MyAppVersion GetFileVersion("bin\mpvnet.exe")
[Setup]
AppId={{9AA2B100-BEF3-44D0-B819-D8FC3C4D557D}}
@@ -13,9 +13,9 @@ ArchitecturesInstallIn64BitMode=x64
Compression=lzma2
DefaultDirName={commonpf}\{#MyAppName}
OutputBaseFilename=mpv.net-{#MyAppVersion}-setup
-OutputDir={#GetEnv('USERPROFILE')}\Desktop
+OutputDir=D:\Work
DefaultGroupName={#MyAppName}
-SetupIconFile=mpv.net\mpvnet.ico
+SetupIconFile=mpvnet.ico
UninstallDisplayIcon={app}\{#MyAppExeName}
[Icons]
diff --git a/src/WinForms/MainForm.cs b/src/WinForms/MainForm.cs
index ee50bf5..c40f9b8 100644
--- a/src/WinForms/MainForm.cs
+++ b/src/WinForms/MainForm.cs
@@ -687,19 +687,22 @@ namespace mpvnet
case 0x004A: // WM_COPYDATA
{
var copyData = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));
- string[] files = copyData.lpData.Split('\n');
- string mode = files[0];
- files = files.Skip(1).ToArray();
+ string[] args = copyData.lpData.Split('\n');
+ string mode = args[0];
+ args = args.Skip(1).ToArray();
switch (mode)
{
case "single":
- core.LoadFiles(files, true, Control.ModifierKeys.HasFlag(Keys.Control));
+ core.LoadFiles(args, true, ModifierKeys.HasFlag(Keys.Control));
break;
case "queue":
- foreach (string file in files)
+ foreach (string file in args)
core.commandv("loadfile", file, "append");
break;
+ case "command":
+ core.command(args[0]);
+ break;
}
Activate();
diff --git a/src/mpv/Core.cs b/src/mpv/Core.cs
index 3c1d8ea..821f67e 100644
--- a/src/mpv/Core.cs
+++ b/src/mpv/Core.cs
@@ -998,6 +998,11 @@ namespace mpvnet
Console.WriteLine(core.get_property_string("input-key-list").Replace(",", BR));
continue;
}
+ else if (arg.StartsWith("--command="))
+ {
+ core.command(arg.Substring(10));
+ continue;
+ }
}
if (!arg.StartsWith("--"))