option --command to send input commands
This commit is contained in:
@@ -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=<input 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
|
||||
|
||||
|
||||
@@ -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 <files>
|
||||
|
||||
### --remember-volume=\<yes|no\>
|
||||
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=<input 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=\<yes|no\>
|
||||
|
||||
Save volume and mute on exit and restore it on start. Default: yes
|
||||
|
||||
|
||||
## Screen
|
||||
### Screen
|
||||
|
||||
### --start-size=\<value\>
|
||||
#### --start-size=\<value\>
|
||||
|
||||
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=\<milliseconds\>
|
||||
#### --start-threshold=\<milliseconds\>
|
||||
|
||||
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=\<float\>
|
||||
#### --minimum-aspect-ratio=\<float\>
|
||||
|
||||
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=\<yes|no\>
|
||||
#### --remember-position=\<yes|no\>
|
||||
|
||||
Save the window position on exit. Default: no
|
||||
|
||||
|
||||
## Playback
|
||||
### Playback
|
||||
|
||||
### --auto-load-folder=\<yes|no\>
|
||||
#### --auto-load-folder=\<yes|no\>
|
||||
|
||||
For single files automatically load the entire directory into the playlist.
|
||||
Can be suppressed via shift key. Default: yes
|
||||
|
||||
|
||||
## Input
|
||||
### Input
|
||||
|
||||
### --global-media-keys=\<yes|no\>
|
||||
#### --global-media-keys=\<yes|no\>
|
||||
|
||||
Enable global media keys next track, previous track, play/pause, stop. Default: no
|
||||
|
||||
|
||||
## General
|
||||
### General
|
||||
|
||||
### --update-check=\<yes|no\>
|
||||
#### --update-check=\<yes|no\>
|
||||
|
||||
Daily check for new version. (requires PowerShell 5 and curl.) Default: no
|
||||
|
||||
|
||||
### --process-instance=\<value\>
|
||||
#### --process-instance=\<value\>
|
||||
|
||||
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=\<int\>
|
||||
#### --recent-count=\<int\>
|
||||
|
||||
Amount of recent files to be remembered. Default: 15
|
||||
|
||||
|
||||
### --video-file-extensions=\<string\>
|
||||
#### --video-file-extensions=\<string\>
|
||||
|
||||
Video file extensions used to create file associations and used by the auto-load-folder feature.
|
||||
|
||||
|
||||
### --audio-file-extensions=\<string\>
|
||||
#### --audio-file-extensions=\<string\>
|
||||
|
||||
Audio file extensions used to create file associations and used by the auto-load-folder feature.
|
||||
|
||||
|
||||
### --image-file-extensions=\<string\>
|
||||
#### --image-file-extensions=\<string\>
|
||||
|
||||
Image file extensions used to create file associations and used by the auto-load-folder feature.
|
||||
|
||||
|
||||
### --debug-mode=\<yes|no\>
|
||||
#### --debug-mode=\<yes|no\>
|
||||
|
||||
Enable this only when a developer asks for it. Default: no
|
||||
|
||||
|
||||
## UI
|
||||
### UI
|
||||
|
||||
### --dark-mode=\<value\>
|
||||
#### --dark-mode=\<value\>
|
||||
|
||||
Enables a dark theme.
|
||||
|
||||
@@ -298,14 +309,14 @@ Available on Windows 10 or higher.
|
||||
**never**
|
||||
|
||||
|
||||
### ---dark-theme=\<string\>
|
||||
#### ---dark-theme=\<string\>
|
||||
|
||||
Color theme used in dark mode. Default: dark
|
||||
|
||||
[Color Themes](#color-theme)
|
||||
|
||||
|
||||
### --light-theme=\<string\>
|
||||
#### --light-theme=\<string\>
|
||||
|
||||
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:
|
||||
`<config folder>\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)
|
||||
|
||||
|
||||
@@ -47,17 +47,22 @@ namespace mpvnet
|
||||
|
||||
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
|
||||
{
|
||||
List<string> files = new List<string>();
|
||||
files.Add(App.ProcessInstance);
|
||||
List<string> args2 = new List<string>();
|
||||
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();
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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("--"))
|
||||
|
||||
Reference in New Issue
Block a user