From e378551938ea5cedcacca74fe17e44b0e96589f9 Mon Sep 17 00:00:00 2001 From: stax76 Date: Mon, 11 Jul 2022 13:14:26 +0200 Subject: [PATCH] misc --- docs/Changelog.md | 3 ++- docs/Manual.md | 6 +++--- src/Misc/Commands.cs | 7 +++++++ src/Resources/input.conf.txt | 7 ++++--- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index 3d90e65..9e8a16a 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -2,9 +2,10 @@ # 6.0.3.1 (202?-??-??) - Creating a playlist from a folder uses absolute normalized paths, non media files are ignored. -- The basic view of the show-info command was removed, the advanced view was enhanced with a General section and the filename. +- The show-info command shows directly an advanced view which was enhanced with a General section and the filename. - Media info titles are shortened if they contain duplicated or obvious information. - Support of shortcuts (.lnk files) with media file target. +- playlist-random command jumps to a random playlist entry, default key binding is F9. - Fix OSC hide behavior on mouse move. - MediaInfo v22.06 - libmpv shinchiro 2022-07-02 diff --git a/docs/Manual.md b/docs/Manual.md index e829c73..3d013ad 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -270,6 +270,9 @@ already the first entry, nothing happens. Jumps to the last playlist entry, if the loaded file is already the last entry, nothing happens. +### playlist-random +Jumps to a random playlist entry. + ### quick-bookmark On the first press a bookmark is saved, on the second @@ -320,9 +323,6 @@ Shows available demuxers. Shows the history file when existing. -### show-info -Shows media info on screen. - ### show-input-editor Shows the input editor. diff --git a/src/Misc/Commands.cs b/src/Misc/Commands.cs index 0ecaf8c..c8f9ad0 100644 --- a/src/Misc/Commands.cs +++ b/src/Misc/Commands.cs @@ -35,6 +35,7 @@ namespace mpvnet case "playlist-add": PlaylistAdd(Convert.ToInt32(args[0])); break; case "playlist-first": PlaylistFirst(); break; case "playlist-last": PlaylistLast(); break; + case "playlist-random": PlaylistRandom(); break; case "quick-bookmark": QuickBookmark(); break; case "reg-file-assoc": RegisterFileAssociations(args[0]); break; case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break; @@ -705,6 +706,12 @@ namespace mpvnet Core.SetPropertyInt("playlist-pos", pos); } + public static void PlaylistRandom() + { + int count = Core.GetPropertyInt("playlist-count"); + Core.SetPropertyInt("playlist-pos", new Random().Next(count)); + } + public static void QuickBookmark() { if (App.QuickBookmark == 0) diff --git a/src/Resources/input.conf.txt b/src/Resources/input.conf.txt index 1ebb63b..7e25e05 100644 --- a/src/Resources/input.conf.txt +++ b/src/Resources/input.conf.txt @@ -24,6 +24,8 @@ _ ignore #menu: Navigate > - Home script-message-to mpvnet playlist-first #menu: Navigate > First File End script-message-to mpvnet playlist-last #menu: Navigate > Last File _ ignore #menu: Navigate > - +F9 script-message-to mpvnet playlist-random #menu: Navigate > Random File +_ ignore #menu: Navigate > - PGUP add chapter 1 #menu: Navigate > Next Chapter PGDWN add chapter -1 #menu: Navigate > Previous Chapter _ ignore #menu: Navigate > - @@ -125,10 +127,9 @@ b cycle border #menu: View > Toggle Borde Ctrl+t cycle ontop #menu: View > Toggle On Top t script-binding stats/display-stats-toggle #menu: View > Toggle Statistics Del script-binding osc/visibility #menu: View > Toggle OSC Visibility -i script-message-to mpvnet show-info #menu: View > Show File/Stream Info +i script-message-to mpvnet show-info #menu: View > Show Media Info +Ctrl+m script-message-to mpvnet show-media-info #menu: View > Show Media Info Advanced p show-progress #menu: View > Show Progress -F9 script-message-to mpvnet show-media-info osd #menu: View > Show Tracks -Ctrl+m script-message-to mpvnet show-media-info #menu: View > Show Media Info Alt+r script-message-to mpvnet show-recent #menu: View > Show Recent ` script-binding console/enable #menu: View > Advanced > Show Console