From b0c3988a9dfa83ee7cffd17532ac49f3749c8a2e Mon Sep 17 00:00:00 2001 From: stax76 Date: Sun, 13 Mar 2022 14:00:26 +0100 Subject: [PATCH] improved manual --- docs/Changelog.md | 4 +- docs/Manual.md | 232 +++++++++++++++++++++++++++++++---- src/Misc/Commands.cs | 115 ++++++++--------- src/Resources/input.conf.txt | 2 +- 4 files changed, 264 insertions(+), 89 deletions(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index 2e970cf..26d9be1 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -6,7 +6,9 @@ by the text editor, so it's like everything else searchable. - Media Info isn't shown directly, instead the command palette shows several choices. The command palette can be bypassed - using the arguments: textbox, editor, full, raw + using the arguments: msgbox, editor, full, raw. +- mpv.net specific commands are documented in the manual. +- The command palette and auto-play property is documented in the manual. 5.7.0.0 Stable (2022-03-09) diff --git a/docs/Manual.md b/docs/Manual.md index 345eb5f..6290d76 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -13,8 +13,10 @@ Table of contents * [Support](#support) * [Settings](#settings) * [Input and context menu](#input-and-context-menu) +* [Command Palette](#command-palette) * [Command Line Interface](#command-line-interface) * [Terminal](#terminal) +* [mpv.net specific commands](#mpvnet-specific-commands) * [mpv.net specific options](#mpvnet-specific-options) * [External Tools](#external-tools) * [Scripting](#scripting) @@ -57,7 +59,9 @@ Installation mpv.net requires the .NET Framework 4.8 and Windows 7 or higher and a modern graphics card. -For internet streaming yt-dlp must be downloaded and installed manually. +For internet streaming from YouTube and similar sites, yt-dlp must be +copied into the mpv.net folder or the user environment variable PATH +must be edited to include the yt-dlp folder. #### File Associations @@ -80,7 +84,7 @@ the files are opened in mpv.net in random order, this works with maximum 15 file Support ------- -Before making a support request, please try a newer beta version first. +Before making a support request, please try the newest version first. Bugs and feature requests can be made on the github [issue tracker](../../../issues), feel free to use for anything mpv.net related, usage questions are welcome. @@ -105,9 +109,7 @@ Input and context menu ---------------------- The input (key/mouse) bindings and the context menu definitions are stored in the -input.conf file, if it's missing mpv.net generates it with the following defaults: - -[input.conf defaults](../../../tree/master/src/Resources/input.conf.txt) +input.conf file, if it's missing mpv.net generates it with default values. Please be aware that once input.conf exists, mpv.net cannot update it, this means the menu becomes outdated when mpv.net is updated with new or changed default menu @@ -125,7 +127,7 @@ The input test mode can be started via command line: --input-test The input key list can be printed with --input-keylist or shown from the context menu under: View > Advanced > Show Keys -mpv.net input.conf defaults: +mpv.net input.conf defaults: https://github.com/stax76/mpv.net/blob/master/src/Resources/input.conf.txt mpv input.conf defaults: @@ -137,6 +139,37 @@ https://mpv.io/manual/master/#list-of-input-commands mpv input options: https://mpv.io/manual/master/#input + +Command Palette +--------------- + +The command palette is designed to quickly find, +select and execute commands. + +It can also be used to easily find shortcut keys. + +The following functionality is presented with the Command Palette: + +- Show media info in different ways. +- Show and select audio tracks. +- Show and select subtitle tracks. +- Show and select playlist files. +- Show and select recent files. +- Show available mpv properties. +- Show available decoders. +- Show available demuxers. +- Show available keys. +- Show available protocols. + +| Key | Action | +| ------ | --------------------------- | +| F1 | Shows the command palette. | +| Escape | Hides the command palette. | +| Enter | Executes the selected item. | +| Up | Moves the selection up. | +| Down | Moves the selection down. | + + Command Line Interface ---------------------- @@ -162,12 +195,12 @@ Supported are all mpv properties, they are documented here: https://mpv.io/manual/master/#properties -mpv.net has a feature to list all properties: +mpv.net has a feature to list all available properties: -_Context Menu > View > Show Properties_ +_Context Menu > View > Advanced > Show Properties_ -Non property switches are generally not supported in mpv.net! +mpv has a few non property based switches which are generally not supported in mpv.net. Terminal @@ -176,12 +209,152 @@ Terminal When mpv.net is started from a terminal it will output status, error and debug messages to the terminal and accept input keys from the terminal. -In the context menu under _Tools > Setup_ a button can be found to add -mpv.net to the path environment variable. - A common task for the terminal is debugging scripts. +mpv.net specific commands +------------------------- + +`script-message mpv.net ` + +mpv.net commands are used when mpv commands don't exist or lack a feature. + +### cycle-audio +Switches to the next audio track and shows info about that track. + +### load-audio +Shows a file browser dialog to open external audio files. + +### load-sub +Shows a file browser dialog to open external subtitle files. + +### open-conf-folder +Opens the config folder with Windows File Explorer. + +### open-files [\] +**no-folder** +For single files prevents loading the complete folder into the playlist. + +**append** +Appends files to the playlist. + +Opens a file browser dialog in order to select files to be opened. +The file browser dialog supports multiselect to load multiple files +at once. Pressing CTRL appends the files to the playlist. + +### open-optical-media +Shows a folder browser dialog to open a DVD or BD folder. +ISO images don't have to be mounted, but instead can be +opened directly with the open-files command. + +### open-clipboard +Opens a single URL or filepath from the clipboard, +or multiple files in the file clipboard format. + +### play-pause +Cycles the pause property. In case the playlist is empty, +the most recent file from the recent files list is loaded. + +### playlist-first +Jumps to the first playlist entry, if the loaded file is +already the first entry, nothing happens. + +### playlist-last +Jumps to the last playlist entry, if the loaded file is +already the last entry, nothing happens. + +### reg-file-assoc \ +Registers the file associations. + +### scale-window \ +Decreases or increases the Window size. + +### shell-execute \ +Shell executes a single file or URL. + +### show-about +Shows the about dialog. + +### show-audio-devices +Shows available audio devices in a message box. + +### show-audio-tracks +Shows available audio tracks in the command palette +and allows to load the selected audio track. + +### show-command-palette +Shows the command palette. + +### show-commands +Shows available mpv imput commands. + +### show-conf-editor +Shows the conf editor. + +### show-decoders +Shows available decoders. + +### show-demuxers +Shows available demuxers. + +### show-history + +Shows the history file when existing. + +### show-info +Shows a simple file info. + +### show-input-editor +Shows the input editor. + +### show-keys +Shows available keys (as shown with `--input-keylist`) in the command palette. + +### show-media-info [\] +**msgbox** +Shows media info in a messsge box. + +**editor** +Shows media info in the text editor. + +**full** +Shows fully detailed media info. + +**raw** +Shows media info with raw property names. + +### show-playlist +Shows the playlist in the command palette +and allows to play the selected entry. + +### show-profiles +Shows available profiles with a message box. + +### show-progress +Shows a simple OSD progress message. + +### show-properties +Shows available properties in the command palette and +allows to display the property value of the selected property. + +### show-protocols +Shows available protocols in the command palette. + +### show-recent +Shows recently played files and URLs in the +command palette and allows to select and play entries. + +### show-subtitle-tracks +Shows available subtitles in the command palette +and allows to activate the selected subtitle. + +### show-text \ \ \ +Shows a OSD message with given text, duration and font size. + +### window-scale \ +Works similar as the [window-scale](https://mpv.io/manual/master/#command-interface-window-scale) mpv property. + + mpv.net specific options ------------------------ @@ -233,21 +406,18 @@ Window size is remembered in the current session. **always** Window size is always remembered. - #### --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, 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-window-position=\ Save the window position on exit. Default: no @@ -260,6 +430,11 @@ Save the window position on exit. Default: no For single files automatically load the entire directory into the playlist. Can be suppressed via shift key. Default: yes +#### --auto-play=\ + +If the player is paused and another file is loaded, +playback automatically resumes. + ### General @@ -280,27 +455,22 @@ Force a single process everytime the shell starts mpv.net. Default **queue** Force a single process and add files to playlist. - #### --recent-count=\ Amount of recent files to be remembered. Default: 15 - #### --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 used to create file associations and used by the auto-load-folder feature. - #### --image-file-extensions=\ Image file extensions used to create file associations and used by the auto-load-folder feature. - #### --debug-mode=\ Enable this only when a developer asks for it. Default: no @@ -320,14 +490,12 @@ Available on Windows 10 or higher. **never** - #### ---dark-theme=\ Color theme used in dark mode. Default: dark [Color Themes](#color-theme) - #### --light-theme=\ Color theme used in light mode. Default: light @@ -384,6 +552,15 @@ My primary remote control solution however is a One For All Contour URC1210 using Philips code 0556 together with FLIRC USB (gen2). +### External Application Button + +Videos can be downloaded easily with External Application Button + +path: `wt` + +args: `-- pwsh -NoLogo -Command "yt-dlp --ignore-errors --download-archive 'C:\External Application Button.txt' --output 'C:\YouTube\%(channel)s - %(title)s.%(ext)s' ('[HREF]' -replace '&list=.+','')"` + + Scripting --------- @@ -395,14 +572,17 @@ Location: `\scripts` The Lua script host is built into libmpv. -There is no debugging support, only error and debug messages printed on the terminal. +Error and debug messages are printed on the terminal. Lua scripts are loaded before the first media file loads. [mpv Lua documentation](https://mpv.io/manual/master/#lua-scripting) -[mpv user scripts](https://github.com/mpv-player/mpv/wiki/User-Scripts) +[mpv user scripts in the wiki](https://github.com/mpv-player/mpv/wiki/User-Scripts) +[mpv user scripts on GitHub](https://github.com/topics/mpv-script) + +[mpv user scripts found by Google](https://www.google.com/search?q=mpv+script) #### JavaScript @@ -412,7 +592,7 @@ Location: `\scripts` The JavaScript script host is built into libmpv. -There is no debugging support, only error and debug messages printed on the terminal. +Error and debug messages are printed on the terminal. JavaScript scripts are loaded before the first media file loads. @@ -449,6 +629,8 @@ Script code can be written within a C# [extension](../../../tree/master/src/Exte that way full code completion and debugger support is available. Once the code was developed and debugged, it can be moved from the extension to a lightweight standalone script. +The script host uses an old C# version, modern features +like string interpolation are not available. The C# scripting host is like [extensions](../../../tree/master/src/Extensions) not initialized before media files are loaded. diff --git a/src/Misc/Commands.cs b/src/Misc/Commands.cs index b5687ac..db28b71 100644 --- a/src/Misc/Commands.cs +++ b/src/Misc/Commands.cs @@ -29,10 +29,11 @@ namespace mpvnet case "execute-mpv-command": Msg.ShowError("The command was removed, reset input.conf by deleting it, in the new menu use the on screen console."); break; // deprecated 2020 case "load-audio": LoadAudio(); break; case "load-sub": LoadSubtitle(); break; + case "open-clipboard": OpenFromClipboard(); break; case "open-conf-folder": ProcessHelp.ShellExecute(Core.ConfigFolder); break; case "open-files": OpenFiles(args); break; case "open-optical-media": Open_DVD_Or_BD_Folder(); break; - case "open-url": OpenURL(); break; + case "open-url": OpenFromClipboard(); break; // deprecated 2022 case "play-pause": PlayPause(); break; case "playlist-first": PlaylistFirst(); break; case "playlist-last": PlaylistLast(); break; @@ -75,14 +76,12 @@ namespace mpvnet ProcessHelp.ShellExecute(file); } - public static void ShowDialog(Type winType) + public static void ShowDialog(Type winType) => App.InvokeOnMainThread(() => { - App.InvokeOnMainThread(new Action(() => { - Window win = Activator.CreateInstance(winType) as Window; - new WindowInteropHelper(win).Owner = MainForm.Instance.Handle; - win.ShowDialog(); - })); - } + Window win = Activator.CreateInstance(winType) as Window; + new WindowInteropHelper(win).Owner = MainForm.Instance.Handle; + win.ShowDialog(); + }); public static void OpenFiles(params string[] args) { @@ -105,15 +104,13 @@ namespace mpvnet })); } - public static void Open_DVD_Or_BD_Folder() + public static void Open_DVD_Or_BD_Folder() => App.InvokeOnMainThread(() => { - App.InvokeOnMainThread(new Action(() => { - var dialog = new FolderBrowser(); + var dialog = new FolderBrowser(); - if (dialog.Show()) - Core.LoadDiskFolder(dialog.SelectedPath); - })); - } + if (dialog.Show()) + Core.LoadDiskFolder(dialog.SelectedPath); + }); public static void PlaylistFirst() { @@ -256,67 +253,61 @@ namespace mpvnet string FormatTime(double value) => ((int)value).ToString("00"); } - public static void OpenURL() + public static void OpenFromClipboard() => App.InvokeOnMainThread(() => { - App.InvokeOnMainThread(new Action(() => { - if (WinForms.Clipboard.ContainsFileDropList()) + if (WinForms.Clipboard.ContainsFileDropList()) + { + string[] files = WinForms.Clipboard.GetFileDropList().Cast().ToArray(); + Core.LoadFiles(files, false, Control.ModifierKeys.HasFlag(Keys.Control)); + } + else + { + string clipboard = WinForms.Clipboard.GetText(); + + if (string.IsNullOrEmpty(clipboard) || (!clipboard.Contains("://") && !File.Exists(clipboard)) || + clipboard.Contains("\n")) { - string[] files = WinForms.Clipboard.GetFileDropList().Cast().ToArray(); - Core.LoadFiles(files, false, Control.ModifierKeys.HasFlag(Keys.Control)); + App.ShowError("The clipboard does not contain a valid URL or file."); + return; } - else - { - string clipboard = WinForms.Clipboard.GetText(); - if (string.IsNullOrEmpty(clipboard) || (!clipboard.Contains("://") && !File.Exists(clipboard)) || - clipboard.Contains("\n")) - { - App.ShowError("No URL found, the clipboard does not contain a valid URL or file."); - return; - } + Core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control)); + } + }); - Core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control)); - } - })); - } - - public static void LoadSubtitle() + public static void LoadSubtitle() => App.InvokeOnMainThread(() => { - App.InvokeOnMainThread(new Action(() => { - using (var d = new OpenFileDialog()) - { - string path = Core.GetPropertyString("path"); + using (var d = new OpenFileDialog()) + { + string path = Core.GetPropertyString("path"); - if (File.Exists(path)) - d.InitialDirectory = Path.GetDirectoryName(path); + if (File.Exists(path)) + d.InitialDirectory = Path.GetDirectoryName(path); - d.Multiselect = true; + d.Multiselect = true; - if (d.ShowDialog() == DialogResult.OK) - foreach (string filename in d.FileNames) - Core.CommandV("sub-add", filename); - } - })); - } + if (d.ShowDialog() == DialogResult.OK) + foreach (string filename in d.FileNames) + Core.CommandV("sub-add", filename); + } + }); - public static void LoadAudio() + public static void LoadAudio() => App.InvokeOnMainThread(() => { - App.InvokeOnMainThread(new Action(() => { - using (var d = new OpenFileDialog()) - { - string path = Core.GetPropertyString("path"); + using (var d = new OpenFileDialog()) + { + string path = Core.GetPropertyString("path"); - if (File.Exists(path)) - d.InitialDirectory = Path.GetDirectoryName(path); + if (File.Exists(path)) + d.InitialDirectory = Path.GetDirectoryName(path); - d.Multiselect = true; + d.Multiselect = true; - if (d.ShowDialog() == DialogResult.OK) - foreach (string i in d.FileNames) - Core.CommandV("audio-add", i); - } - })); - } + if (d.ShowDialog() == DialogResult.OK) + foreach (string i in d.FileNames) + Core.CommandV("audio-add", i); + } + }); public static void CycleAudio() { diff --git a/src/Resources/input.conf.txt b/src/Resources/input.conf.txt index c3d8e75..c7a7575 100644 --- a/src/Resources/input.conf.txt +++ b/src/Resources/input.conf.txt @@ -2,7 +2,7 @@ # https://github.com/stax76/mpv.net/blob/master/docs/Manual.md#input-and-context-menu o script-message mpv.net open-files #menu: Open > Open Files... -Ctrl+v script-message mpv.net open-url #menu: Open > Open URL or file from clipboard +Ctrl+v script-message mpv.net open-clipboard #menu: Open > Open URL or file from clipboard _ script-message mpv.net open-optical-media #menu: Open > Open DVD/Blu-ray Drive/Folder... _ ignore #menu: Open > - Alt+a script-message mpv.net load-audio #menu: Open > Load external audio files...