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 crash choosing Matroska edition in the menu.
- Fix auto-play not working with user scripts. - Fix auto-play not working with user scripts.
- When input.conf is created on the very first start and a - 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 Jumps to the last playlist entry, if the loaded file is
already the last entry, nothing happens. 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\> ### reg-file-assoc \<audio|video|image\>
Registers the file associations. Registers the file associations.

View File

@@ -36,6 +36,7 @@ namespace mpvnet
public static int RecentCount { get; set; } = 15; public static int RecentCount { get; set; } = 15;
public static float MinimumAspectRatio { get; set; } = 1.2f; public static float MinimumAspectRatio { get; set; } = 1.2f;
public static float QuickBookmark { get; set; }
public static Extension Extension { 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-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 "quick-bookmark": QuickBookmark(); break;
case "reg-file-assoc": RegisterFileAssociations(args[0]); break; case "reg-file-assoc": RegisterFileAssociations(args[0]); break;
case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break; case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
case "shell-execute": ProcessHelp.ShellExecute(args[0]); break; case "shell-execute": ProcessHelp.ShellExecute(args[0]); break;
@@ -241,7 +242,8 @@ namespace mpvnet
string text = FormatTime(position.TotalMinutes) + ":" + string text = FormatTime(position.TotalMinutes) + ":" +
FormatTime(position.Seconds) + " / " + FormatTime(position.Seconds) + " / " +
FormatTime(duration.TotalMinutes) + ":" + 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"); Core.CommandV("show-text", text, "5000");
} }
@@ -670,5 +672,19 @@ namespace mpvnet
Core.SetPropertyInt("playlist-pos", pos); 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

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

View File

@@ -175,6 +175,7 @@ KP9 ab-loop
Sharp script-message mpv.net cycle-audio Sharp script-message mpv.net cycle-audio
Ctrl+F11 script-message mpv.net playlist-add -10 Ctrl+F11 script-message mpv.net playlist-add -10
Ctrl+F12 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 8 cycle sub
j cycle sub j cycle sub
q quit q quit