This commit is contained in:
Frank Skare
2020-04-19 03:16:00 +02:00
parent c54f240346
commit cd3543fff4
4 changed files with 171 additions and 90 deletions

154
Manual.md
View File

@@ -10,16 +10,18 @@ Table of contents
* [Requirements](#requirements) * [Requirements](#requirements)
* [Installation](#installation) * [Installation](#installation)
+ [File Associations](#file-associations) + [File Associations](#file-associations)
* [Settings](#settings)
* [Command Line Interface](#command-line-interface)
* [Terminal](#terminal)
* [External Tools](#external-tools) * [External Tools](#external-tools)
+ [Play with mpv](#play-with-mpv) + [Play with mpv](#play-with-mpv)
+ [External Application Button](#external-application-button) + [External Application Button](#external-application-button)
+ [Open with++](#open-with) + [Open with++](#open-with)
+ [MediaInfo.NET](#mediainfonet) + [MediaInfo.NET](#mediainfonet)
* [Command Line Interface](#command-line-interface)
* [Terminal](#terminal)
* [Extensions](#extensions) * [Extensions](#extensions)
* [Color Theme](#color-theme) * [Color Theme](#color-theme)
* [Hidden and secret features](#hidden-and-secret-features) * [Hidden and secret features](#hidden-and-secret-features)
* [Limitations](#limitations)
* [Context Menu](#context-menu) * [Context Menu](#context-menu)
+ [Open > Open Files](#open--open-files) + [Open > Open Files](#open--open-files)
+ [Open > Open URL](#open--open-url) + [Open > Open URL](#open--open-url)
@@ -143,8 +145,7 @@ Alternatively, Chocolatey can also be used:
`choco install mpvnet.install` `choco install mpvnet.install`
File Associations ### File Associations
-----------------
File Associations can be created using the setup or with the context menu under 'Tools > Setup'. File Associations can be created using the setup or with the context menu under 'Tools > Setup'.
@@ -155,6 +156,78 @@ It's also possible to change the default application using the 'Open with' featu
[Open with++](#open-with) can be used to extend the File Explorer context menu to get menu items for 'Play with mpv.net' and 'Add to mpv.net playlist'. [Open with++](#open-with) can be used to extend the File Explorer context menu to get menu items for 'Play with mpv.net' and 'Add to mpv.net playlist'.
Settings
--------
When mpv.net finds no config folder on startup it will ask for a location.
If a folder named portable_config next to the mpvnet.exe exists,
all config will be loaded from this folder only.
```Text
<startup>\portable_config\
```
mpv specific settings are stored in the file mpv.conf, if no mpv.conf file exists
mpv.net generates it with the following defaults:
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt>
mpv.net specific settings are stored in the file mpvnet.conf
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:
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt>
mpv.net supports almost all mpv settings and features,
[limitations are described in the manual](manual.md#limitations).
The config folder can be opened from the context menu.
Command Line Interface
----------------------
`mpvnet --mute=yes <file|URL>`
mpv properties can be set with the same syntax as mpv, that is:
To enable the border property:
`--border` or `--border=yes`
To disable the border property:
`--no-boder` or `--border=no`
Supported are all mpv properties, they are documented here:
<https://mpv.io/manual/master/#properties>
mpv.net has a feature to list all properties:
Context Menu > View > Show Properties
Non property switches are generally not supported in mpv.net!
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, mpv.net is than available in the terminal via mpvnet command.
JavaScript and Lua scripts must be debugged with the terminal as there is no debugger support available.
External Tools External Tools
-------------- --------------
@@ -202,35 +275,10 @@ If the path has spaces then it must be enclosed in quotes and then double backsl
`_ run "D:/Soft ware/MediaInfoNET.exe" "${path}" #menu: Tools > Open file with MediaInfo.NET` `_ run "D:/Soft ware/MediaInfoNET.exe" "${path}" #menu: Tools > Open file with MediaInfo.NET`
Command Line Interface
----------------------
mpvnet implements a command line interface to set mpv commands.
Supported are all mpv properties which are documented at:
<https://mpv.io/manual/master>
Example:
`mpvnet --mute=yes <file|URL>`
Terminal
--------
When mpv.net is started from a terminal it will attach to the terminal and print status debug and error messages to the terminal.
In the context menu under 'Tools > Setup' a button can be found to add mpv.net to the path environment variable, mpv.net is than available in the terminal via mpvnet command.
JavaScript and Lua scripts must be debugged with the terminal as there is no debugger support available.
Extensions Extensions
========== ----------
Walkthrough creating an extension ### Walkthrough creating an extension
---------------------------------
- Download and install [Visual Studio Community](https://visualstudio.microsoft.com). - Download and install [Visual Studio Community](https://visualstudio.microsoft.com).
- Create a new project of type **Class Library .NET Framework** and ensure the project name ends with **Extension**. - Create a new project of type **Class Library .NET Framework** and ensure the project name ends with **Extension**.
@@ -240,10 +288,9 @@ Walkthrough creating an extension
- 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. - 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.
Sample Code ### Sample Code
-----------
### ScriptingExtension #### ScriptingExtension
The ScriptingExtension implements the C# scripting host using [CS-Script](https://www.cs-script.net/). The ScriptingExtension implements the C# scripting host using [CS-Script](https://www.cs-script.net/).
@@ -252,7 +299,7 @@ I use this extension as well to develop and debug all my C# scripts. Once the co
<https://github.com/stax76/mpv.net/blob/master/extensions/ScriptingExtension/ScriptingExtension.cs> <https://github.com/stax76/mpv.net/blob/master/extensions/ScriptingExtension/ScriptingExtension.cs>
### RatingExtension #### RatingExtension
This extension writes a rating to the filename of rated videos when mpv.net shuts down. This extension writes a rating to the filename of rated videos when mpv.net shuts down.
@@ -302,6 +349,43 @@ Whenever the control key is pressed when files or URLs are opened, the playlist
Pressing the shift key while opening a single file will suppress loading all files in the folder. Pressing the shift key while opening a single file will suppress loading all files in the folder.
Limitations
-----------
mpv.net was designed to work exactly like mpv, there are few limitations:
### Window Limitations
mpv.net implements an own main window and because of that all window related features of mpv are not available unless mpv.net has an own implementation. Find the documentation of mpvs window related features here:
<https://mpv.io/manual/master/#window>
mpv.net has currently implemented the following window related features:
[screen](https://mpv.io/manual/master/#options-screen)
[fullscreen](https://mpv.io/manual/master/#options-fullscreen)
[ontop](https://mpv.io/manual/master/#options-ontop)
[border](https://mpv.io/manual/master/#options-border)
[autofit](https://mpv.io/manual/master/#options-autofit) (only partly implemented)
[autofit-smaller](https://mpv.io/manual/master/#options-autofit-smaller) (only partly implemented)
[autofit-larger](https://mpv.io/manual/master/#options-autofit-larger) (only partly implemented)
[window-maximized](https://mpv.io/manual/master/#options-window-maximized) (don't use input.conf, use Win+Up, Win+Down instead)
### Command Line Limitations
mpv.net supports only property switches, it does not support non property switches.
Context Menu Context Menu
------------ ------------

View File

@@ -3,7 +3,8 @@
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/stax76/mpv.net) ![GitHub closed issues](https://img.shields.io/github/issues-closed/stax76/mpv.net) ![GitHub All Releases](https://img.shields.io/github/downloads/stax76/mpv.net/total) ![GitHub tag (latest by date)](https://img.shields.io/github/tag-date/stax76/mpv.net) ![GitHub stars](https://img.shields.io/github/stars/stax76/mpv.net) [![PayPal donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/stax76) ![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/stax76/mpv.net) ![GitHub closed issues](https://img.shields.io/github/issues-closed/stax76/mpv.net) ![GitHub All Releases](https://img.shields.io/github/downloads/stax76/mpv.net/total) ![GitHub tag (latest by date)](https://img.shields.io/github/tag-date/stax76/mpv.net) ![GitHub stars](https://img.shields.io/github/stars/stax76/mpv.net) [![PayPal donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/stax76)
# 🎞 mpv.net 🎞 mpv.net
==========
mpv.net is a modern media player for Windows that works just like [mpv](https://mpv.io). mpv.net is a modern media player for Windows that works just like [mpv](https://mpv.io).
@@ -35,6 +36,7 @@ mpv.net is under active development. Want a feature? Post a [patch](https://gith
mpv.net is based on libmpv which offers a straightforward C API that was designed from the ground up to make mpv usable as a library and facilitate easy integration into other applications. mpv is like vlc not based on DirectShow or Media Foundation. mpv.net is based on libmpv which offers a straightforward C API that was designed from the ground up to make mpv usable as a library and facilitate easy integration into other applications. mpv is like vlc not based on DirectShow or Media Foundation.
Table of contents Table of contents
----------------- -----------------
@@ -44,7 +46,6 @@ Table of contents
- [Installation](#installation) - [Installation](#installation)
- [Manual](#manual) - [Manual](#manual)
- [Context Menu](#context-menu) - [Context Menu](#context-menu)
- [Settings](#settings)
- [Scripting](#scripting) - [Scripting](#scripting)
- [Extensions](#extensions) - [Extensions](#extensions)
- [Architecture](#architecture) - [Architecture](#architecture)
@@ -52,9 +53,11 @@ Table of contents
- [Links](#links) - [Links](#links)
- [Changelog](#changelog) - [Changelog](#changelog)
## Features
- Very high degree of mpv compatibility, almost all mpv features are available Features
--------
- High degree of mpv compatibility, almost all mpv features are available
- Great usability due to everything in the application being searchable - Great usability due to everything in the application being searchable
- Open source built with modern tools - Open source built with modern tools
- Customizable context menu defined in the same file as the key bindings ([Screenshot](#context-menu-screenshot), [Defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt)) - Customizable context menu defined in the same file as the key bindings ([Screenshot](#context-menu-screenshot), [Defaults](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt))
@@ -89,7 +92,9 @@ Table of contents
- Update check and update routine ([Manual](Manual.md#help--check-for-updates)) - Update check and update routine ([Manual](Manual.md#help--check-for-updates))
- [Manual](#manual) - [Manual](#manual)
## Screenshots
Screenshots
-----------
#### Main Window Screenshot #### Main Window Screenshot
@@ -132,13 +137,17 @@ Media search feature powered by [Everything](https://www.voidtools.com) to find
![Media Search](https://raw.githubusercontent.com/stax76/mpv.net/master/img/MediaSearch.png) ![Media Search](https://raw.githubusercontent.com/stax76/mpv.net/master/img/MediaSearch.png)
## Download
Download
--------
Stable releases can be downloaded from the [Release page](releases). Stable releases can be downloaded from the [Release page](releases).
Newer Beta versions can be downloaded from [OneDrive](https://1drv.ms/u/s!ArwKS_ZUR01g1ldoLA90tX9DzKTj?e=xITXbC) and [DropBox](https://www.dropbox.com/sh/t54p9igdwvllbpl/AADKyWpaFnIhdyosxyP5d3_xa?dl=0). Newer Beta versions can be downloaded from [OneDrive](https://1drv.ms/u/s!ArwKS_ZUR01g1ldoLA90tX9DzKTj?e=xITXbC) and [DropBox](https://www.dropbox.com/sh/t54p9igdwvllbpl/AADKyWpaFnIhdyosxyP5d3_xa?dl=0).
## Installation
Installation
------------
mpv.net requires minimum .NET Framework 4.8 and Windows 7. For optimal results a modern graphics card is recommended. mpv.net requires minimum .NET Framework 4.8 and Windows 7. For optimal results a modern graphics card is recommended.
@@ -160,11 +169,15 @@ Alternatively, Chocolatey can also be used:
`choco install mpvnet.install` `choco install mpvnet.install`
## Manual
Manual
------
[Manual](Manual.md) [Manual](Manual.md)
## Context Menu
Context Menu
------------
The context menu can be customized via input.conf file located in the config directory: The context menu can be customized via input.conf file located in the config directory:
@@ -178,45 +191,23 @@ if it's missing mpv.net generates it with the following defaults:
input.conf defines mpv's key and mouse bindings and mpv.net uses comments to define the context menu. input.conf defines mpv's key and mouse bindings and mpv.net uses comments to define the context menu.
## Settings
When mpv.net finds no config folder on startup it will ask for a location. Scripting
---------
If a folder named portable_config next to the mpvnet.exe exists,
all config will be loaded from this folder only.
```Text
<startup>\portable_config\
```
mpv specific settings are stored in the file mpv.conf, if no mpv.conf file exists
mpv.net generates it with the following defaults:
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpv.conf.txt>
mpv.net specific settings are stored in the file mpvnet.conf
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:
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/input.conf.txt>
mpv.net supports almost all mpv settings and features,
[limitations are listed in the wiki](https://github.com/stax76/mpv.net/wiki/Limitations).
The config folder can be opened from the context menu.
## Scripting
[Scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting) [Scripting wiki page](https://github.com/stax76/mpv.net/wiki/Scripting)
## Extensions
Extensions
----------
[Extensions](Manual.md#extensions) [Extensions](Manual.md#extensions)
## Architecture
mpv.net is written in C# and runs on the .NET Framework Architecture
------------
mpv.net is written in C# and runs on the .NET Framework 4.8.
The Extension implementation is based on the [Managed Extensibility Framework](https://docs.microsoft.com/en-us/dotnet/framework/mef/). The Extension implementation is based on the [Managed Extensibility Framework](https://docs.microsoft.com/en-us/dotnet/framework/mef/).
@@ -236,7 +227,9 @@ Third party components:
- [CS-Script, scripting with C#](http://www.csscript.net/) - [CS-Script, scripting with C#](http://www.csscript.net/)
- [Everything, a blazing fast file search service](https://www.voidtools.com) - [Everything, a blazing fast file search service](https://www.voidtools.com)
## Support
Support
-------
Before making a support request for a particular issue, please try if it was already addressed in a newer [beta version](#download). Before making a support request for a particular issue, please try if it was already addressed in a newer [beta version](#download).
@@ -250,7 +243,9 @@ You can support the development of mpv.net with a PayPal donation:
<https://www.paypal.me/stax76> <https://www.paypal.me/stax76>
## Links
Links
-----
#### mpv.net #### mpv.net
@@ -259,6 +254,7 @@ You can support the development of mpv.net with a PayPal donation:
- download: <https://github.com/stax76/mpv.net/releases> - download: <https://github.com/stax76/mpv.net/releases>
- bugs and requests: <https://github.com/stax76/mpv.net/issues> - bugs and requests: <https://github.com/stax76/mpv.net/issues>
#### mpv #### mpv
- website: <https://mpv.io/> - website: <https://mpv.io/>
@@ -270,6 +266,7 @@ You can support the development of mpv.net with a PayPal donation:
- download: <https://mpv.io/installation/> - download: <https://mpv.io/installation/>
- bugs and requests: <https://mpv.io/bug-reports/> - bugs and requests: <https://mpv.io/bug-reports/>
## Changelog
Changelog
---------
[Changelog](Changelog.md) [Changelog](Changelog.md)

View File

@@ -139,7 +139,11 @@ namespace mpvnet
bool IsFullscreen => WindowState == FormWindowState.Maximized && FormBorderStyle == FormBorderStyle.None; bool IsFullscreen => WindowState == FormWindowState.Maximized && FormBorderStyle == FormBorderStyle.None;
bool IsMouseInOSC() => PointToClient(Control.MousePosition).Y > ClientSize.Height * 0.9; bool IsMouseInOSC()
{
Point pos = PointToClient(Control.MousePosition);
return pos.Y > ClientSize.Height * 0.9 || pos.Y < ClientSize.Height * 0.05;
}
void ContextMenu_Opening(object sender, CancelEventArgs e) void ContextMenu_Opening(object sender, CancelEventArgs e)
{ {
@@ -498,8 +502,8 @@ namespace mpvnet
} }
break; break;
case 0x2a3: // WM_MOUSELEAVE case 0x2a3: // WM_MOUSELEAVE
// osc won't always auto hide //osc won't auto hide after mouse left window in borderless mode
mp.command("mouse 1 1"); mp.command($"mouse {ClientSize.Width / 2} {ClientSize.Height / 3}");
break; break;
case 0x203: // WM_LBUTTONDBLCLK case 0x203: // WM_LBUTTONDBLCLK
{ {

View File

@@ -262,16 +262,12 @@ namespace mpvnet
public static void LoadMpvScripts() public static void LoadMpvScripts()
{ {
if (Directory.Exists(Folder.Startup + "Scripts")) if (Directory.Exists(Folder.Startup + "Scripts"))
{ foreach (string path in Directory.GetFiles(Folder.Startup + "Scripts"))
string[] startupScripts = Directory.GetFiles(Folder.Startup + "Scripts");
foreach (string path in startupScripts)
if ((path.EndsWith(".lua") || path.EndsWith(".js")) && KnownScripts.Contains(Path.GetFileName(path))) if ((path.EndsWith(".lua") || path.EndsWith(".js")) && KnownScripts.Contains(Path.GetFileName(path)))
commandv("load-script", $"{path}"); commandv("load-script", $"{path}");
} }
}
public static string[] KnownScripts { get; } = { "show-playlist.js", "seek-show-position.py" }; public static string[] KnownScripts { get; } = { "show-playlist.js", "seek-show-position.js" };
public static void LoadScripts() public static void LoadScripts()
{ {
@@ -287,9 +283,9 @@ namespace mpvnet
App.RunAction(() => InvokePowerShellScript(file)); App.RunAction(() => InvokePowerShellScript(file));
} }
else else
Msg.ShowError("Failed to load script", file + BR2 + ConsoleHelp.WriteError("Failed to load script:" + BR + file + BR +
"Only scripts that ship with mpv.net are allowed in <startup>\\scripts" + BR2 + "Only scripts that ship with mpv.net are allowed in <startup>\\scripts." + BR +
"Never copy or install a new mpv.net version over a old mpv.net version."); "Never copy or install a new mpv.net version on top of a old mpv.net version.");
} }
} }