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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user