playlist-add command added

This commit is contained in:
stax76
2022-05-01 01:01:51 +02:00
parent f489d59168
commit a15d2cdbbe
4 changed files with 31 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
- Fix keyboard layout change not working. - Fix keyboard layout change not working.
- Fix multi monitor setup with different DPI values. - Fix multi monitor setup with different DPI values.
- New playlist-add command added to change the playlist position.
Ctrl+F11 goes 10 positions backward.
Ctrl+F12 goes 10 positions forward.
5.8.0.0 Beta (2022-04-02) 5.8.0.0 Beta (2022-04-02)

View File

@@ -255,6 +255,10 @@ or multiple files in the file clipboard format.
Cycles the pause property. In case the playlist is empty, Cycles the pause property. In case the playlist is empty,
the most recent file from the recent files list is loaded. the most recent file from the recent files list is loaded.
### playlist-add \<integer\>
Changes the playlist position by adding the supplied integer value.
If the position goes out of range, it jumpes to the opposite end.
### playlist-first ### playlist-first
Jumps to the first playlist entry, if the loaded file is Jumps to the first playlist entry, if the loaded file is
already the first entry, nothing happens. already the first entry, nothing happens.

View File

@@ -35,6 +35,7 @@ namespace mpvnet
case "open-optical-media": Open_DVD_Or_BD_Folder(); break; case "open-optical-media": Open_DVD_Or_BD_Folder(); break;
case "open-url": OpenFromClipboard(); break; // deprecated 2022 case "open-url": OpenFromClipboard(); break; // deprecated 2022
case "play-pause": PlayPause(); break; case "play-pause": PlayPause(); break;
case "playlist-add": PlaylistAdd(Convert.ToInt32(args[0])); break;
case "playlist-first": PlaylistFirst(); break; case "playlist-first": PlaylistFirst(); break;
case "playlist-last": PlaylistLast(); break; case "playlist-last": PlaylistLast(); break;
case "reg-file-assoc": RegisterFileAssociations(args[0]); break; case "reg-file-assoc": RegisterFileAssociations(args[0]); break;
@@ -662,5 +663,24 @@ namespace mpvnet
}); });
public static void ShowMenu() => Core.RaiseShowMenu(); public static void ShowMenu() => Core.RaiseShowMenu();
public static void PlaylistAdd(int value)
{
int pos = Core.GetPropertyInt("playlist-pos");
int count = Core.GetPropertyInt("playlist-count");
if (count < 2)
return;
pos = pos + value;
if (pos < 0)
pos = count - 1;
if (pos > count - 1)
pos = 0;
Core.SetPropertyInt("playlist-pos", pos);
}
} }
} }

View File

@@ -18,8 +18,8 @@ Ctrl+s stop #menu: Stop
_ ignore #menu: - _ ignore #menu: -
Enter cycle fullscreen #menu: Toggle Fullscreen Enter cycle fullscreen #menu: Toggle Fullscreen
F11 playlist-prev; set pause no #menu: Navigate > Previous File F11 script-message mpv.net playlist-add -1; set pause no #menu: Navigate > Previous File
F12 playlist-next; set pause no #menu: Navigate > Next File F12 script-message mpv.net playlist-add 1; set pause no #menu: Navigate > Next File
_ ignore #menu: Navigate > - _ ignore #menu: Navigate > -
Home script-message mpv.net playlist-first #menu: Navigate > First File Home script-message mpv.net playlist-first #menu: Navigate > First File
End script-message mpv.net playlist-last #menu: Navigate > Last File End script-message mpv.net playlist-last #menu: Navigate > Last File
@@ -171,6 +171,8 @@ MBTN_Right script-message mpv.net show-menu
KP6 script-message mpv.net show-progress KP6 script-message mpv.net show-progress
7 script-message mpv.net cycle-audio 7 script-message mpv.net cycle-audio
Sharp script-message mpv.net cycle-audio Sharp script-message mpv.net cycle-audio
Ctrl+F11 script-message mpv.net playlist-add -10
Ctrl+F12 script-message mpv.net playlist-add 10
8 cycle sub 8 cycle sub
j cycle sub j cycle sub
q quit q quit