Support for encoding mode and thumbfast and some other new features and improvements
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows;
|
||||
using System.Globalization;
|
||||
|
||||
using MpvNet.ExtensionMethod;
|
||||
using MpvNet.Help;
|
||||
using MpvNet.Windows.WinForms;
|
||||
using MpvNet.Windows.WPF.Views;
|
||||
using MpvNet.Windows.WPF;
|
||||
@@ -20,7 +20,6 @@ public class GuiCommand
|
||||
|
||||
public event Action<float>? ScaleWindow;
|
||||
public event Action<string>? MoveWindow;
|
||||
public event Action<double>? WindowScaleMpv;
|
||||
public event Action<float>? WindowScaleNet;
|
||||
public event Action? ShowMenu;
|
||||
|
||||
@@ -45,14 +44,13 @@ 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(),
|
||||
|
||||
|
||||
// deprecated
|
||||
["show-info"] = args => ShowMediaInfo(new[] { "osd" }), // deprecated
|
||||
["quick-bookmark"] = args => QuickBookmark(), // deprecated
|
||||
["show-commands"] = args => ShowCommands(), // deprecated
|
||||
["show-history"] = args => ShowHistory(), // deprecated
|
||||
["show-playlist"] = args => ShowPlaylist(), // deprecated
|
||||
["show-command-palette"] = args => ShowCommandPalette(), // deprecated
|
||||
};
|
||||
|
||||
@@ -250,7 +248,7 @@ public class GuiCommand
|
||||
text = text.TrimEx();
|
||||
|
||||
if (editor)
|
||||
ShowTextWithEditor("media-info", text);
|
||||
Command.ShowTextWithEditor("media-info", text);
|
||||
else if (osd)
|
||||
Command.ShowText(text.Replace("\r", ""), 5000, 16);
|
||||
else
|
||||
@@ -263,53 +261,62 @@ public class GuiCommand
|
||||
|
||||
public static string FormatTime(double value) => ((int)value).ToString("00");
|
||||
|
||||
public void ShowTextWithEditor(string name, string text)
|
||||
public void ShowBindings() => Command.ShowTextWithEditor("Bindings", Player.UsedInputConfContent);
|
||||
|
||||
public void ShowPlaylist()
|
||||
{
|
||||
string file = Path.Combine(Path.GetTempPath(), name + ".txt");
|
||||
App.TempFiles.Add(file);
|
||||
File.WriteAllText(file, BR + text.Trim() + BR);
|
||||
ProcessHelp.ShellExecute(file);
|
||||
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());
|
||||
}
|
||||
|
||||
public void ShowBindings()
|
||||
{
|
||||
string info = "# mpv.net might modify the input.conf content before it is passed to mpv." + BR +
|
||||
"# Below are the bindings as they were passed to mpv." + BR2;
|
||||
|
||||
ShowTextWithEditor("Bindings", info + Player.UsedInputConfContent);
|
||||
}
|
||||
|
||||
//public void ShowCommandPalette()
|
||||
//{
|
||||
// MainForm.Instance?.BeginInvoke(() => {
|
||||
// CommandPalette.Instance.SetItems(CommandPalette.GetItems());
|
||||
// MainForm.Instance.ShowCommandPalette();
|
||||
// CommandPalette.Instance.SelectFirst();
|
||||
// });
|
||||
//}
|
||||
|
||||
// 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 ShowCommands() =>
|
||||
Msg.ShowInfo("This feature was moved to a user script,\nwhich can be found here:\n\n" +
|
||||
"https://github.com/stax76/mpv-scripts#command_palette");
|
||||
|
||||
// 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 ShowPlaylist() =>
|
||||
Msg.ShowInfo("This feature was moved to a user script,\nwhich can be found here:\n\n" +
|
||||
"https://github.com/stax76/mpv-scripts#command_palette");
|
||||
|
||||
// deprecated
|
||||
public void ShowCommandPalette() =>
|
||||
Msg.ShowInfo("This feature was moved to a user script,\nwhich can be found here:\n\n" +
|
||||
"https://github.com/stax76/mpv-scripts#command_palette");
|
||||
Msg.ShowInfo(
|
||||
"This feature was removed but is still available in the form of 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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//public void ShowCommandPalette()
|
||||
//{
|
||||
// MainForm.Instance?.BeginInvoke(() => {
|
||||
// CommandPalette.Instance.SetItems(CommandPalette.GetItems());
|
||||
// MainForm.Instance.ShowCommandPalette();
|
||||
// CommandPalette.Instance.SelectFirst();
|
||||
// });
|
||||
//}
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
|
||||
@@ -8,6 +7,7 @@ using MpvNet.Help;
|
||||
using MpvNet.Windows.UI;
|
||||
using MpvNet.Windows.Help;
|
||||
using MpvNet.Windows.WPF;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MpvNet.Windows;
|
||||
|
||||
@@ -42,8 +42,12 @@ static class Program
|
||||
Theme.Init();
|
||||
Mutex mutex = new Mutex(true, StringHelp.GetMD5Hash(App.ConfPath), out bool isFirst);
|
||||
|
||||
if (Control.ModifierKeys.HasFlag(Keys.Shift))
|
||||
if (Control.ModifierKeys.HasFlag(Keys.Shift) ||
|
||||
App.CommandLine.Contains("--process-instance=multi") ||
|
||||
App.CommandLine.Contains("--o="))
|
||||
{
|
||||
App.ProcessInstance = "multi";
|
||||
}
|
||||
|
||||
if ((App.ProcessInstance == "single" || App.ProcessInstance == "queue") && !isFirst)
|
||||
{
|
||||
@@ -93,7 +97,17 @@ static class Program
|
||||
return;
|
||||
}
|
||||
|
||||
Application.Run(new WinForms.MainForm());
|
||||
if (App.CommandLine.Contains("--o="))
|
||||
{
|
||||
App.AutoLoadFolder = false;
|
||||
Player.Init(IntPtr.Zero);
|
||||
Player.ProcessCommandLine(false);
|
||||
Player.SetPropertyString("idle", "no");
|
||||
Player.EventLoop();
|
||||
Player.Destroy();
|
||||
}
|
||||
else
|
||||
Application.Run(new WinForms.MainForm());
|
||||
|
||||
if (App.IsTerminalAttached)
|
||||
WinApi.FreeConsole();
|
||||
|
||||
@@ -522,7 +522,8 @@ name = language
|
||||
file = mpvnet
|
||||
default = system
|
||||
directory = UI
|
||||
help = User interface display language.\nmpv.net must be restarted after a change.
|
||||
help = User interface display language.\nmpv.net must be restarted after a change.\nInterested joining our translation team?:
|
||||
url = https://app.transifex.com/stax76/teams/
|
||||
option = system
|
||||
option = english
|
||||
option = chinese-china
|
||||
|
||||
@@ -9,10 +9,8 @@ namespace MpvNet.Windows.WPF;
|
||||
|
||||
public class HyperlinkEx : Hyperlink
|
||||
{
|
||||
void HyperLinkEx_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
void HyperLinkEx_RequestNavigate(object sender, RequestNavigateEventArgs e) =>
|
||||
ProcessHelp.ShellExecute(e.Uri.AbsoluteUri);
|
||||
}
|
||||
|
||||
public void SetURL(string? url)
|
||||
{
|
||||
|
||||
@@ -3,8 +3,18 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="clr-namespace:HandyControl.Controls"
|
||||
xmlns:o="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
|
||||
xmlns:local="clr-namespace:MpvNet.Windows.WPF"
|
||||
>
|
||||
|
||||
<Style TargetType="local:HyperlinkEx">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="CornflowerBlue" />
|
||||
<Setter Property="TextBlock.TextDecorations" Value="Underline" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
|
||||
Reference in New Issue
Block a user