misc...
This commit is contained in:
@@ -14,6 +14,12 @@ not yet released
|
||||
- Ctrl+v (previously u) opens files (or URLs) from the clipboard,
|
||||
previously it had to be a file path (format string) and now
|
||||
it can also be the clipboard format of type file.
|
||||
- The usability of the menu structure was improved.
|
||||
- Audio and subtitle tracks and various other features
|
||||
are now available in the command palette.
|
||||
- Single character input in the command palette searches exclusivly
|
||||
key bindings much like the search field of the input editor.
|
||||
- Various default key bindings improved.
|
||||
- libmpv zhongfly 2022-02-27
|
||||
|
||||
|
||||
|
||||
@@ -123,13 +123,30 @@ input.conf file, if it's missing mpv.net generates it with the following default
|
||||
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
|
||||
items. The only way to get an up-to-date menu is either resetting the menu by
|
||||
deleting input.conf or updating it by manually editing input.conf. This is
|
||||
currently the biggest design problem of mpv.net and it's difficult to overcome.
|
||||
deleting input.conf or updating it by manually editing input.conf.
|
||||
|
||||
Global keyboard shortcuts are supported via global-input.conf file.
|
||||
|
||||
The config folder can be opened from the context menu: `Settings > Open Config Folder`
|
||||
|
||||
A input and config editor can be found in the context menu under 'Settings'.
|
||||
|
||||
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:
|
||||
https://github.com/stax76/mpv.net/blob/master/src/Resources/input.conf.txt
|
||||
|
||||
mpv input.conf defaults:
|
||||
https://github.com/mpv-player/mpv/blob/master/etc/input.conf
|
||||
|
||||
mpv input commands:
|
||||
https://mpv.io/manual/master/#list-of-input-commands
|
||||
|
||||
mpv input options:
|
||||
https://mpv.io/manual/master/#input
|
||||
|
||||
Command Line Interface
|
||||
----------------------
|
||||
|
||||
@@ -13,6 +13,8 @@ using System.Windows.Interop;
|
||||
using WinForms = System.Windows.Forms;
|
||||
|
||||
using static mpvnet.Global;
|
||||
using System.Windows.Media;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
@@ -22,9 +24,10 @@ namespace mpvnet
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
|
||||
case "add-files-to-playlist": OpenFiles("append"); break; // deprecated 2019
|
||||
case "cycle-audio": CycleAudio(); break;
|
||||
case "execute-mpv-command": Msg.ShowError("Command was removed, reset input.conf."); break;
|
||||
case "execute-mpv-command": Msg.ShowError("Command was removed, reset input.conf."); break; // deprecated 2020
|
||||
case "load-audio": LoadAudio(); break;
|
||||
case "load-sub": LoadSubtitle(); break;
|
||||
case "open-conf-folder": ProcessHelp.ShellExecute(Core.ConfigFolder); break;
|
||||
@@ -38,22 +41,24 @@ namespace mpvnet
|
||||
case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
|
||||
case "shell-execute": ProcessHelp.ShellExecute(args[0]); break;
|
||||
case "show-about": ShowDialog(typeof(AboutWindow)); break;
|
||||
case "show-audio-devices": ShowTextWithEditor("audio-device-list", Core.GetPropertyOsdString("audio-device-list")); break;
|
||||
case "show-audio-devices": Msg.ShowInfo(Core.GetPropertyOsdString("audio-device-list")); break;
|
||||
case "show-audio-tracks": ShowAudioTracks(); break;
|
||||
case "show-command-palette": ShowCommandPalette(); break;
|
||||
case "show-commands": ShowCommands(); break;
|
||||
case "show-conf-editor": ShowDialog(typeof(ConfWindow)); break;
|
||||
case "show-decoders": ShowTextWithEditor("decoder-list", mpvHelp.GetDecoders()); break;
|
||||
case "show-demuxers": ShowTextWithEditor("demuxer-lavf-list", mpvHelp.GetDemuxers()); break;
|
||||
case "show-decoders": ShowStrings(mpvHelp.GetDecoders().Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); break;
|
||||
case "show-demuxers": ShowStrings(mpvHelp.GetDemuxers().Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); break;
|
||||
case "show-history": ShowHistory(); break;
|
||||
case "show-info": ShowInfo(); break;
|
||||
case "show-input-editor": ShowDialog(typeof(InputWindow)); break;
|
||||
case "show-keys": ShowTextWithEditor("input-key-list", Core.GetPropertyString("input-key-list").Replace(",", BR)); break;
|
||||
case "show-keys": ShowStrings(Core.GetPropertyString("input-key-list").Split(',')); break;
|
||||
case "show-media-info": ShowMediaInfo(args); break;
|
||||
case "show-playlist": ShowPlaylist(); break;
|
||||
case "show-profiles": ShowTextWithEditor("profile-list", mpvHelp.GetProfiles()); break;
|
||||
case "show-profiles": Msg.ShowInfo(mpvHelp.GetProfiles()); break;
|
||||
case "show-properties": ShowProperties(); break;
|
||||
case "show-protocols": ShowTextWithEditor("protocol-list", mpvHelp.GetProtocols()); break;
|
||||
case "show-protocols": ShowStrings(mpvHelp.GetProtocols().Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)); break;
|
||||
case "show-recent": ShowRecent(); break;
|
||||
case "show-subtitle-tracks": ShowSubtitleTracks(); break;
|
||||
case "show-text": ShowText(args[0], Convert.ToInt32(args[1]), Convert.ToInt32(args[2])); break;
|
||||
case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
|
||||
|
||||
@@ -342,15 +347,7 @@ namespace mpvnet
|
||||
}
|
||||
}
|
||||
|
||||
ShowTextWithEditor("command-list", sb.ToString());
|
||||
}
|
||||
|
||||
public static void ShowTextWithEditor(string name, string text)
|
||||
{
|
||||
string file = Path.Combine(Path.GetTempPath(), name + ".txt");
|
||||
App.TempFiles.Add(file);
|
||||
File.WriteAllText(file, BR + text.Trim() + BR);
|
||||
ProcessHelp.ShellExecute(file);
|
||||
Msg.ShowInfo(sb.ToString());
|
||||
}
|
||||
|
||||
public static void ScaleWindow(float factor) => Core.RaiseScaleWindow(factor);
|
||||
@@ -383,29 +380,98 @@ namespace mpvnet
|
||||
bool full = args.Contains("full");
|
||||
bool raw = args.Contains("raw");
|
||||
string text = mediaInfo.GetSummary(full, raw);
|
||||
ShowTextWithEditor(Path.GetFileName(path), text);
|
||||
text = Regex.Replace(text, "Unique ID.+", "");
|
||||
MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Consolas");
|
||||
Msg.ShowInfo(text);
|
||||
MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Segoe UI");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShowCommandPalette() => App.InvokeOnMainThread(ShowCommandPaletteInternal);
|
||||
|
||||
static void ShowCommandPaletteInternal()
|
||||
public static void ShowCommandPalette() => App.InvokeOnMainThread(() =>
|
||||
{
|
||||
CommandPalette.Instance.SetItems(CommandPalette.GetItems());
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
CommandPalette.Instance.SelectFirst();
|
||||
});
|
||||
|
||||
public static void ShowAudioTracks() => App.InvokeOnMainThread(() =>
|
||||
{
|
||||
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray();
|
||||
int len = tracks.Length;
|
||||
|
||||
if (len < 1)
|
||||
{
|
||||
Core.CommandV("show-text", "No audio tracks");
|
||||
return;
|
||||
}
|
||||
|
||||
public static void ShowPlaylist() => App.InvokeOnMainThread(ShowPlaylistInternal);
|
||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||
|
||||
static void ShowPlaylistInternal()
|
||||
foreach (MediaTrack i in tracks)
|
||||
{
|
||||
MediaTrack track = i;
|
||||
|
||||
CommandPaletteItem item = new CommandPaletteItem()
|
||||
{
|
||||
Text = track.Text,
|
||||
Action = () => {
|
||||
Core.CommandV("set", "aid", track.ID.ToString());
|
||||
Core.CommandV("show-text", track.ID + "/" + len + ": " +
|
||||
tracks[track.ID - 1].Text.Substring(3), "5000");
|
||||
}
|
||||
};
|
||||
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
CommandPalette.Instance.SetItems(items);
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
CommandPalette.Instance.SelectFirst();
|
||||
});
|
||||
|
||||
public static void ShowSubtitleTracks() => App.InvokeOnMainThread(() =>
|
||||
{
|
||||
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "s").ToArray();
|
||||
int len = tracks.Length;
|
||||
|
||||
if (len < 1)
|
||||
{
|
||||
Core.CommandV("show-text", "No subtitle tracks");
|
||||
return;
|
||||
}
|
||||
|
||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||
|
||||
foreach (MediaTrack i in tracks)
|
||||
{
|
||||
MediaTrack track = i;
|
||||
|
||||
CommandPaletteItem item = new CommandPaletteItem()
|
||||
{
|
||||
Text = track.Text,
|
||||
Action = () => {
|
||||
Core.CommandV("set", "sid", track.ID.ToString());
|
||||
Core.CommandV("show-text", track.ID + "/" + len + ": " +
|
||||
tracks[track.ID - 1].Text.Substring(3), "5000");
|
||||
}
|
||||
};
|
||||
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
CommandPalette.Instance.SetItems(items);
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
CommandPalette.Instance.SelectFirst();
|
||||
});
|
||||
|
||||
public static void ShowPlaylist() => App.InvokeOnMainThread(() =>
|
||||
{
|
||||
int count = Core.GetPropertyInt("playlist-count");
|
||||
string currentPath = Core.GetPropertyString("path");
|
||||
CommandPaletteItem currentItem = null;
|
||||
|
||||
if (count <= 0)
|
||||
if (count < 1)
|
||||
return;
|
||||
|
||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||
@@ -415,7 +481,8 @@ namespace mpvnet
|
||||
int index = i;
|
||||
string file = Core.GetPropertyString($"playlist/{i}/filename");
|
||||
|
||||
CommandPaletteItem item = new CommandPaletteItem() {
|
||||
CommandPaletteItem item = new CommandPaletteItem()
|
||||
{
|
||||
Text = file.FileName(),
|
||||
Action = () => {
|
||||
Core.SetPropertyInt("playlist-pos", index);
|
||||
@@ -441,11 +508,9 @@ namespace mpvnet
|
||||
}
|
||||
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
}
|
||||
});
|
||||
|
||||
public static void ShowProperties() => App.InvokeOnMainThread(ShowPropertiesInternal);
|
||||
|
||||
public static void ShowPropertiesInternal()
|
||||
public static void ShowProperties() => App.InvokeOnMainThread(() =>
|
||||
{
|
||||
var props = Core.GetPropertyString("property-list").Split(',').OrderBy(prop => prop);
|
||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||
@@ -473,11 +538,9 @@ namespace mpvnet
|
||||
|
||||
CommandPalette.Instance.SetItems(items);
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
}
|
||||
});
|
||||
|
||||
public static void ShowRecent() => App.InvokeOnMainThread(ShowRecentInternal);
|
||||
|
||||
static void ShowRecentInternal()
|
||||
public static void ShowRecent() => App.InvokeOnMainThread(() =>
|
||||
{
|
||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||
|
||||
@@ -497,7 +560,7 @@ namespace mpvnet
|
||||
CommandPalette.Instance.SetItems(items);
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
CommandPalette.Instance.SelectFirst();
|
||||
}
|
||||
});
|
||||
|
||||
public static void RegisterFileAssociations(string perceivedType)
|
||||
{
|
||||
@@ -531,5 +594,27 @@ namespace mpvnet
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public static void ShowStrings(string[] strings) => App.InvokeOnMainThread(() =>
|
||||
{
|
||||
List<CommandPaletteItem> items = new List<CommandPaletteItem>();
|
||||
|
||||
foreach (string i in strings)
|
||||
{
|
||||
string str = i;
|
||||
|
||||
CommandPaletteItem item = new CommandPaletteItem()
|
||||
{
|
||||
Text = str,
|
||||
Action = () => Msg.ShowInfo(str)
|
||||
};
|
||||
|
||||
items.Add(item);
|
||||
}
|
||||
|
||||
CommandPalette.Instance.SetItems(items);
|
||||
MainForm.Instance.ShowCommandPalette();
|
||||
CommandPalette.Instance.SelectFirst();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,15 @@ namespace mpvnet
|
||||
_ConfigFolder = _ConfigFolder.AddSep();
|
||||
|
||||
if (!File.Exists(_ConfigFolder + "input.conf"))
|
||||
File.WriteAllText(_ConfigFolder + "input.conf", Properties.Resources.input_conf);
|
||||
{
|
||||
string content = Properties.Resources.input_conf;
|
||||
|
||||
if (Environment.GetEnvironmentVariable("username") == "frank")
|
||||
content = content.Replace("volume 2 ", "volume 10")
|
||||
.Replace("volume -2 ", "volume -10");
|
||||
|
||||
File.WriteAllText(_ConfigFolder + "input.conf", content);
|
||||
}
|
||||
}
|
||||
|
||||
return _ConfigFolder;
|
||||
|
||||
@@ -228,6 +228,7 @@ namespace mpvnet
|
||||
public string Text { get; set; } = "";
|
||||
public string SecondaryText { get; set; } = "";
|
||||
public Action Action { get; set; }
|
||||
public CommandItem CommandItem { get; set; }
|
||||
}
|
||||
|
||||
public class CommandPalette
|
||||
@@ -241,7 +242,8 @@ namespace mpvnet
|
||||
.Select(i => new CommandPaletteItem() {
|
||||
Text = i.Display,
|
||||
SecondaryText = i.Input,
|
||||
Action = () => Core.Command(i.Command)
|
||||
Action = () => Core.Command(i.Command),
|
||||
CommandItem = i
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,5 @@
|
||||
|
||||
# This file defines the key and mouse bindings and also the context menu of mpv.net.
|
||||
|
||||
# A input and config editor can be found in the context menu under 'Settings'.
|
||||
|
||||
# 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 > Show Keys
|
||||
|
||||
# mpv.net input.conf defaults:
|
||||
# https://github.com/stax76/mpv.net/blob/master/src/Resources/input.conf.txt
|
||||
|
||||
# mpv input.conf defaults:
|
||||
# https://github.com/mpv-player/mpv/blob/master/etc/input.conf
|
||||
|
||||
# mpv input commands:
|
||||
# https://mpv.io/manual/master/#list-of-input-commands
|
||||
|
||||
# mpv input options:
|
||||
# https://mpv.io/manual/master/#input
|
||||
# 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
|
||||
@@ -113,8 +94,6 @@ _ ignore #menu: Track
|
||||
|
||||
+ add volume 2 #menu: Volume > Up
|
||||
- add volume -2 #menu: Volume > Down
|
||||
0 add volume 2 #menu: Volume > Up
|
||||
9 add volume -2 #menu: Volume > Down
|
||||
_ ignore #menu: Volume > -
|
||||
m cycle mute #menu: Volume > Mute
|
||||
|
||||
@@ -126,8 +105,6 @@ _ ignore #menu: Speed > -
|
||||
_ ignore #menu: Speed > -
|
||||
BS set speed 1 #menu: Speed > Reset
|
||||
|
||||
Ctrl+t set ontop yes #menu: View > On Top > Enable
|
||||
Ctrl+T set ontop no #menu: View > On Top > Disable
|
||||
Alt++ script-message mpv.net scale-window 1.2 #menu: View > Zoom > Enlarge
|
||||
Alt+- script-message mpv.net scale-window 0.8 #menu: View > Zoom > Shrink
|
||||
_ ignore #menu: View > Zoom > -
|
||||
@@ -135,32 +112,37 @@ Alt+0 script-message mpv.net window-scale 0.5 #menu: View > Zoom > 50 %
|
||||
Alt+1 script-message mpv.net window-scale 1.0 #menu: View > Zoom > 100 %
|
||||
Alt+2 script-message mpv.net window-scale 2.0 #menu: View > Zoom > 200 %
|
||||
Alt+3 script-message mpv.net window-scale 3.0 #menu: View > Zoom > 300 %
|
||||
|
||||
F8 script-message mpv.net show-playlist #menu: View > Show Playlist
|
||||
Ctrl+7 script-message mpv.net show-audio-tracks #menu: View > Show Audio Tracks
|
||||
Ctrl+8 script-message mpv.net show-subtitle-tracks #menu: View > Show Subtitle Tracks
|
||||
b cycle border #menu: View > Toggle Border
|
||||
i script-message mpv.net show-info #menu: View > File/Stream Info
|
||||
Ctrl+t cycle ontop #menu: View > Toggle On Top
|
||||
t script-binding stats/display-stats-toggle #menu: View > Toggle Statistics
|
||||
Del script-binding osc/visibility #menu: View > Toggle OSC Visibility
|
||||
Ctrl+r cycle-values video-rotate 90 180 270 0 #menu: View > Rotate Video
|
||||
T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics
|
||||
t script-binding stats/display-stats #menu: View > Show Statistics
|
||||
_ script-message mpv.net show-audio-devices #menu: View > Show Audio Devices
|
||||
C script-message mpv.net show-commands #menu: View > Show Commands
|
||||
` script-binding console/enable #menu: View > Show Console
|
||||
_ script-message mpv.net show-decoders #menu: View > Show Decoders
|
||||
_ script-message mpv.net show-demuxers #menu: View > Show Demuxers
|
||||
_ script-message mpv.net show-keys #menu: View > Show Keys
|
||||
F8 script-message mpv.net show-playlist #menu: View > Show Playlist
|
||||
Ctrl+p script-message mpv.net show-profiles #menu: View > Show Profiles
|
||||
i script-message mpv.net show-info #menu: View > Show File/Stream Info
|
||||
p show-progress #menu: View > Show Progress
|
||||
P script-message mpv.net show-properties #menu: View > Show Properties
|
||||
_ script-message mpv.net show-protocols #menu: View > Show Protocols
|
||||
Ctrl+p script-message mpv.net show-profiles #menu: View > Show Profiles
|
||||
F9 show-text ${track-list} 5000 #menu: View > Show Tracks
|
||||
Ctrl+m script-message mpv.net show-media-info #menu: View > Show Media Info
|
||||
Alt+r script-message mpv.net show-recent #menu: View > Show Recent
|
||||
|
||||
` script-binding console/enable #menu: View > Advanced > Show Console
|
||||
_ script-message mpv.net show-audio-devices #menu: View > Advanced > Show Audio Devices
|
||||
P script-message mpv.net show-properties #menu: View > Advanced > Show Properties
|
||||
C script-message mpv.net show-commands #menu: View > Advanced > Show Commands
|
||||
_ script-message mpv.net show-demuxers #menu: View > Advanced > Show Demuxers
|
||||
_ script-message mpv.net show-decoders #menu: View > Advanced > Show Decoders
|
||||
_ script-message mpv.net show-protocols #menu: View > Advanced > Show Protocols
|
||||
_ script-message mpv.net show-keys #menu: View > Advanced > Show Keys
|
||||
|
||||
_ ignore #menu: Profile
|
||||
|
||||
c script-message mpv.net show-conf-editor #menu: Settings > Show Config Editor
|
||||
Ctrl+i script-message mpv.net show-input-editor #menu: Settings > Show Input Editor
|
||||
Ctrl+f script-message mpv.net open-conf-folder #menu: Settings > Open Config Folder
|
||||
|
||||
_ script-message mpv.net reg-file-assoc video #menu: Settings > Setup > Register video file associations
|
||||
_ script-message mpv.net reg-file-assoc audio #menu: Settings > Setup > Register audio file associations
|
||||
_ script-message mpv.net reg-file-assoc image #menu: Settings > Setup > Register image file associations
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace mpvnet
|
||||
{
|
||||
@@ -91,6 +90,11 @@ namespace mpvnet
|
||||
{
|
||||
string filter = SearchControl.SearchTextBox.Text.ToLower();
|
||||
|
||||
if (filter.Length == 1 && item.CommandItem != null)
|
||||
return item.CommandItem.Input.ToLower().Replace("ctrl+", "")
|
||||
.Replace("shift+", "")
|
||||
.Replace("alt+", "") == filter.ToLower();
|
||||
|
||||
if (filter == "" || item.Text.ToLower().Contains(filter) ||
|
||||
item.SecondaryText.ToLower().Contains(filter))
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace MsgBoxEx
|
||||
{
|
||||
if (!IsFontFamilyValid(familyName))
|
||||
if (!string.IsNullOrEmpty(familyName))
|
||||
MsgFontFamily = new System.Windows.Media.FontFamily(familyName);
|
||||
MsgFontFamily = new FontFamily(familyName);
|
||||
MsgFontSize = Math.Max(1.0, size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user