script-message mpv.net playlist-first
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
###
|
||||
|
||||
- new: menu item 'View > Show Progress' (p key) to show progress bar
|
||||
- new: `script-message mpv.net playlist-first`, unlike mpv does not
|
||||
restart if the first file is already active
|
||||
|
||||
- fix: update routine did only work when mpv.net was located in 'Program Files'
|
||||
- fix: errors were just ignored and only seen printed in the terminal in case mpv.net
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace mpvnet
|
||||
case "open-conf-folder": Process.Start(mp.ConfigFolder); break;
|
||||
case "shell-execute": Process.Start(args[0]); break;
|
||||
case "show-info": ShowInfo(); break;
|
||||
case "playlist-first": PlaylistFirst(); break;
|
||||
case "playlist-last": PlaylistLast(); break;
|
||||
case "add-files-to-playlist": OpenFiles("append"); break; // deprecated 2019
|
||||
default: Msg.ShowError($"No command '{id}' found."); break;
|
||||
@@ -101,7 +102,22 @@ namespace mpvnet
|
||||
}));
|
||||
}
|
||||
|
||||
public static void PlaylistLast() => mp.set_property_int("playlist-pos", mp.get_property_int("playlist-count") - 1);
|
||||
public static void PlaylistFirst()
|
||||
{
|
||||
int pos = mp.get_property_int("playlist-pos");
|
||||
|
||||
if (pos != 0)
|
||||
mp.set_property_int("playlist-pos", 0);
|
||||
}
|
||||
|
||||
public static void PlaylistLast()
|
||||
{
|
||||
int pos = mp.get_property_int("playlist-pos");
|
||||
int count = mp.get_property_int("playlist-count");
|
||||
|
||||
if (pos < count - 1)
|
||||
mp.set_property_int("playlist-pos", count - 1);
|
||||
}
|
||||
|
||||
public static void ShowHistory()
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
F11 playlist-prev #menu: Navigate > Previous File
|
||||
F12 playlist-next #menu: Navigate > Next File
|
||||
_ ignore #menu: Navigate > -
|
||||
Home set playlist-pos 0 #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
|
||||
_ ignore #menu: Navigate > -
|
||||
PGUP add chapter 1 #menu: Navigate > Next Chapter
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace mpvnet
|
||||
if (Handle == IntPtr.Zero)
|
||||
throw new Exception("error mpv_create");
|
||||
|
||||
mpv_request_log_messages(Handle, "error");
|
||||
mpv_request_log_messages(Handle, "fatal");
|
||||
Task.Run(() => EventLoop());
|
||||
|
||||
if (App.IsStartedFromTerminal)
|
||||
|
||||
Reference in New Issue
Block a user