From 28f9df1cee7c032bf8afb4b44d015bfd762493f7 Mon Sep 17 00:00:00 2001 From: stax76 Date: Tue, 3 May 2022 15:18:42 +0200 Subject: [PATCH] New mpv.net specific option keep-open-exit added --- docs/Changelog.md | 9 ++++++--- src/Misc/App.cs | 4 +++- src/Misc/CorePlayer.cs | 4 +--- src/Resources/editor_conf.txt | 24 +++++++++++++++++------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/docs/Changelog.md b/docs/Changelog.md index d3bbeed..54db982 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,8 +1,11 @@ -- Fix keyboard layout change not working. +- Fix keyboard layout change. - Fix multi monitor setup with different DPI values. -- Fix config editor handling `keep-open` incorrectly. -- New playlist-add command added to change the playlist position. +- Fix config editor handling `keep-open` and `keep-open-pause` incorrectly. +- New mpv.net specific option `keep-open-exit` added. If set to yes and + keep-open is set to no, mpv.net exits after the last file ends. +- New `playlist-add` command added to change the playlist position, + jumps to the other end when the beginning or end is reached. Ctrl+F11 goes 10 positions backward. Ctrl+F12 goes 10 positions forward. diff --git a/src/Misc/App.cs b/src/Misc/App.cs index e79aecb..2a0643c 100644 --- a/src/Misc/App.cs +++ b/src/Misc/App.cs @@ -25,6 +25,7 @@ namespace mpvnet public static bool AutoPlay { get; set; } public static bool DebugMode { get; set; } public static bool IsTerminalAttached { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes"; + public static bool KeepOpenExit { get; set; } public static bool Queue { get; set; } public static bool RememberVolume { get; set; } = true; public static bool RememberWindowPosition { get; set; } @@ -241,14 +242,15 @@ namespace mpvnet case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true; case "debug-mode": DebugMode = value == "yes"; return true; case "image-file-extensions": CorePlayer.ImageTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; + case "keep-open-exit": KeepOpenExit = value == "yes"; return true; case "light-theme": LightTheme = value.Trim('\'', '"'); return true; case "minimum-aspect-ratio": MinimumAspectRatio = value.ToFloat(); return true; case "process-instance": ProcessInstance = value; return true; case "queue": Queue = value == "yes"; return true; case "recent-count": RecentCount = value.ToInt(); return true; case "remember-volume": RememberVolume = value == "yes"; return true; - case "show-logo": ShowLogo = value == "yes"; return true; case "remember-window-position": RememberWindowPosition = value == "yes"; return true; + case "show-logo": ShowLogo = value == "yes"; return true; case "start-size": StartSize = value; return true; case "start-threshold": StartThreshold = value.ToInt(); return true; case "video-file-extensions": CorePlayer.VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; diff --git a/src/Misc/CorePlayer.cs b/src/Misc/CorePlayer.cs index 536702a..ef6f241 100644 --- a/src/Misc/CorePlayer.cs +++ b/src/Misc/CorePlayer.cs @@ -139,8 +139,6 @@ namespace mpvnet SetPropertyInt("osd-duration", 2000); - SetPropertyBool("keep-open", true); - SetPropertyBool("keep-open-pause", false); SetPropertyBool("input-default-bindings", true); SetPropertyBool("input-builtin-bindings", false); @@ -162,7 +160,7 @@ namespace mpvnet { ShowLogo(); - if (GetPropertyString("keep-open") == "no") + if (GetPropertyString("keep-open") == "no" && App.KeepOpenExit) Core.CommandV("quit"); } }); diff --git a/src/Resources/editor_conf.txt b/src/Resources/editor_conf.txt index 4b98a25..f283098 100644 --- a/src/Resources/editor_conf.txt +++ b/src/Resources/editor_conf.txt @@ -505,6 +505,17 @@ help = Show progress in taskbar. option = yes option = no +[setting] +name = keep-open +file = mpv +default = no +filter = Playback +help = Using no, mpv would terminate after the last file but mpv.net never terminates automatically. + +option = yes If the current file ends, go to the next file, keep the last file open. +option = no If the current file ends, go to the next file. +option = always Playback will never automatically advance to the next file. + [setting] name = keep-open-pause file = mpv @@ -516,15 +527,14 @@ option = yes option = no [setting] -name = keep-open -file = mpv -default = yes +name = keep-open-exit +file = mpvnet +default = no filter = Playback -help = Using no, mpv would terminate after the last file but mpv.net never terminates automatically. +help = If set to yes and keep-open is set to no, mpv.net exits after the last file ends. -option = yes If the current file ends, go to the next file, keep the last file open. -option = no If the current file ends, go to the next file. -option = always Playback will never automatically advance to the next file. +option = yes +option = no [setting] name = auto-play