new quick bookmark feature

This commit is contained in:
stax76
2022-05-21 08:31:06 +02:00
parent b04fb9b789
commit 0efc335232
6 changed files with 29 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
- New quick bookmark feature, see manual.
- Fix crash choosing Matroska edition in the menu.
- Fix auto-play not working with user scripts.
- When input.conf is created on the very first start and a

View File

@@ -271,6 +271,12 @@ already the first entry, nothing happens.
Jumps to the last playlist entry, if the loaded file is
already the last entry, nothing happens.
### quick-bookmark
On the first press a bookmark is saved, on the second
press it is restored and removed. When a new file is
loaded the bookmark is removed.
### reg-file-assoc \<audio|video|image\>
Registers the file associations.

View File

@@ -36,6 +36,7 @@ namespace mpvnet
public static int RecentCount { get; set; } = 15;
public static float MinimumAspectRatio { get; set; } = 1.2f;
public static float QuickBookmark { get; set; }
public static Extension Extension { get; set; }

View File

@@ -38,6 +38,7 @@ namespace mpvnet
case "playlist-add": PlaylistAdd(Convert.ToInt32(args[0])); break;
case "playlist-first": PlaylistFirst(); break;
case "playlist-last": PlaylistLast(); 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;
case "shell-execute": ProcessHelp.ShellExecute(args[0]); break;
@@ -241,7 +242,8 @@ namespace mpvnet
string text = FormatTime(position.TotalMinutes) + ":" +
FormatTime(position.Seconds) + " / " +
FormatTime(duration.TotalMinutes) + ":" +
FormatTime(duration.Seconds);
FormatTime(duration.Seconds) + " " +
DateTime.Now.ToString("H:mm dddd d MMMM", CultureInfo.InvariantCulture);
Core.CommandV("show-text", text, "5000");
}
@@ -670,5 +672,19 @@ namespace mpvnet
Core.SetPropertyInt("playlist-pos", pos);
}
public static void QuickBookmark()
{
if (App.QuickBookmark == 0)
{
App.QuickBookmark = (float)Core.GetPropertyDouble("time-pos");
Core.Command("show-text 'Bookmark Saved'");
}
else
{
Core.SetPropertyDouble("time-pos", App.QuickBookmark);
App.QuickBookmark = 0;
}
}
}
}

View File

@@ -479,9 +479,9 @@ namespace mpvnet
{
if (App.AutoPlay && Paused)
SetPropertyBool("pause", false);
HideLogo();
App.QuickBookmark = 0;
HideLogo();
Duration = TimeSpan.FromSeconds(GetPropertyDouble("duration"));
if (App.StartSize == "video")

View File

@@ -175,6 +175,7 @@ KP9 ab-loop
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
Alt+q script-message mpv.net quick-bookmark
8 cycle sub
j cycle sub
q quit
@@ -209,4 +210,4 @@ Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek
Ctrl+Shift+Left no-osd sub-seek -1 # seek to the previous subtitle
Ctrl+Shift+Right no-osd sub-seek 1 # seek to the next subtitle
Ctrl+Wheel_Up no-osd seek 7
Ctrl+Wheel_Down no-osd seek -7
Ctrl+Wheel_Down no-osd seek -7