Skip to content

Commit 3970d5c

Browse files
committed
v7.0.0.6 Beta
1 parent 4451eaf commit 3970d5c

File tree

10 files changed

+136
-71
lines changed

10 files changed

+136
-71
lines changed

docs/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
# v7.0.0.6 Beta (2023-01-02)
3+
4+
- Improved backward compatibility with input.conf files created by old versions.
5+
6+
27
# v7.0.0.5 Beta (2023-12-28)
38

49
- Fix mpv.net option `language` not working from command line.

docs/manual.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,21 @@ Shows available audio devices in a message box.
270270
### show-commands
271271
Shows available [mpv input commands](https://mpv.io/manual/master/#list-of-input-commands).
272272

273+
### show-properties
274+
Shows available [properties](https://mpv.io/manual/master/#properties).
275+
276+
### show-keys
277+
Shows available [input keys](https://mpv.io/manual/master/#options-input-keylist).
278+
279+
### show-protocols
280+
Shows available [protocols](https://mpv.io/manual/master/#options-list-protocols).
281+
282+
### show-decoders
283+
Shows available decoders.
284+
285+
### show-demuxers
286+
Shows available demuxers.
287+
273288
### show-conf-editor
274289
Shows the conf editor.
275290

src/MpvNet.Windows/GuiCommand.cs

Lines changed: 62 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
using System.Text;
3+
using System.Text.Json;
34
using System.Text.RegularExpressions;
45
using System.Globalization;
56
using System.Windows.Forms;
@@ -11,9 +12,8 @@
1112
using MpvNet.Windows.WPF.Views;
1213
using MpvNet.Windows.WPF;
1314
using MpvNet.Windows.WPF.MsgBox;
14-
using MpvNet.Help;
15-
using System.Text.Json;
1615
using MpvNet.Windows.Help;
16+
using MpvNet.Help;
1717

1818
namespace MpvNet;
1919

@@ -47,27 +47,35 @@ public class GuiCommand
4747
["window-scale"] = args => WindowScaleNet?.Invoke(float.Parse(args[0], CultureInfo.InvariantCulture)),
4848
["show-menu"] = args => ShowMenu?.Invoke(),
4949
["show-bindings"] = args => ShowBindings(),
50-
["show-playlist"] = args => ShowPlaylist(),
5150
["add-to-path"] = args => AddToPath(),
5251
["edit-conf-file"] = EditCongFile,
5352
["show-commands"] = args => ShowCommands(),
53+
["show-properties"] = args => ShowProperties(),
54+
["show-keys"] = args => ShowKeys(),
55+
["show-protocols"] = args => ShowProtocols(),
56+
["show-decoders"] = args => ShowDecoders(),
57+
["show-demuxers"] = args => ShowDemuxers(),
58+
["show-info"] = args => ShowMediaInfo(new[] { "osd" }),
5459

5560

5661
// deprecated
57-
["show-info"] = args => ShowMediaInfo(new[] { "osd" }), // deprecated
62+
["show-recent"] = args => ShowRemoved(), // deprecated
63+
["show-playlist"] = args => ShowPlaylist(), // deprecated
5864
["quick-bookmark"] = args => QuickBookmark(), // deprecated
5965
["show-history"] = args => ShowHistory(), // deprecated
6066
["show-command-palette"] = args => ShowCommandPalette(), // deprecated
67+
["show-audio-tracks"] = args => ShowTracks(), // deprecated
68+
["show-subtitle-tracks"] = args => ShowTracks(), // deprecated
6169
};
6270

63-
public void ShowDialog(Type winType)
71+
void ShowDialog(Type winType)
6472
{
6573
Window? win = Activator.CreateInstance(winType) as Window;
6674
new WindowInteropHelper(win).Owner = MainForm.Instance!.Handle;
6775
win?.ShowDialog();
6876
}
6977

70-
public void LoadSubtitle(IList<string> args)
78+
void LoadSubtitle(IList<string> args)
7179
{
7280
using var dialog = new OpenFileDialog();
7381
string path = Player.GetPropertyString("path");
@@ -82,7 +90,7 @@ public void LoadSubtitle(IList<string> args)
8290
Player.CommandV("sub-add", filename);
8391
}
8492

85-
public void OpenFiles(IList<string> args)
93+
void OpenFiles(IList<string> args)
8694
{
8795
bool append = false;
8896

@@ -96,31 +104,31 @@ public void OpenFiles(IList<string> args)
96104
Player.LoadFiles(dialog.FileNames, true, append);
97105
}
98106

99-
public void Open_DVD_Or_BD_Folder(IList<string> args)
107+
void Open_DVD_Or_BD_Folder(IList<string> args)
100108
{
101109
var dialog = new FolderBrowserDialog();
102110

103111
if (dialog.ShowDialog() == DialogResult.OK)
104112
Player.LoadDiskFolder(dialog.SelectedPath);
105113
}
106114

107-
public void EditCongFile(IList<string> args)
115+
void EditCongFile(IList<string> args)
108116
{
109117
string file = Player.ConfigFolder + args[0];
110118

111119
if (File.Exists(file))
112120
ProcessHelp.ShellExecute(WinApiHelp.GetAppPathForExtension("txt"), "\"" + file + "\"");
113121
}
114122

115-
public static void ShowTextWithEditor(string name, string text)
123+
void ShowTextWithEditor(string name, string text)
116124
{
117125
string file = Path.Combine(Path.GetTempPath(), name + ".txt");
118126
App.TempFiles.Add(file);
119127
File.WriteAllText(file, BR + text.Trim() + BR);
120128
ProcessHelp.ShellExecute(WinApiHelp.GetAppPathForExtension("txt"), "\"" + file + "\"");
121129
}
122130

123-
public static void ShowCommands()
131+
void ShowCommands()
124132
{
125133
string json = Core.GetPropertyString("command-list");
126134
var enumerator = JsonDocument.Parse(json).RootElement.EnumerateArray();
@@ -151,7 +159,22 @@ public static void ShowCommands()
151159
ShowTextWithEditor("Input Commands", header + sb.ToString());
152160
}
153161

154-
public void OpenFromClipboard(IList<string> args)
162+
void ShowProperties() =>
163+
ShowTextWithEditor("Properties", Core.GetPropertyString("property-list").Replace(",", BR));
164+
165+
void ShowKeys() =>
166+
ShowTextWithEditor("Keys", Core.GetPropertyString("input-key-list").Replace(",", BR));
167+
168+
void ShowProtocols() =>
169+
ShowTextWithEditor("Protocols", Core.GetPropertyString("protocol-list").Replace(",", BR));
170+
171+
void ShowDecoders() =>
172+
ShowTextWithEditor("Decoders", Core.GetPropertyOsdString("decoder-list").Replace(",", BR));
173+
174+
void ShowDemuxers() =>
175+
ShowTextWithEditor("Demuxers", Core.GetPropertyOsdString("demuxer-lavf-list").Replace(",", BR));
176+
177+
void OpenFromClipboard(IList<string> args)
155178
{
156179
bool append = args.Count == 1 && args[0] == "append";
157180

@@ -185,7 +208,7 @@ public void OpenFromClipboard(IList<string> args)
185208
}
186209
}
187210

188-
public void LoadAudio(IList<string> args)
211+
void LoadAudio(IList<string> args)
189212
{
190213
using var dialog = new OpenFileDialog();
191214
string path = Player.GetPropertyString("path");
@@ -200,7 +223,7 @@ public void LoadAudio(IList<string> args)
200223
Player.CommandV("audio-add", i);
201224
}
202225

203-
public void RegisterFileAssociations(IList<string> args)
226+
void RegisterFileAssociations(IList<string> args)
204227
{
205228
string perceivedType = args[0];
206229
string[] extensions = Array.Empty<string>();
@@ -238,7 +261,7 @@ public void RegisterFileAssociations(IList<string> args)
238261
catch { }
239262
}
240263

241-
public void ShowMediaInfo(IList<string> args)
264+
void ShowMediaInfo(IList<string> args)
242265
{
243266
if (Player.PlaylistPos == -1)
244267
return;
@@ -320,11 +343,11 @@ public void ShowMediaInfo(IList<string> args)
320343
}
321344
}
322345

323-
public static string FormatTime(double value) => ((int)value).ToString("00");
346+
string FormatTime(double value) => ((int)value).ToString("00");
324347

325-
public void ShowBindings() => ShowTextWithEditor("Bindings", Player.UsedInputConfContent);
348+
void ShowBindings() => ShowTextWithEditor("Bindings", Player.UsedInputConfContent);
326349

327-
public void AddToPath()
350+
void AddToPath()
328351
{
329352
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!;
330353

@@ -341,55 +364,43 @@ public void AddToPath()
341364
Msg.ShowInfo(_("mpv.net was successfully added to Path."));
342365
}
343366

344-
public void ShowPlaylist()
345-
{
346-
var count = Player.GetPropertyInt("playlist-count");
347-
348-
if (count < 1)
349-
return;
350-
351-
StringBuilder sb = new StringBuilder();
352-
353-
for (int i = 0; i < count; i++)
354-
{
355-
string name = Player.GetPropertyString($"playlist/{i}/title");
356-
357-
if (string.IsNullOrEmpty(name))
358-
name = Player.GetPropertyString($"playlist/{i}/filename").FileName();
359-
360-
sb.AppendLine(name);
361-
}
367+
// deprecated
368+
void ShowTracks() =>
369+
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
370+
"https://github.com/stax76/mpv-scripts#command_palette" + BR +
371+
"https://github.com/stax76/mpv-scripts#search_menu" + BR +
372+
"https://github.com/tomasklaen/uosc");
362373

363-
string header = BR + "For a playlist menu the following user scripts exist:" + BR2 +
374+
// deprecated
375+
void ShowPlaylist() =>
376+
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
364377
"https://github.com/stax76/mpv-scripts#command_palette" + BR +
365378
"https://github.com/stax76/mpv-scripts#search_menu" + BR +
366379
"https://github.com/tomasklaen/uosc" + BR +
367-
"https://github.com/jonniek/mpv-playlistmanager" + BR2;
380+
"https://github.com/jonniek/mpv-playlistmanager");
368381

369-
Msg.ShowInfo(header + sb.ToString().TrimEnd());
370-
}
382+
// deprecated
383+
void ShowCommandPalette() =>
384+
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
385+
"https://github.com/stax76/mpv-scripts#command_palette" + BR +
386+
"https://github.com/stax76/mpv-scripts#search_menu" + BR +
387+
"https://github.com/tomasklaen/uosc");
371388

372389
// deprecated
373-
public void QuickBookmark() =>
374-
Msg.ShowInfo("This feature was moved to a user script,\nwhich can be found here:\n\n" +
390+
void QuickBookmark() =>
391+
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
375392
"https://github.com/stax76/mpv-scripts/blob/main/misc.lua");
376393

377394
// deprecated
378-
public void ShowHistory() =>
379-
Msg.ShowInfo("This feature was moved to a user script,\nwhich can be found here:\n\n" +
395+
void ShowHistory() =>
396+
Msg.ShowInfo(_("This feature was removed, but there are user scripts:") + BR2 +
380397
"https://github.com/stax76/mpv-scripts/blob/main/history.lua");
381398

382399
// deprecated
383-
public void ShowCommandPalette() =>
384-
Msg.ShowInfo(
385-
"This feature was removed but is still available in the form of user scripts:" + BR2 +
386-
"https://github.com/stax76/mpv-scripts#command_palette" + BR +
387-
"https://github.com/stax76/mpv-scripts#search_menu" + BR +
388-
"https://github.com/tomasklaen/uosc");
400+
void ShowRemoved() => Msg.ShowInfo(_("This feature was removed."));
389401
}
390402

391403

392-
393404
//public void ShowCommandPalette()
394405
//{
395406
// MainForm.Instance?.BeginInvoke(() => {

src/MpvNet.Windows/MpvNet.Windows.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<UseWindowsForms>true</UseWindowsForms>
1212
<ApplicationIcon>mpv-icon.ico</ApplicationIcon>
1313
<Product>mpv.net</Product>
14-
<FileVersion>7.0.0.5</FileVersion>
15-
<AssemblyVersion>7.0.0.5</AssemblyVersion>
16-
<InformationalVersion>7.0.0.5</InformationalVersion>
14+
<FileVersion>7.0.0.6</FileVersion>
15+
<AssemblyVersion>7.0.0.6</AssemblyVersion>
16+
<InformationalVersion>7.0.0.6</InformationalVersion>
1717
<Nullable>enable</Nullable>
1818
</PropertyGroup>
1919

src/MpvNet/Command.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11

22
using System.Globalization;
3-
using System.Text;
4-
using System.Text.Json;
53
using MpvNet.Help;
64

75
namespace MpvNet;
@@ -26,13 +24,13 @@ public class Command
2624

2725
// deprecated
2826
["playlist-add"] = args => PlaylistAdd(Convert.ToInt32(args[0])), // deprecated
29-
["show-progress"] = args => ShowProgress(), // deprecated
27+
["show-progress"] = args => Player.Command("show-progress"), // deprecated
3028
["playlist-random"] = args => PlaylistRandom(), // deprecated
3129
};
3230

33-
public string FormatTime(double value) => ((int)value).ToString("00");
31+
string FormatTime(double value) => ((int)value).ToString("00");
3432

35-
public static void PlayPause(IList<string> args)
33+
void PlayPause(IList<string> args)
3634
{
3735
int count = Player.GetPropertyInt("playlist-count");
3836

@@ -66,7 +64,7 @@ public static void ShowText(string text, int duration = 0, int fontSize = 0)
6664
"}${osd-ass-cc/1}" + text + "\" " + duration);
6765
}
6866

69-
public static void CycleAudio()
67+
void CycleAudio()
7068
{
7169
Player.UpdateExternalTracks();
7270

@@ -94,7 +92,7 @@ public static void CycleAudio()
9492
}
9593
}
9694

97-
public static void CycleSubtitles()
95+
void CycleSubtitles()
9896
{
9997
Player.UpdateExternalTracks();
10098

@@ -126,7 +124,7 @@ public static void CycleSubtitles()
126124
}
127125

128126
// deprecated
129-
public static void PlaylistAdd(int value)
127+
void PlaylistAdd(int value)
130128
{
131129
int pos = Player.PlaylistPos;
132130
int count = Player.GetPropertyInt("playlist-count");
@@ -145,13 +143,13 @@ public static void PlaylistAdd(int value)
145143
Player.SetPropertyInt("playlist-pos", pos);
146144
}
147145

148-
public static void PlaylistFirst()
146+
void PlaylistFirst()
149147
{
150148
if (Player.PlaylistPos != 0)
151149
Player.SetPropertyInt("playlist-pos", 0);
152150
}
153151

154-
public static void PlaylistLast()
152+
void PlaylistLast()
155153
{
156154
int count = Player.GetPropertyInt("playlist-count");
157155

@@ -160,14 +158,14 @@ public static void PlaylistLast()
160158
}
161159

162160
// deprecated
163-
public static void PlaylistRandom()
161+
void PlaylistRandom()
164162
{
165163
int count = Player.GetPropertyInt("playlist-count");
166164
Player.SetPropertyInt("playlist-pos", new Random().Next(count));
167165
}
168166

169167
// deprecated
170-
public void ShowProgress()
168+
void ShowProgress()
171169
{
172170
TimeSpan position = TimeSpan.FromSeconds(Player.GetPropertyDouble("time-pos"));
173171
TimeSpan duration = TimeSpan.FromSeconds(Player.GetPropertyDouble("duration"));

0 commit comments

Comments
 (0)