v7.0.0.6 Beta
This commit is contained in:
@@ -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,8 +14,11 @@ public class InputConf
|
||||
public string Path {
|
||||
get => _path ?? "";
|
||||
set {
|
||||
_path = value;
|
||||
Content = File.Exists(_path) ? FileHelp.ReadTextFile(_path) : "";
|
||||
if (_path != value)
|
||||
{
|
||||
_path = value;
|
||||
Content = File.Exists(_path) ? FileHelp.ReadTextFile(_path) : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user