#321 new auto-play option

This commit is contained in:
Frank Skare
2021-09-16 16:02:59 +02:00
parent a3b6af9f22
commit 33cd881ae6
5 changed files with 36 additions and 20 deletions

View File

@@ -1,6 +1,10 @@
5.5.0.3 Beta (202?-??-??) 5.5.0.3 Beta (202?-??-??)
- New mpv.net option auto-play which sets pause=no on file load and
selecting from the playlist. Disabled by default.
5.5.0.2 Beta (2021-09-15) 5.5.0.2 Beta (2021-09-15)
- Fix of keepaspect-window=no. - Fix of keepaspect-window=no.

View File

@@ -21,12 +21,13 @@ namespace mpvnet
public static string LightTheme { get; set; } = "light"; public static string LightTheme { get; set; } = "light";
public static string StartSize { get; set; } = "height-session"; public static string StartSize { get; set; } = "height-session";
public static bool RememberWindowPosition { get; set; } public static bool AutoLoadFolder { get; set; } = true;
public static bool AutoPlay { get; set; }
public static bool DebugMode { get; set; } public static bool DebugMode { get; set; }
public static bool IsTerminalAttached { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes"; public static bool IsTerminalAttached { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes";
public static bool RememberVolume { get; set; } = true;
public static bool AutoLoadFolder { get; set; } = true;
public static bool Queue { get; set; } public static bool Queue { get; set; }
public static bool RememberVolume { get; set; } = true;
public static bool RememberWindowPosition { get; set; }
public static bool UpdateCheck { get; set; } public static bool UpdateCheck { get; set; }
public static int StartThreshold { get; set; } = 1500; public static int StartThreshold { get; set; } = 1500;
@@ -213,23 +214,24 @@ namespace mpvnet
{ {
switch (name) switch (name)
{ {
case "remember-window-position": RememberWindowPosition = value == "yes"; return true;
case "debug-mode": DebugMode = value == "yes"; return true;
case "remember-volume": RememberVolume = value == "yes"; return true;
case "queue": Queue = value == "yes"; return true;
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
case "update-check": UpdateCheck = value == "yes"; return true;
case "start-size": StartSize = value; return true;
case "process-instance": ProcessInstance = value; return true;
case "dark-mode": DarkMode = value; return true;
case "start-threshold": StartThreshold = value.ToInt(); return true;
case "recent-count": RecentCount = value.ToInt(); return true;
case "minimum-aspect-ratio": MinimumAspectRatio = value.ToFloat(); return true;
case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true;
case "light-theme": LightTheme = value.Trim('\'', '"'); return true;
case "video-file-extensions": CorePlayer.VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;
case "audio-file-extensions": CorePlayer.AudioTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; case "audio-file-extensions": CorePlayer.AudioTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
case "auto-play": AutoPlay = value == "yes"; return true;
case "dark-mode": DarkMode = value; return true;
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 "image-file-extensions": CorePlayer.ImageTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); 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 "remember-window-position": RememberWindowPosition = value == "yes"; return true;
case "start-size": StartSize = value; return true;
case "start-threshold": StartThreshold = value.ToInt(); return true;
case "update-check": UpdateCheck = value == "yes"; return true;
case "video-file-extensions": CorePlayer.VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;
default: default:
if (writeError) if (writeError)
Terminal.WriteError($"unknown mpvnet.conf property: {name}"); Terminal.WriteError($"unknown mpvnet.conf property: {name}");

View File

@@ -388,7 +388,7 @@ namespace mpvnet
Action = () => { Action = () => {
Core.SetPropertyInt("playlist-pos", index); Core.SetPropertyInt("playlist-pos", index);
if (Core.Paused) if (App.AutoPlay && Core.Paused)
Core.SetPropertyBool("pause", false); Core.SetPropertyBool("pause", false);
} }
}; };

View File

@@ -1134,7 +1134,7 @@ namespace mpvnet
{ {
CommandV("loadfile", file); CommandV("loadfile", file);
if (Paused) if (App.AutoPlay && Paused)
SetPropertyBool("pause", false); SetPropertyBool("pause", false);
} }
else else

View File

@@ -516,6 +516,16 @@ option = yes If the current file ends, go to the next file, keep the last fi
option = no If the current file ends, go to the next file. option = no If the current file ends, go to the next file.
option = always Playback will never automatically advance to the next file. option = always Playback will never automatically advance to the next file.
[setting]
name = auto-play
file = mpvnet
default = no
filter = Playback
help = Sets pause=no on file load and selecting from the playlist. (mpv.net specific setting)
option = yes
option = no
[setting] [setting]
name = loop-file name = loop-file
file = mpv file = mpv