support mpv idle property partly
This commit is contained in:
@@ -24,8 +24,8 @@ namespace mpvnet
|
||||
public static bool AutoLoadFolder { get; set; } = true;
|
||||
public static bool AutoPlay { get; set; }
|
||||
public static bool DebugMode { get; set; }
|
||||
public static bool Exit { 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; }
|
||||
@@ -242,7 +242,6 @@ 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;
|
||||
|
||||
@@ -142,7 +142,14 @@ namespace mpvnet
|
||||
SetPropertyString("config", "yes");
|
||||
|
||||
ProcessCommandLine(true);
|
||||
|
||||
mpv_error err = mpv_initialize(Handle);
|
||||
string idle = GetPropertyString("idle");
|
||||
App.Exit = idle == "no" || idle == "once";
|
||||
|
||||
// otherwise shutdown is raised before media files are loaded,
|
||||
// this means Lua scripts that use idle might not work correctly
|
||||
SetPropertyString("idle", "yes");
|
||||
|
||||
if (err < 0)
|
||||
throw new Exception("mpv_initialize error" + BR2 + GetError(err) + BR);
|
||||
@@ -159,7 +166,7 @@ namespace mpvnet
|
||||
{
|
||||
ShowLogo();
|
||||
|
||||
if (GetPropertyString("keep-open") == "no" && App.KeepOpenExit)
|
||||
if (GetPropertyString("keep-open") == "no" && App.Exit)
|
||||
Core.CommandV("quit");
|
||||
}
|
||||
});
|
||||
@@ -985,7 +992,8 @@ namespace mpvnet
|
||||
var args = Environment.GetCommandLineArgs().Skip(1);
|
||||
|
||||
string[] preInitProperties = { "input-terminal", "terminal", "input-file", "config",
|
||||
"config-dir", "input-conf", "load-scripts", "scripts", "player-operation-mode" };
|
||||
"config-dir", "input-conf", "load-scripts", "scripts", "player-operation-mode",
|
||||
"idle", "log-file", "msg-color", "dump-stats", "msg-level", "really-quiet" };
|
||||
|
||||
foreach (string i in args)
|
||||
{
|
||||
|
||||
@@ -513,7 +513,7 @@ 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. If keep-open-exit is set to yes, mpv.net exits after the last file.
|
||||
option = no If the current file ends, go to the next file. If idle is set to no, mpv.net exits after the last file.
|
||||
option = always Playback will never automatically advance to the next file.
|
||||
|
||||
[setting]
|
||||
@@ -527,11 +527,11 @@ option = yes
|
||||
option = no
|
||||
|
||||
[setting]
|
||||
name = keep-open-exit
|
||||
file = mpvnet
|
||||
default = no
|
||||
name = idle
|
||||
file = mpv
|
||||
default = yes
|
||||
filter = Playback
|
||||
help = If set to yes and keep-open is set to no, mpv.net exits after the last file ends. In mpv the idle property would be used, it's not possible for mpv.net to use the idle property.
|
||||
help = If set to no and keep-open is also set to no, mpv.net exits after the last file ends. In mpv the idle default is no and in mpv.net the default is yes.
|
||||
|
||||
option = yes
|
||||
option = no
|
||||
|
||||
Reference in New Issue
Block a user