11
22using System . Text ;
3+ using System . Text . Json ;
34using System . Text . RegularExpressions ;
45using System . Globalization ;
56using System . Windows . Forms ;
1112using MpvNet . Windows . WPF . Views ;
1213using MpvNet . Windows . WPF ;
1314using MpvNet . Windows . WPF . MsgBox ;
14- using MpvNet . Help ;
15- using System . Text . Json ;
1615using MpvNet . Windows . Help ;
16+ using MpvNet . Help ;
1717
1818namespace 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, \n which 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, \n which 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(() => {
0 commit comments