new logic to find the settings folder
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
### 4.7.6.1
|
### 4.7.6.3
|
||||||
|
|
||||||
- fix for mouse button back/forward causing freeze
|
- fix for mouse button back/forward causing freeze
|
||||||
- fix for WM_APPCOMMAND not working but crashing in input editor learn window
|
- fix for WM_APPCOMMAND not working but crashing in input editor learn window
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
the theme color from the Registry on Win 7
|
the theme color from the Registry on Win 7
|
||||||
- new option dark-color was added to overwrite the OS theme color used in dark mode, find the option under 'General'
|
- new option dark-color was added to overwrite the OS theme color used in dark mode, find the option under 'General'
|
||||||
- new option light-color was added to overwrite the OS theme color used in non dark mode, find the option under 'General'
|
- new option light-color was added to overwrite the OS theme color used in non dark mode, find the option under 'General'
|
||||||
|
- it's now possible to use a custom folder as config folder
|
||||||
|
|
||||||
### 4.7.3
|
### 4.7.3
|
||||||
|
|
||||||
|
|||||||
18
Manual.md
18
Manual.md
@@ -822,25 +822,23 @@ mpvnet --mute=yes <file|URL>
|
|||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
|
|
||||||
mpv.net is able to share the settings with mpv and mpv.net uses the same logic to decide from where the settings are loaded. The default location is:
|
mpv.net is able to share the settings with mpv.
|
||||||
|
|
||||||
```Text
|
|
||||||
C:\Users\%username%\AppData\Roaming\mpv\mpv.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
If a directory named portable_config next to the mpvnet.exe exists, all config will be loaded from this directory only.
|
If a directory named portable_config next to the mpvnet.exe exists, all config will be loaded from this directory only.
|
||||||
|
|
||||||
```Text
|
```Text
|
||||||
<startup>\portable_config\mpv.conf
|
<startup>\portable_config\
|
||||||
```
|
```
|
||||||
|
|
||||||
In case there isn't any config folder mpv.net asks where to create it. If no mpv.conf file exists mpv.net generates it with the following defaults:
|
On first start if no portable config folder exists mpv.net asks which folder should be used as config folder.
|
||||||
|
|
||||||
|
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/mpvConf.txt>
|
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt>
|
||||||
|
|
||||||
Config files located in the same directory as mpvnet.exe are loaded with lower priority. Some config files are loaded only once, which means that e.g. of 2 input.conf files located in two config directories, only the one from the directory with higher priority will be loaded.
|
|
||||||
|
|
||||||
The key bindings and the context menu definitions are stored in the input.conf file,
|
The key 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:
|
if it's missing mpv.net generates it with the following defaults:
|
||||||
|
|
||||||
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt>
|
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt>
|
||||||
|
|
||||||
|
mpv.net supports almost all mpv settings and features, [limitations are listed in the wiki](https://github.com/stax76/mpv.net/wiki/Limitations).
|
||||||
14
README.md
14
README.md
@@ -136,24 +136,20 @@ input.conf defines mpv's key and mouse bindings and mpv.net uses comments to def
|
|||||||
|
|
||||||
### Settings
|
### Settings
|
||||||
|
|
||||||
mpv.net is able to share the settings with mpv and mpv.net uses the same logic to decide from where the settings are loaded. The default location is:
|
mpv.net is able to share the settings with mpv.
|
||||||
|
|
||||||
```Text
|
|
||||||
C:\Users\%username%\AppData\Roaming\mpv\mpv.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
If a directory named portable_config next to the mpvnet.exe exists, all config will be loaded from this directory only.
|
If a directory named portable_config next to the mpvnet.exe exists, all config will be loaded from this directory only.
|
||||||
|
|
||||||
```Text
|
```Text
|
||||||
<startup>\portable_config\mpv.conf
|
<startup>\portable_config\
|
||||||
```
|
```
|
||||||
|
|
||||||
In case there isn't any config folder mpv.net asks where to create it. If no mpv.conf file exists mpv.net generates it with the following defaults:
|
On first start if no portable config folder exists mpv.net asks which folder should be used as config folder.
|
||||||
|
|
||||||
|
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/mpvConf.txt>
|
<https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt>
|
||||||
|
|
||||||
Config files located in the same directory as mpvnet.exe are loaded with lower priority. Some config files are loaded only once, which means that e.g. of 2 input.conf files located in two config directories, only the one from the directory with higher priority will be loaded.
|
|
||||||
|
|
||||||
The key bindings and the context menu definitions are stored in the input.conf file,
|
The key 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:
|
if it's missing mpv.net generates it with the following defaults:
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ Public Class CSScriptAddon
|
|||||||
Sub New()
|
Sub New()
|
||||||
Dim scriptFiles As New List(Of String)
|
Dim scriptFiles As New List(Of String)
|
||||||
|
|
||||||
If Directory.Exists(mp.ConfFolder + "scripts") Then
|
If Directory.Exists(mp.ConfigFolder + "scripts") Then
|
||||||
scriptFiles.AddRange(Directory.GetFiles(mp.ConfFolder + "scripts", "*.cs"))
|
scriptFiles.AddRange(Directory.GetFiles(mp.ConfigFolder + "scripts", "*.cs"))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Directory.Exists(Application.StartupPath + "\scripts") Then
|
If Directory.Exists(Application.StartupPath + "\scripts") Then
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace DynamicGUI
|
|||||||
{
|
{
|
||||||
d.Description = "Choose a folder.";
|
d.Description = "Choose a folder.";
|
||||||
d.SelectedPath = ValueTextBox.Text;
|
d.SelectedPath = ValueTextBox.Text;
|
||||||
if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
if (d.ShowDialog() == WinForms.DialogResult.OK)
|
||||||
ValueTextBox.Text = d.SelectedPath;
|
ValueTextBox.Text = d.SelectedPath;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace mpvnet
|
|||||||
foreach (string i in Directory.GetDirectories(dir))
|
foreach (string i in Directory.GetDirectories(dir))
|
||||||
catalog.Catalogs.Add(new DirectoryCatalog(i, "*Addon.dll"));
|
catalog.Catalogs.Add(new DirectoryCatalog(i, "*Addon.dll"));
|
||||||
|
|
||||||
dir = mp.ConfFolder + "\\Addons";
|
dir = mp.ConfigFolder + "\\Addons";
|
||||||
|
|
||||||
if (Directory.Exists(dir))
|
if (Directory.Exists(dir))
|
||||||
foreach (string i in Directory.GetDirectories(dir))
|
foreach (string i in Directory.GetDirectories(dir))
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace mpvnet
|
|||||||
case "show-about": ShowDialog(typeof(AboutWindow)); break;
|
case "show-about": ShowDialog(typeof(AboutWindow)); break;
|
||||||
case "show-conf-editor": ShowDialog(typeof(ConfWindow)); break;
|
case "show-conf-editor": ShowDialog(typeof(ConfWindow)); break;
|
||||||
case "show-input-editor": ShowDialog(typeof(InputWindow)); break;
|
case "show-input-editor": ShowDialog(typeof(InputWindow)); break;
|
||||||
case "open-conf-folder": Process.Start(mp.ConfFolder); break;
|
case "open-conf-folder": Process.Start(mp.ConfigFolder); break;
|
||||||
case "open-files": OpenFiles(args); break;
|
case "open-files": OpenFiles(args); break;
|
||||||
case "shell-execute": Process.Start(args[0]); break;
|
case "shell-execute": Process.Start(args[0]); break;
|
||||||
case "show-info": ShowInfo(); break;
|
case "show-info": ShowInfo(); break;
|
||||||
@@ -68,7 +68,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void ShowHistory()
|
public static void ShowHistory()
|
||||||
{
|
{
|
||||||
var fp = mp.ConfFolder + "history.txt";
|
var fp = mp.ConfigFolder + "history.txt";
|
||||||
|
|
||||||
if (File.Exists(fp))
|
if (File.Exists(fp))
|
||||||
Process.Start(fp);
|
Process.Start(fp);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
public class App
|
public class App
|
||||||
{
|
{
|
||||||
public static string ConfFilePath { get; } = mp.ConfFolder + "\\mpvnet.conf";
|
|
||||||
public static string RegPath { get; } = @"HKCU\Software\" + Application.ProductName;
|
public static string RegPath { get; } = @"HKCU\Software\" + Application.ProductName;
|
||||||
|
public static string ConfFilePath { 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; }
|
||||||
@@ -41,7 +41,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
string dummy = mp.ConfFolder;
|
string dummy = mp.ConfigFolder;
|
||||||
var dummy2 = mp.Conf;
|
var dummy2 = mp.Conf;
|
||||||
|
|
||||||
foreach (var i in Conf)
|
foreach (var i in Conf)
|
||||||
@@ -51,7 +51,7 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string filePath = mp.ConfFolder + "\\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;
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
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")
|
||||||
@@ -61,8 +64,6 @@ namespace mpvnet
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.EnableVisualStyles();
|
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
|
||||||
Application.Run(new MainForm());
|
Application.Run(new MainForm());
|
||||||
mutex.Dispose();
|
mutex.Dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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("4.7.6.1")]
|
[assembly: AssemblyVersion("4.7.6.3")]
|
||||||
[assembly: AssemblyFileVersion("4.7.6.1")]
|
[assembly: AssemblyFileVersion("4.7.6.3")]
|
||||||
|
|||||||
@@ -166,23 +166,25 @@
|
|||||||
Esc quit #menu: Exit
|
Esc quit #menu: Exit
|
||||||
Q quit-watch-later #menu: Exit Watch Later
|
Q quit-watch-later #menu: Exit Watch Later
|
||||||
|
|
||||||
> playlist-next
|
Power quit
|
||||||
< playlist-prev
|
Play cycle pause
|
||||||
Power quit
|
Pause cycle pause
|
||||||
Play cycle pause
|
PlayPause cycle pause
|
||||||
Pause cycle pause
|
Stop stop
|
||||||
PlayPause cycle pause
|
Forward seek 60
|
||||||
Stop stop
|
Rewind seek -60
|
||||||
Forward seek 60
|
Mute cycle mute
|
||||||
Rewind seek -60
|
Volume_Up add volume 10
|
||||||
Mute cycle mute
|
Volume_Down add volume -10
|
||||||
Volume_Up add volume 10
|
Wheel_Up add volume 10
|
||||||
Volume_Down add volume -10
|
Wheel_Down add volume -10
|
||||||
Wheel_Up add volume 10
|
Prev playlist-prev
|
||||||
Wheel_Down add volume -10
|
Next playlist-next
|
||||||
Prev playlist-prev
|
MBTN_Forward playlist-next
|
||||||
Next playlist-next
|
MBTN_Back playlist-prev
|
||||||
|
> playlist-next
|
||||||
|
< playlist-prev
|
||||||
Ctrl+Wheel_Up no-osd seek 7
|
Ctrl+Wheel_Up no-osd seek 7
|
||||||
Ctrl+Wheel_Down no-osd seek -7
|
Ctrl+Wheel_Down no-osd seek -7
|
||||||
MBTN_LEFT_DBL cycle fullscreen
|
MBTN_Left_DBL cycle fullscreen
|
||||||
KP_ENTER cycle fullscreen
|
KP_Enter cycle fullscreen
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
@@ -61,59 +60,59 @@ namespace mpvnet
|
|||||||
case WF.Keys.NumPad9:
|
case WF.Keys.NumPad9:
|
||||||
text = "KP" + e.KeyCode.ToString()[6].ToString(); break;
|
text = "KP" + e.KeyCode.ToString()[6].ToString(); break;
|
||||||
case WF.Keys.Space:
|
case WF.Keys.Space:
|
||||||
text = "Space"; break;
|
text = "SPACE"; break;
|
||||||
case WF.Keys.Enter:
|
case WF.Keys.Enter:
|
||||||
text = "Enter"; break;
|
text = "ENTER"; break;
|
||||||
case WF.Keys.Tab:
|
case WF.Keys.Tab:
|
||||||
text = "Tab"; break;
|
text = "TAB"; break;
|
||||||
case WF.Keys.Back:
|
case WF.Keys.Back:
|
||||||
text = "BS"; break;
|
text = "BS"; break;
|
||||||
case WF.Keys.Delete:
|
case WF.Keys.Delete:
|
||||||
text = "Del"; break;
|
text = "DEL"; break;
|
||||||
case WF.Keys.Insert:
|
case WF.Keys.Insert:
|
||||||
text = "Ins"; break;
|
text = "INS"; break;
|
||||||
case WF.Keys.Home:
|
case WF.Keys.Home:
|
||||||
text = "Home"; break;
|
text = "HOME"; break;
|
||||||
case WF.Keys.End:
|
case WF.Keys.End:
|
||||||
text = "End"; break;
|
text = "END"; break;
|
||||||
case WF.Keys.PageUp:
|
case WF.Keys.PageUp:
|
||||||
text = "PGUP"; break;
|
text = "PGUP"; break;
|
||||||
case WF.Keys.PageDown:
|
case WF.Keys.PageDown:
|
||||||
text = "PGDWN"; break;
|
text = "PGDWN"; break;
|
||||||
case WF.Keys.Escape:
|
case WF.Keys.Escape:
|
||||||
text = "Esc"; break;
|
text = "ESC"; break;
|
||||||
case WF.Keys.PrintScreen:
|
case WF.Keys.PrintScreen:
|
||||||
text = "Print"; break;
|
text = "PRINT"; break;
|
||||||
case WF.Keys.Play:
|
case WF.Keys.Play:
|
||||||
text = "Play"; break;
|
text = "PLAY"; break;
|
||||||
case WF.Keys.Pause:
|
case WF.Keys.Pause:
|
||||||
text = "Pause"; break;
|
text = "PAUSE"; break;
|
||||||
case WF.Keys.MediaPlayPause:
|
case WF.Keys.MediaPlayPause:
|
||||||
text = "PlayPause"; break;
|
text = "PLAYPAUSE"; break;
|
||||||
case WF.Keys.MediaStop:
|
case WF.Keys.MediaStop:
|
||||||
text = "Stop"; break;
|
text = "STOP"; break;
|
||||||
case WF.Keys.MediaNextTrack:
|
case WF.Keys.MediaNextTrack:
|
||||||
text = "Next"; break;
|
text = "NEXT"; break;
|
||||||
case WF.Keys.MediaPreviousTrack:
|
case WF.Keys.MediaPreviousTrack:
|
||||||
text = "Prev"; break;
|
text = "PREV"; break;
|
||||||
case WF.Keys.VolumeUp:
|
case WF.Keys.VolumeUp:
|
||||||
text = "Volume_Up"; break;
|
text = "VOLUME_UP"; break;
|
||||||
case WF.Keys.VolumeDown:
|
case WF.Keys.VolumeDown:
|
||||||
text = "Volume_Down"; break;
|
text = "VOLUME_DOWN"; break;
|
||||||
case WF.Keys.VolumeMute:
|
case WF.Keys.VolumeMute:
|
||||||
text = "Mute"; break;
|
text = "MUTE"; break;
|
||||||
case WF.Keys.BrowserHome:
|
case WF.Keys.BrowserHome:
|
||||||
text = "Homepage"; break;
|
text = "HOMEPAGE"; break;
|
||||||
case WF.Keys.LaunchMail:
|
case WF.Keys.LaunchMail:
|
||||||
text = "Mail"; break;
|
text = "MAIL"; break;
|
||||||
case WF.Keys.BrowserFavorites:
|
case WF.Keys.BrowserFavorites:
|
||||||
text = "Favorites"; break;
|
text = "FAVORITES"; break;
|
||||||
case WF.Keys.BrowserSearch:
|
case WF.Keys.BrowserSearch:
|
||||||
text = "Search"; break;
|
text = "SEARCH"; break;
|
||||||
case WF.Keys.Sleep:
|
case WF.Keys.Sleep:
|
||||||
text = "Sleep"; break;
|
text = "SLEEP"; break;
|
||||||
case WF.Keys.Cancel:
|
case WF.Keys.Cancel:
|
||||||
text = "Cancel"; break;
|
text = "CANCEL"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shiftWasHandled = false;
|
bool shiftWasHandled = false;
|
||||||
@@ -138,11 +137,14 @@ namespace mpvnet
|
|||||||
SetKey(text);
|
SetKey(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DateTime LastKeyUp;
|
||||||
|
|
||||||
void SetKey(string key)
|
void SetKey(string key)
|
||||||
{
|
{
|
||||||
NewKey = key;
|
NewKey = key;
|
||||||
MenuTextBlock.Text = InputItem.Path;
|
MenuTextBlock.Text = InputItem.Path;
|
||||||
KeyTextBlock.Text = key;
|
KeyTextBlock.Text = key;
|
||||||
|
LastKeyUp = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
@@ -191,50 +193,62 @@ namespace mpvnet
|
|||||||
|
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case AppCommand.MEDIA_CHANNEL_DOWN:
|
case AppCommand.APPCOMMAND_MEDIA_CHANNEL_DOWN:
|
||||||
SetKey("Channel_Down");
|
SetKey("CHANNEL_DOWN");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_CHANNEL_UP:
|
case AppCommand.APPCOMMAND_MEDIA_CHANNEL_UP:
|
||||||
SetKey("Channel_Up");
|
SetKey("CHANNEL_UP");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_FAST_FORWARD:
|
case AppCommand.APPCOMMAND_MEDIA_FAST_FORWARD:
|
||||||
SetKey("Forward");
|
SetKey("FORWARD");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_REWIND:
|
case AppCommand.APPCOMMAND_MEDIA_REWIND:
|
||||||
SetKey("Rewind");
|
SetKey("REWIND");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_PAUSE:
|
case AppCommand.APPCOMMAND_MEDIA_PAUSE:
|
||||||
SetKey("Pause");
|
SetKey("PAUSE");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_PLAY:
|
case AppCommand.APPCOMMAND_MEDIA_PLAY:
|
||||||
SetKey("Play");
|
SetKey("PLAY");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_PLAY_PAUSE:
|
case AppCommand.APPCOMMAND_MEDIA_PLAY_PAUSE:
|
||||||
SetKey("PlayPause");
|
SetKey("PLAYPAUSE");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_NEXTTRACK:
|
case AppCommand.APPCOMMAND_MEDIA_NEXTTRACK:
|
||||||
SetKey("Next");
|
SetKey("NEXT");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_PREVIOUSTRACK:
|
case AppCommand.APPCOMMAND_MEDIA_PREVIOUSTRACK:
|
||||||
SetKey("Prev");
|
SetKey("PREV");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_RECORD:
|
case AppCommand.APPCOMMAND_MEDIA_RECORD:
|
||||||
SetKey("Record");
|
SetKey("RECORD");
|
||||||
break;
|
break;
|
||||||
case AppCommand.MEDIA_STOP:
|
case AppCommand.APPCOMMAND_MEDIA_STOP:
|
||||||
SetKey("Stop");
|
SetKey("STOP");
|
||||||
break;
|
break;
|
||||||
case AppCommand.VolumeUp:
|
case AppCommand.APPCOMMAND_VOLUME_UP:
|
||||||
SetKey("Volume_Up");
|
SetKey("VOLUME_UP");
|
||||||
break;
|
break;
|
||||||
case AppCommand.VolumeDown:
|
case AppCommand.APPCOMMAND_VOLUME_DOWN:
|
||||||
SetKey("Volume_Down");
|
SetKey("VOLUME_DOWN");
|
||||||
break;
|
break;
|
||||||
case AppCommand.VolumeMute:
|
case AppCommand.APPCOMMAND_VOLUME_MUTE:
|
||||||
SetKey("Mute");
|
SetKey("MUTE");
|
||||||
break;
|
break;
|
||||||
default:
|
case AppCommand.APPCOMMAND_BROWSER_HOME:
|
||||||
Msg.ShowError($"AppCommand {value} not supported,\nplease contact support.");
|
SetKey("HOMEPAGE");
|
||||||
|
break;
|
||||||
|
case AppCommand.APPCOMMAND_LAUNCH_MAIL:
|
||||||
|
SetKey("MAIL");
|
||||||
|
break;
|
||||||
|
case AppCommand.APPCOMMAND_BROWSER_FAVORITES:
|
||||||
|
SetKey("FAVORITES");
|
||||||
|
break;
|
||||||
|
case AppCommand.APPCOMMAND_BROWSER_SEARCH:
|
||||||
|
SetKey("SEARCH");
|
||||||
|
break;
|
||||||
|
case AppCommand.APPCOMMAND_PRINT:
|
||||||
|
SetKey("PRINT");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,20 +256,58 @@ namespace mpvnet
|
|||||||
|
|
||||||
internal enum AppCommand
|
internal enum AppCommand
|
||||||
{
|
{
|
||||||
MEDIA_CHANNEL_DOWN = 52,
|
APPCOMMAND_BASS_BOOST = 20,
|
||||||
MEDIA_CHANNEL_UP = 51,
|
APPCOMMAND_BASS_DOWN = 19,
|
||||||
MEDIA_FAST_FORWARD = 49,
|
APPCOMMAND_BASS_UP = 21,
|
||||||
MEDIA_NEXTTRACK = 11,
|
APPCOMMAND_BROWSER_BACKWARD = 1,
|
||||||
MEDIA_PAUSE = 47,
|
APPCOMMAND_BROWSER_FAVORITES = 6,
|
||||||
MEDIA_PLAY = 46,
|
APPCOMMAND_BROWSER_FORWARD = 2,
|
||||||
MEDIA_PLAY_PAUSE = 14,
|
APPCOMMAND_BROWSER_HOME = 7,
|
||||||
MEDIA_PREVIOUSTRACK = 12,
|
APPCOMMAND_BROWSER_REFRESH = 3,
|
||||||
MEDIA_RECORD = 48,
|
APPCOMMAND_BROWSER_SEARCH = 5,
|
||||||
MEDIA_REWIND = 50,
|
APPCOMMAND_BROWSER_STOP = 4,
|
||||||
MEDIA_STOP = 13,
|
APPCOMMAND_CLOSE = 31,
|
||||||
VolumeMute = 8,
|
APPCOMMAND_COPY = 36,
|
||||||
VolumeDown = 9,
|
APPCOMMAND_CORRECTION_LIST = 45,
|
||||||
VolumeUp = 10
|
APPCOMMAND_CUT = 37,
|
||||||
|
APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE = 43,
|
||||||
|
APPCOMMAND_FIND = 28,
|
||||||
|
APPCOMMAND_FORWARD_MAIL = 40,
|
||||||
|
APPCOMMAND_HELP = 27,
|
||||||
|
APPCOMMAND_LAUNCH_APP1 = 17,
|
||||||
|
APPCOMMAND_LAUNCH_APP2 = 18,
|
||||||
|
APPCOMMAND_LAUNCH_MAIL = 15,
|
||||||
|
APPCOMMAND_LAUNCH_MEDIA_SELECT = 16,
|
||||||
|
APPCOMMAND_MEDIA_CHANNEL_DOWN = 52,
|
||||||
|
APPCOMMAND_MEDIA_CHANNEL_UP = 51,
|
||||||
|
APPCOMMAND_MEDIA_FAST_FORWARD = 49,
|
||||||
|
APPCOMMAND_MEDIA_NEXTTRACK = 11,
|
||||||
|
APPCOMMAND_MEDIA_PAUSE = 47,
|
||||||
|
APPCOMMAND_MEDIA_PLAY = 46,
|
||||||
|
APPCOMMAND_MEDIA_PLAY_PAUSE = 14,
|
||||||
|
APPCOMMAND_MEDIA_PREVIOUSTRACK = 12,
|
||||||
|
APPCOMMAND_MEDIA_RECORD = 48,
|
||||||
|
APPCOMMAND_MEDIA_REWIND = 50,
|
||||||
|
APPCOMMAND_MEDIA_STOP = 13,
|
||||||
|
APPCOMMAND_MIC_ON_OFF_TOGGLE = 44,
|
||||||
|
APPCOMMAND_MICROPHONE_VOLUME_DOWN = 25,
|
||||||
|
APPCOMMAND_MICROPHONE_VOLUME_MUTE = 24,
|
||||||
|
APPCOMMAND_MICROPHONE_VOLUME_UP = 26,
|
||||||
|
APPCOMMAND_NEW = 29,
|
||||||
|
APPCOMMAND_OPEN = 30,
|
||||||
|
APPCOMMAND_PASTE = 38,
|
||||||
|
APPCOMMAND_PRINT = 33,
|
||||||
|
APPCOMMAND_REDO = 35,
|
||||||
|
APPCOMMAND_REPLY_TO_MAIL = 39,
|
||||||
|
APPCOMMAND_SAVE = 32,
|
||||||
|
APPCOMMAND_SEND_MAIL = 41,
|
||||||
|
APPCOMMAND_SPELL_CHECK = 42,
|
||||||
|
APPCOMMAND_TREBLE_DOWN = 22,
|
||||||
|
APPCOMMAND_TREBLE_UP = 23,
|
||||||
|
APPCOMMAND_UNDO = 34,
|
||||||
|
APPCOMMAND_VOLUME_DOWN = 9,
|
||||||
|
APPCOMMAND_VOLUME_MUTE = 8,
|
||||||
|
APPCOMMAND_VOLUME_UP = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ namespace mpvnet
|
|||||||
mp.VideoSizeChanged += VideoSizeChanged;
|
mp.VideoSizeChanged += VideoSizeChanged;
|
||||||
mp.FileLoaded += FileLoaded;
|
mp.FileLoaded += FileLoaded;
|
||||||
mp.Idle += Idle;
|
mp.Idle += Idle;
|
||||||
mp.VideoSizeAutoResetEvent.WaitOne(3000);
|
mp.VideoSizeAutoResetEvent.WaitOne(1500);
|
||||||
if (Height < FontHeight * 3) SetFormPosAndSize();
|
if (Height < FontHeight * 4) SetFormPosAndSize();
|
||||||
mp.observe_property_bool("fullscreen", PropChangeFullscreen);
|
mp.observe_property_bool("fullscreen", PropChangeFullscreen);
|
||||||
mp.observe_property_bool("ontop", PropChangeOnTop);
|
mp.observe_property_bool("ontop", PropChangeOnTop);
|
||||||
mp.observe_property_bool("border", PropChangeBorder);
|
mp.observe_property_bool("border", PropChangeBorder);
|
||||||
@@ -246,7 +246,7 @@ namespace mpvnet
|
|||||||
if (mp.VideoSize.Height == 0 || mp.VideoSize.Width == 0 ||
|
if (mp.VideoSize.Height == 0 || mp.VideoSize.Width == 0 ||
|
||||||
mp.VideoSize.Width / (float)mp.VideoSize.Height < 1.3)
|
mp.VideoSize.Width / (float)mp.VideoSize.Height < 1.3)
|
||||||
|
|
||||||
mp.VideoSize = new Size((int)(autoFitHeight * 1.7), autoFitHeight);
|
mp.VideoSize = new Size((int)(autoFitHeight * (16 / 9.0)), autoFitHeight);
|
||||||
|
|
||||||
Size size = mp.VideoSize;
|
Size size = mp.VideoSize;
|
||||||
|
|
||||||
@@ -387,11 +387,14 @@ namespace mpvnet
|
|||||||
case 0x0202: // WM_LBUTTONUP
|
case 0x0202: // WM_LBUTTONUP
|
||||||
case 0x0207: // WM_MBUTTONDOWN
|
case 0x0207: // WM_MBUTTONDOWN
|
||||||
case 0x0208: // WM_MBUTTONUP
|
case 0x0208: // WM_MBUTTONUP
|
||||||
|
case 0x020b: // WM_XBUTTONDOWN
|
||||||
|
case 0x020c: // WM_XBUTTONUP
|
||||||
case 0x020A: // WM_MOUSEWHEEL
|
case 0x020A: // WM_MOUSEWHEEL
|
||||||
case 0x0100: // WM_KEYDOWN
|
case 0x0100: // WM_KEYDOWN
|
||||||
case 0x0101: // WM_KEYUP
|
case 0x0101: // WM_KEYUP
|
||||||
case 0x0104: // WM_SYSKEYDOWN
|
case 0x0104: // WM_SYSKEYDOWN
|
||||||
case 0x0105: // WM_SYSKEYUP
|
case 0x0105: // WM_SYSKEYUP
|
||||||
|
case 0x319: // WM_APPCOMMAND
|
||||||
if (mp.WindowHandle != IntPtr.Zero)
|
if (mp.WindowHandle != IntPtr.Zero)
|
||||||
Native.SendMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam);
|
Native.SendMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam);
|
||||||
break;
|
break;
|
||||||
@@ -405,10 +408,6 @@ namespace mpvnet
|
|||||||
case 0x2a3: // WM_MOUSELEAVE
|
case 0x2a3: // WM_MOUSELEAVE
|
||||||
mp.command_string("mouse 1 1"); // osc won't always auto hide
|
mp.command_string("mouse 1 1"); // osc won't always auto hide
|
||||||
break;
|
break;
|
||||||
case 0x319: // WM_APPCOMMAND
|
|
||||||
if (mp.WindowHandle != IntPtr.Zero)
|
|
||||||
Native.PostMessage(mp.WindowHandle, m.Msg, m.WParam, m.LParam);
|
|
||||||
break;
|
|
||||||
case 0x203: // Native.WM.LBUTTONDBLCLK
|
case 0x203: // Native.WM.LBUTTONDBLCLK
|
||||||
{
|
{
|
||||||
Point pos = PointToClient(Cursor.Position);
|
Point pos = PointToClient(Cursor.Position);
|
||||||
@@ -567,12 +566,6 @@ namespace mpvnet
|
|||||||
Native.PostMessage(Handle, 0xA1 /* WM_NCLBUTTONDOWN */, HTCAPTION, IntPtr.Zero);
|
Native.PostMessage(Handle, 0xA1 /* WM_NCLBUTTONDOWN */, HTCAPTION, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Button == MouseButtons.XButton1)
|
|
||||||
mp.command_string($"mouse {e.Location.X} {e.Location.Y} 7 single");
|
|
||||||
|
|
||||||
if (e.Button == MouseButtons.XButton2)
|
|
||||||
mp.command_string($"mouse {e.Location.X} {e.Location.Y} 8 single");
|
|
||||||
|
|
||||||
if (Width - e.Location.X < 10 && e.Location.Y < 10)
|
if (Width - e.Location.X < 10 && e.Location.Y < 10)
|
||||||
mp.commandv("quit");
|
mp.commandv("quit");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
using WinForms = System.Windows.Forms;
|
||||||
|
|
||||||
using static mpvnet.libmpv;
|
using static mpvnet.libmpv;
|
||||||
using static mpvnet.Native;
|
using static mpvnet.Native;
|
||||||
|
|
||||||
@@ -66,8 +68,8 @@ namespace mpvnet
|
|||||||
public static List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
|
public static List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
|
||||||
public static List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>();
|
public static List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>();
|
||||||
|
|
||||||
public static string InputConfPath { get; } = ConfFolder + "\\input.conf";
|
public static string InputConfPath { get; } = ConfigFolder + "\\input.conf";
|
||||||
public static string ConfPath { get; } = ConfFolder + "\\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; } = "";
|
||||||
@@ -86,6 +88,7 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
LoadLibrary("mpv-1.dll");
|
LoadLibrary("mpv-1.dll");
|
||||||
Handle = mpv_create();
|
Handle = mpv_create();
|
||||||
|
set_property_string("config-dir", ConfigFolder);
|
||||||
set_property_string("osc", "yes");
|
set_property_string("osc", "yes");
|
||||||
set_property_string("config", "yes");
|
set_property_string("config", "yes");
|
||||||
set_property_string("wid", MainForm.Hwnd.ToString());
|
set_property_string("wid", MainForm.Hwnd.ToString());
|
||||||
@@ -115,48 +118,61 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static string _ConfFolder;
|
static string _ConfigFolder;
|
||||||
|
|
||||||
public static string ConfFolder {
|
public static string ConfigFolder {
|
||||||
get {
|
get {
|
||||||
if (_ConfFolder == null)
|
if (_ConfigFolder == null)
|
||||||
{
|
{
|
||||||
string portableFolder = Application.StartupPath + "\\portable_config\\";
|
_ConfigFolder = Application.StartupPath + "\\portable_config\\";
|
||||||
string appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\";
|
|
||||||
string startupFolder = Application.StartupPath + "\\";
|
|
||||||
|
|
||||||
if (!Directory.Exists(appdataFolder) && !Directory.Exists(portableFolder) &&
|
if (!Directory.Exists(_ConfigFolder))
|
||||||
Sys.IsDirectoryWritable(Application.StartupPath) &&
|
_ConfigFolder = RegHelp.GetString(App.RegPath, "ConfigFolder");
|
||||||
!File.Exists(startupFolder + "mpv.conf"))
|
|
||||||
|
if (!Directory.Exists(_ConfigFolder))
|
||||||
{
|
{
|
||||||
|
string portableFolder = Application.StartupPath + "\\portable_config\\";
|
||||||
|
string appdataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv.net\\";
|
||||||
|
string appdataFolderMpv = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\mpv\\";
|
||||||
|
string startupFolder = Application.StartupPath + "\\";
|
||||||
|
|
||||||
using (TaskDialog<string> td = new TaskDialog<string>())
|
using (TaskDialog<string> td = new TaskDialog<string>())
|
||||||
{
|
{
|
||||||
td.MainInstruction = "Choose a settings folder.";
|
td.MainInstruction = "Choose a settings folder.";
|
||||||
td.Content = "[MPV documentation about files on Windows.](https://mpv.io/manual/master/#files-on-windows)";
|
td.AddCommandLink(@"AppData\Roaming\mpv.net", appdataFolder, appdataFolder);
|
||||||
td.AddCommandLink("appdata", appdataFolder, appdataFolder);
|
td.AddCommandLink(@"AppData\Roaming\mpv", appdataFolderMpv, appdataFolderMpv);
|
||||||
td.AddCommandLink("portable", portableFolder, portableFolder);
|
td.AddCommandLink("<startup>\\portable_config", portableFolder, portableFolder);
|
||||||
td.AddCommandLink("startup", startupFolder, startupFolder);
|
td.AddCommandLink("<startup>", startupFolder, startupFolder);
|
||||||
|
td.AddCommandLink("Choose custom folder", "custom");
|
||||||
td.AllowCancel = false;
|
td.AllowCancel = false;
|
||||||
_ConfFolder = td.Show();
|
_ConfigFolder = td.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_ConfigFolder == "custom")
|
||||||
|
{
|
||||||
|
using (var d = new WinForms.FolderBrowserDialog())
|
||||||
|
{
|
||||||
|
d.Description = "Choose a folder.";
|
||||||
|
if (d.ShowDialog() == WinForms.DialogResult.OK)
|
||||||
|
_ConfigFolder = d.SelectedPath + "\\";
|
||||||
|
else
|
||||||
|
_ConfigFolder = appdataFolder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Directory.Exists(portableFolder))
|
|
||||||
_ConfFolder = portableFolder;
|
|
||||||
else if (Directory.Exists(appdataFolder))
|
|
||||||
_ConfFolder = appdataFolder;
|
|
||||||
else if (File.Exists(Application.StartupPath + "\\mpv.conf"))
|
|
||||||
_ConfFolder = Application.StartupPath + "\\";
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(_ConfFolder)) _ConfFolder = appdataFolder;
|
if (!Directory.Exists(_ConfigFolder))
|
||||||
if (!Directory.Exists(_ConfFolder)) Directory.CreateDirectory(_ConfFolder);
|
Directory.CreateDirectory(_ConfigFolder);
|
||||||
|
|
||||||
if (!File.Exists(_ConfFolder + "\\input.conf"))
|
RegHelp.SetObject(App.RegPath, "ConfigFolder", _ConfigFolder);
|
||||||
File.WriteAllText(_ConfFolder + "\\input.conf", Properties.Resources.inputConf);
|
|
||||||
|
|
||||||
if (!File.Exists(_ConfFolder + "\\mpv.conf"))
|
if (!File.Exists(_ConfigFolder + "\\input.conf"))
|
||||||
File.WriteAllText(_ConfFolder + "\\mpv.conf", Properties.Resources.mpvConf);
|
File.WriteAllText(_ConfigFolder + "\\input.conf", Properties.Resources.inputConf);
|
||||||
|
|
||||||
|
if (!File.Exists(_ConfigFolder + "\\mpv.conf"))
|
||||||
|
File.WriteAllText(_ConfigFolder + "\\mpv.conf", Properties.Resources.mpvConf);
|
||||||
}
|
}
|
||||||
return _ConfFolder;
|
return _ConfigFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,22 +198,26 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void LoadScripts()
|
public static void LoadScripts()
|
||||||
{
|
{
|
||||||
string[] startupScripts = Directory.GetFiles(Application.StartupPath + "\\Scripts");
|
|
||||||
|
|
||||||
foreach (string scriptPath in startupScripts)
|
if (Directory.Exists(Application.StartupPath + "\\Scripts"))
|
||||||
if (scriptPath.EndsWith(".lua") || scriptPath.EndsWith(".js"))
|
{
|
||||||
commandv("load-script", $"{scriptPath}");
|
string[] startupScripts = Directory.GetFiles(Application.StartupPath + "\\Scripts");
|
||||||
|
|
||||||
foreach (string scriptPath in startupScripts)
|
foreach (string scriptPath in startupScripts)
|
||||||
if (Path.GetExtension(scriptPath) == ".py")
|
if (scriptPath.EndsWith(".lua") || scriptPath.EndsWith(".js"))
|
||||||
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
|
commandv("load-script", $"{scriptPath}");
|
||||||
|
|
||||||
foreach (string scriptPath in startupScripts)
|
foreach (string scriptPath in startupScripts)
|
||||||
if (Path.GetExtension(scriptPath) == ".ps1")
|
if (Path.GetExtension(scriptPath) == ".py")
|
||||||
PowerShellScript.Init(scriptPath);
|
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
|
||||||
|
|
||||||
if (Directory.Exists(ConfFolder + "Scripts"))
|
foreach (string scriptPath in startupScripts)
|
||||||
foreach (string scriptPath in Directory.GetFiles(ConfFolder + "Scripts"))
|
if (Path.GetExtension(scriptPath) == ".ps1")
|
||||||
|
PowerShellScript.Init(scriptPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Directory.Exists(ConfigFolder + "Scripts"))
|
||||||
|
foreach (string scriptPath in Directory.GetFiles(ConfigFolder + "Scripts"))
|
||||||
if (Path.GetExtension(scriptPath) == ".py")
|
if (Path.GetExtension(scriptPath) == ".py")
|
||||||
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
|
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
|
||||||
else if (Path.GetExtension(scriptPath) == ".ps1")
|
else if (Path.GetExtension(scriptPath) == ".ps1")
|
||||||
@@ -657,7 +677,7 @@ namespace mpvnet
|
|||||||
|
|
||||||
if (File.Exists(LastHistoryPath) && totalMinutes > 1)
|
if (File.Exists(LastHistoryPath) && totalMinutes > 1)
|
||||||
{
|
{
|
||||||
string historyFilepath = ConfFolder + "history.txt";
|
string historyFilepath = ConfigFolder + "history.txt";
|
||||||
|
|
||||||
File.AppendAllText(historyFilepath, DateTime.Now.ToString().Substring(0, 16) +
|
File.AppendAllText(historyFilepath, DateTime.Now.ToString().Substring(0, 16) +
|
||||||
" " + totalMinutes.ToString().PadLeft(3) + " " +
|
" " + totalMinutes.ToString().PadLeft(3) + " " +
|
||||||
@@ -698,7 +718,6 @@ namespace mpvnet
|
|||||||
lock (MediaTracks)
|
lock (MediaTracks)
|
||||||
{
|
{
|
||||||
MediaTracks.Clear();
|
MediaTracks.Clear();
|
||||||
|
|
||||||
string path = get_property_string("path");
|
string path = get_property_string("path");
|
||||||
|
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
@@ -779,7 +798,6 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (Chapters)
|
lock (Chapters)
|
||||||
|
|||||||
Reference in New Issue
Block a user