v7.0.0.6 Beta
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
|
||||
# v7.0.0.6 Beta (2023-01-02)
|
||||
|
||||
- Improved backward compatibility with input.conf files created by old versions.
|
||||
|
||||
|
||||
# v7.0.0.5 Beta (2023-12-28)
|
||||
|
||||
- Fix mpv.net option `language` not working from command line.
|
||||
|
||||
@@ -270,6 +270,21 @@ Shows available audio devices in a message box.
|
||||
### show-commands
|
||||
Shows available [mpv input commands](https://mpv.io/manual/master/#list-of-input-commands).
|
||||
|
||||
### show-properties
|
||||
Shows available [properties](https://mpv.io/manual/master/#properties).
|
||||
|
||||
### show-keys
|
||||
Shows available [input keys](https://mpv.io/manual/master/#options-input-keylist).
|
||||
|
||||
### show-protocols
|
||||
Shows available [protocols](https://mpv.io/manual/master/#options-list-protocols).
|
||||
|
||||
### show-decoders
|
||||
Shows available decoders.
|
||||
|
||||
### show-demuxers
|
||||
Shows available demuxers.
|
||||
|
||||
### show-conf-editor
|
||||
Shows the conf editor.
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
@@ -11,9 +12,8 @@ using MpvNet.Windows.WinForms;
|
||||
using MpvNet.Windows.WPF.Views;
|
||||
using MpvNet.Windows.WPF;
|
||||
using MpvNet.Windows.WPF.MsgBox;
|
||||
using MpvNet.Help;
|
||||
using System.Text.Json;
|
||||
using MpvNet.Windows.Help;
|
||||
using MpvNet.Help;
|
||||
|
||||
namespace MpvNet;
|
||||
|
||||
@@ -47,27 +47,35 @@ public class GuiCommand
|
||||
["window-scale"] = args => WindowScaleNet?.Invoke(float.Parse(args[0], CultureInfo.InvariantCulture)),
|
||||
["show-menu"] = args => ShowMenu?.Invoke(),
|
||||
["show-bindings"] = args => ShowBindings(),
|
||||
["show-playlist"] = args => ShowPlaylist(),
|
||||
["add-to-path"] = args => AddToPath(),
|
||||
["edit-conf-file"] = EditCongFile,
|
||||
["show-commands"] = args => ShowCommands(),
|
||||
["show-properties"] = args => ShowProperties(),
|
||||
["show-keys"] = args => ShowKeys(),
|
||||
["show-protocols"] = args => ShowProtocols(),
|
||||
["show-decoders"] = args => ShowDecoders(),
|
||||
["show-demuxers"] = args => ShowDemuxers(),
|
||||
["show-info"] = args => ShowMediaInfo(new[] { "osd" }),
|
||||
|
||||
|
||||
// deprecated
|
||||
["show-info"] = args => ShowMediaInfo(new[] { "osd" }), // deprecated
|
||||
["show-recent"] = args => ShowRemoved(), // deprecated
|
||||
["show-playlist"] = args => ShowPlaylist(), // deprecated
|
||||
["quick-bookmark"] = args => QuickBookmark(), // deprecated
|
||||
["show-history"] = args => ShowHistory(), // deprecated
|
||||
["show-command-palette"] = args => ShowCommandPalette(), // deprecated
|
||||
["show-audio-tracks"] = args => ShowTracks(), // deprecated
|
||||
["show-subtitle-tracks"] = args => ShowTracks(), // deprecated
|
||||
};
|
||||
|
||||
public void ShowDialog(Type winType)
|
||||
void ShowDialog(Type winType)
|
||||
{
|
||||
Window? win = Activator.CreateInstance(winType) as Window;
|
||||
new WindowInteropHelper(win).Owner = MainForm.Instance!.Handle;
|
||||
win?.ShowDialog();
|
||||
}
|
||||
|
||||
public void LoadSubtitle(IList<string> args)
|
||||
void LoadSubtitle(IList<string> args)
|
||||
{
|
||||
using var dialog = new OpenFileDialog();
|
||||
string path = Player.GetPropertyString("path");
|
||||
@@ -82,7 +90,7 @@ public class GuiCommand
|
||||
Player.CommandV("sub-add", filename);
|
||||
}
|
||||
|
||||
public void OpenFiles(IList<string> args)
|
||||
void OpenFiles(IList<string> args)
|
||||
{
|
||||
bool append = false;
|
||||
|
||||
@@ -96,7 +104,7 @@ public class GuiCommand
|
||||
Player.LoadFiles(dialog.FileNames, true, append);
|
||||
}
|
||||
|
||||
public void Open_DVD_Or_BD_Folder(IList<string> args)
|
||||
void Open_DVD_Or_BD_Folder(IList<string> args)
|
||||
{
|
||||
var dialog = new FolderBrowserDialog();
|
||||
|
||||
@@ -104,7 +112,7 @@ public class GuiCommand
|
||||
Player.LoadDiskFolder(dialog.SelectedPath);
|
||||
}
|
||||
|
||||
public void EditCongFile(IList<string> args)
|
||||
void EditCongFile(IList<string> args)
|
||||
{
|
||||
string file = Player.ConfigFolder + args[0];
|
||||
|
||||
@@ -112,7 +120,7 @@ public class GuiCommand
|
||||
ProcessHelp.ShellExecute(WinApiHelp.GetAppPathForExtension("txt"), "\"" + file + "\"");
|
||||
}
|
||||
|
||||
public static void ShowTextWithEditor(string name, string text)
|
||||
void ShowTextWithEditor(string name, string text)
|
||||
{
|
||||
string file = Path.Combine(Path.GetTempPath(), name + ".txt");
|
||||
App.TempFiles.Add(file);
|
||||
@@ -120,7 +128,7 @@ public class GuiCommand
|
||||
ProcessHelp.ShellExecute(WinApiHelp.GetAppPathForExtension("txt"), "\"" + file + "\"");
|
||||
}
|
||||
|
||||
public static void ShowCommands()
|
||||
void ShowCommands()
|
||||
{
|
||||
string json = Core.GetPropertyString("command-list");
|
||||
var enumerator = JsonDocument.Parse(json).RootElement.EnumerateArray();
|
||||
@@ -151,7 +159,22 @@ public class GuiCommand
|
||||
ShowTextWithEditor("Input Commands", header + sb.ToString());
|
||||
}
|
||||
|
||||
public void OpenFromClipboard(IList<string> args)
|
||||
void ShowProperties() =>
|
||||
ShowTextWithEditor("Properties", Core.GetPropertyString("property-list").Replace(",", BR));
|
||||
|
||||
void ShowKeys() =>
|
||||
ShowTextWithEditor("Keys", Core.GetPropertyString("input-key-list").Replace(",", BR));
|
||||
|
||||
void ShowProtocols() =>
|
||||
ShowTextWithEditor("Protocols", Core.GetPropertyString("protocol-list").Replace(",", BR));
|
||||
|
||||
void ShowDecoders() =>
|
||||
ShowTextWithEditor("Decoders", Core.GetPropertyOsdString("decoder-list").Replace(",", BR));
|
||||
|
||||
void ShowDemuxers() =>
|
||||
ShowTextWithEditor("Demuxers", Core.GetPropertyOsdString("demuxer-lavf-list").Replace(",", BR));
|
||||
|
||||
void OpenFromClipboard(IList<string> args)
|
||||
{
|
||||
bool append = args.Count == 1 && args[0] == "append";
|
||||
|
||||
@@ -185,7 +208,7 @@ public class GuiCommand
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadAudio(IList<string> args)
|
||||
void LoadAudio(IList<string> args)
|
||||
{
|
||||
using var dialog = new OpenFileDialog();
|
||||
string path = Player.GetPropertyString("path");
|
||||
@@ -200,7 +223,7 @@ public class GuiCommand
|
||||
Player.CommandV("audio-add", i);
|
||||
}
|
||||
|
||||
public void RegisterFileAssociations(IList<string> args)
|
||||
void RegisterFileAssociations(IList<string> args)
|
||||
{
|
||||
string perceivedType = args[0];
|
||||
string[] extensions = Array.Empty<string>();
|
||||
@@ -238,7 +261,7 @@ public class GuiCommand
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void ShowMediaInfo(IList<string> args)
|
||||
void ShowMediaInfo(IList<string> args)
|
||||
{
|
||||
if (Player.PlaylistPos == -1)
|
||||
return;
|
||||
@@ -320,11 +343,11 @@ public class GuiCommand
|
||||
}
|
||||
}
|
||||
|
||||
public static string FormatTime(double value) => ((int)value).ToString("00");
|
||||
string FormatTime(double value) => ((int)value).ToString("00");
|
||||
|
||||
public void ShowBindings() => ShowTextWithEditor("Bindings", Player.UsedInputConfContent);
|
||||
void ShowBindings() => ShowTextWithEditor("Bindings", Player.UsedInputConfContent);
|
||||
|
||||
public void AddToPath()
|
||||
void AddToPath()
|
||||
{
|
||||
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!;
|
||||
|
||||
@@ -341,53 +364,41 @@ public class GuiCommand
|
||||
Msg.ShowInfo(_("mpv.net was successfully added to Path."));
|
||||
}
|
||||
|
||||
public void ShowPlaylist()
|
||||
{
|
||||
var count = Player.GetPropertyInt("playlist-count");
|
||||
|
||||
if (count < 1)
|
||||
return;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
string name = Player.GetPropertyString($"playlist/{i}/title");
|
||||
|
||||
if (string.IsNullOrEmpty(name))
|
||||
name = Player.GetPropertyString($"playlist/{i}/filename").FileName();
|
||||
|
||||
sb.AppendLine(name);
|
||||
}
|
||||
|
||||
string header = BR + "For a playlist menu the following user scripts exist:" + BR2 +
|
||||
"https://github.com/stax76/mpv-scripts#command_palette" + BR +
|
||||
"https://github.com/stax76/mpv-scripts#search_menu" + BR +
|
||||
"https://github.com/tomasklaen/uosc" + BR +
|
||||
"https://github.com/jonniek/mpv-playlistmanager" + BR2;
|
||||
|
||||
Msg.ShowInfo(header + sb.ToString().TrimEnd());
|
||||
}
|
||||
|
||||
// deprecated
|
||||
public void QuickBookmark() =>
|
||||
Msg.ShowInfo("This feature was moved to a user script,\nwhich can be found here:\n\n" +
|
||||
"https://github.com/stax76/mpv-scripts/blob/main/misc.lua");
|
||||
|
||||
// deprecated
|
||||
public void ShowHistory() =>
|
||||
Msg.ShowInfo("This feature was moved to a user script,\nwhich can be found here:\n\n" +
|
||||
"https://github.com/stax76/mpv-scripts/blob/main/history.lua");
|
||||
|
||||
// deprecated
|
||||
public void ShowCommandPalette() =>
|
||||
Msg.ShowInfo(
|
||||
"This feature was removed but is still available in the form of user scripts:" + BR2 +
|
||||
void ShowTracks() =>
|
||||
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
|
||||
"https://github.com/stax76/mpv-scripts#command_palette" + BR +
|
||||
"https://github.com/stax76/mpv-scripts#search_menu" + BR +
|
||||
"https://github.com/tomasklaen/uosc");
|
||||
}
|
||||
|
||||
// deprecated
|
||||
void ShowPlaylist() =>
|
||||
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
|
||||
"https://github.com/stax76/mpv-scripts#command_palette" + BR +
|
||||
"https://github.com/stax76/mpv-scripts#search_menu" + BR +
|
||||
"https://github.com/tomasklaen/uosc" + BR +
|
||||
"https://github.com/jonniek/mpv-playlistmanager");
|
||||
|
||||
// deprecated
|
||||
void ShowCommandPalette() =>
|
||||
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
|
||||
"https://github.com/stax76/mpv-scripts#command_palette" + BR +
|
||||
"https://github.com/stax76/mpv-scripts#search_menu" + BR +
|
||||
"https://github.com/tomasklaen/uosc");
|
||||
|
||||
// deprecated
|
||||
void QuickBookmark() =>
|
||||
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
|
||||
"https://github.com/stax76/mpv-scripts/blob/main/misc.lua");
|
||||
|
||||
// deprecated
|
||||
void ShowHistory() =>
|
||||
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
|
||||
"https://github.com/stax76/mpv-scripts/blob/main/history.lua");
|
||||
|
||||
// deprecated
|
||||
void ShowRemoved() => Msg.ShowInfo(_("This feature was removed."));
|
||||
}
|
||||
|
||||
|
||||
//public void ShowCommandPalette()
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ApplicationIcon>mpv-icon.ico</ApplicationIcon>
|
||||
<Product>mpv.net</Product>
|
||||
<FileVersion>7.0.0.5</FileVersion>
|
||||
<AssemblyVersion>7.0.0.5</AssemblyVersion>
|
||||
<InformationalVersion>7.0.0.5</InformationalVersion>
|
||||
<FileVersion>7.0.0.6</FileVersion>
|
||||
<AssemblyVersion>7.0.0.6</AssemblyVersion>
|
||||
<InformationalVersion>7.0.0.6</InformationalVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using MpvNet.Help;
|
||||
|
||||
namespace MpvNet;
|
||||
@@ -26,13 +24,13 @@ public class Command
|
||||
|
||||
// deprecated
|
||||
["playlist-add"] = args => PlaylistAdd(Convert.ToInt32(args[0])), // deprecated
|
||||
["show-progress"] = args => ShowProgress(), // deprecated
|
||||
["show-progress"] = args => Player.Command("show-progress"), // deprecated
|
||||
["playlist-random"] = args => PlaylistRandom(), // deprecated
|
||||
};
|
||||
|
||||
public string FormatTime(double value) => ((int)value).ToString("00");
|
||||
string FormatTime(double value) => ((int)value).ToString("00");
|
||||
|
||||
public static void PlayPause(IList<string> args)
|
||||
void PlayPause(IList<string> args)
|
||||
{
|
||||
int count = Player.GetPropertyInt("playlist-count");
|
||||
|
||||
@@ -66,7 +64,7 @@ public class Command
|
||||
"}${osd-ass-cc/1}" + text + "\" " + duration);
|
||||
}
|
||||
|
||||
public static void CycleAudio()
|
||||
void CycleAudio()
|
||||
{
|
||||
Player.UpdateExternalTracks();
|
||||
|
||||
@@ -94,7 +92,7 @@ public class Command
|
||||
}
|
||||
}
|
||||
|
||||
public static void CycleSubtitles()
|
||||
void CycleSubtitles()
|
||||
{
|
||||
Player.UpdateExternalTracks();
|
||||
|
||||
@@ -126,7 +124,7 @@ public class Command
|
||||
}
|
||||
|
||||
// deprecated
|
||||
public static void PlaylistAdd(int value)
|
||||
void PlaylistAdd(int value)
|
||||
{
|
||||
int pos = Player.PlaylistPos;
|
||||
int count = Player.GetPropertyInt("playlist-count");
|
||||
@@ -145,13 +143,13 @@ public class Command
|
||||
Player.SetPropertyInt("playlist-pos", pos);
|
||||
}
|
||||
|
||||
public static void PlaylistFirst()
|
||||
void PlaylistFirst()
|
||||
{
|
||||
if (Player.PlaylistPos != 0)
|
||||
Player.SetPropertyInt("playlist-pos", 0);
|
||||
}
|
||||
|
||||
public static void PlaylistLast()
|
||||
void PlaylistLast()
|
||||
{
|
||||
int count = Player.GetPropertyInt("playlist-count");
|
||||
|
||||
@@ -160,14 +158,14 @@ public class Command
|
||||
}
|
||||
|
||||
// deprecated
|
||||
public static void PlaylistRandom()
|
||||
void PlaylistRandom()
|
||||
{
|
||||
int count = Player.GetPropertyInt("playlist-count");
|
||||
Player.SetPropertyInt("playlist-pos", new Random().Next(count));
|
||||
}
|
||||
|
||||
// deprecated
|
||||
public void ShowProgress()
|
||||
void ShowProgress()
|
||||
{
|
||||
TimeSpan position = TimeSpan.FromSeconds(Player.GetPropertyDouble("time-pos"));
|
||||
TimeSpan duration = TimeSpan.FromSeconds(Player.GetPropertyDouble("duration"));
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Help;
|
||||
|
||||
namespace MpvNet;
|
||||
@@ -15,10 +14,13 @@ public class InputConf
|
||||
public string Path {
|
||||
get => _path ?? "";
|
||||
set {
|
||||
if (_path != value)
|
||||
{
|
||||
_path = value;
|
||||
Content = File.Exists(_path) ? FileHelp.ReadTextFile(_path) : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasMenu => Content.Contains(App.MenuSyntax + " ");
|
||||
|
||||
@@ -50,7 +52,29 @@ public class InputConf
|
||||
public string GetContent()
|
||||
{
|
||||
if (HasMenu)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (App.Settings.MenuUpdateVersion != 1)
|
||||
{
|
||||
string updatedContent = UpdateContent(Content);
|
||||
|
||||
if (updatedContent != Content)
|
||||
{
|
||||
File.Copy(Path, Path + ".backup", true);
|
||||
File.WriteAllText(Path, Content = updatedContent);
|
||||
}
|
||||
|
||||
App.Settings.MenuUpdateVersion = 1;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Terminal.WriteError("Failed to update menu." + BR + ex.Message);
|
||||
}
|
||||
|
||||
return Content;
|
||||
}
|
||||
else
|
||||
{
|
||||
var defaults = InputHelp.GetDefaults();
|
||||
@@ -73,4 +97,9 @@ public class InputConf
|
||||
return InputHelp.ConvertToString(defaults);
|
||||
}
|
||||
}
|
||||
|
||||
static string UpdateContent(string content) => content
|
||||
.Replace("script-message mpv.net", "script-message-to mpvnet")
|
||||
.Replace("/docs/Manual.md", "/docs/manual.md")
|
||||
.Replace("https://github.com/stax76/mpv.net", "https://github.com/mpvnet-player/mpv.net");
|
||||
}
|
||||
|
||||
@@ -127,6 +127,11 @@ public static class InputHelp
|
||||
new (_("View") + " > " + _("More"), _("Show Audio Devices"), "script-message-to mpvnet show-audio-devices"),
|
||||
new (_("View") + " > " + _("More"), _("Show Commands"), "script-message-to mpvnet show-commands", "F2"),
|
||||
new (_("View") + " > " + _("More"), _("Show Bindings"), "script-message-to mpvnet show-bindings"),
|
||||
new (_("View") + " > " + _("More"), _("Show Properties"), "script-message-to mpvnet show-properties", "F3"),
|
||||
new (_("View") + " > " + _("More"), _("Show Keys"), "script-message-to mpvnet show-keys", "Alt+k"),
|
||||
new (_("View") + " > " + _("More"), _("Show Protocols"), "script-message-to mpvnet show-protocols", "Alt+p"),
|
||||
new (_("View") + " > " + _("More"), _("Show Decoders"), "script-message-to mpvnet show-decoders", "Alt+d"),
|
||||
new (_("View") + " > " + _("More"), _("Show Demuxers"), "script-message-to mpvnet show-demuxers"),
|
||||
|
||||
new (_("Window"), _("Fullscreen"), "cycle fullscreen", "Enter"),
|
||||
new (_("Window") + " > " + _("Zoom"), _("Enlarge"), "script-message-to mpvnet scale-window 1.2", "Alt++"),
|
||||
@@ -483,7 +488,7 @@ public static class InputHelp
|
||||
|
||||
Binding binding = it.Value;
|
||||
|
||||
if (!keys.Contains(binding.Input) && (charCount + binding.Input.Length) < 20 && keys.Count < 2)
|
||||
if (!keys.Contains(binding.Input) && (charCount + binding.Input.Length) < 15 && keys.Count < 2)
|
||||
{
|
||||
keys.Add(binding.Input);
|
||||
charCount += binding.Input.Length;
|
||||
|
||||
@@ -98,6 +98,7 @@ public class MainPlayer : MpvClient
|
||||
SetPropertyBool("input-default-bindings", true);
|
||||
SetPropertyBool("input-builtin-bindings", false);
|
||||
|
||||
SetPropertyString("idle", "yes");
|
||||
SetPropertyString("screenshot-directory", "~~desktop/");
|
||||
SetPropertyString("osd-playing-msg", "${media-title}");
|
||||
SetPropertyString("osc", "yes");
|
||||
|
||||
@@ -11,6 +11,7 @@ public class AppSettings
|
||||
{
|
||||
public bool InputDefaultBindingsFixApplied;
|
||||
public bool ShowMenuFixApplied;
|
||||
public int MenuUpdateVersion;
|
||||
public int Volume = 70;
|
||||
public List<string> RecentFiles = new List<string>();
|
||||
public Point WindowLocation;
|
||||
|
||||
@@ -25,4 +25,4 @@ Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||
|
||||
[Files]
|
||||
Source: "{#MyAppSourceDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
|
||||
Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Excludes: "win-x64"; Flags: ignoreversion recursesubdirs createallsubdirs;
|
||||
|
||||
Reference in New Issue
Block a user