environment variables and more

This commit is contained in:
stax76
2023-10-31 09:44:20 +01:00
parent ea8944c1cc
commit 4c4088b28a
10 changed files with 140 additions and 119 deletions

View File

@@ -25,7 +25,8 @@ public class Command
["cycle-audio"] = args => CycleAudio(), // deprecated
["cycle-subtitles"] = args => CycleSubtitles(), // deprecated
["playlist-first"] = args => PlaylistFirst(), // deprecated
["playlist-last"] = args => PlaylistLast(), // deprecated
["playlist-last"] = args => PlaylistLast(), // deprecated
["playlist-random"] = args => PlaylistRandom(), // deprecated
};
public string FormatTime(double value) => ((int)value).ToString("00");
@@ -175,4 +176,11 @@ public class Command
if (Player.PlaylistPos < count - 1)
Player.SetPropertyInt("playlist-pos", count - 1);
}
// deprecated
public static void PlaylistRandom()
{
int count = Player.GetPropertyInt("playlist-count");
Player.SetPropertyInt("playlist-pos", new Random().Next(count));
}
}

View File

@@ -69,7 +69,7 @@ public static class InputHelp
new (_("Video"), _("Take Screenshot"), "async screenshot", "s"),
new (_("Video"), _("Take Screenshot without subtitles"), "async screenshot video", "S"),
new (_("Video"), _("Toggle Deinterlace"), "cycle deinterlace", "d"),
new (_("Video"), _("Cycle Aspect Ratio"), "cycle-values video-aspect 16:9 4:3 2.35:1 -1", "a"),
new (_("Video"), _("Cycle Aspect Ratio"), "cycle-values video-aspect-override 16:9 4:3 2.35:1 -1", "a"),
new (_("Video"), _("Rotate Video"), "cycle-values video-rotate 90 180 270 0", "Ctrl+r"),
new (_("Audio"), _("Cycle/Next"), "cycle audio", "KP7"),
new (_("Audio"), "-"),

View File

@@ -6,6 +6,7 @@
<Product>mpv.net</Product>
<Nullable>enable</Nullable>
<RootNamespace>MpvNet</RootNamespace>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>

View File

@@ -208,10 +208,10 @@ public class MainPlayer : MpvClient
get {
if (_configFolder == null)
{
string? mpv_home = Environment.GetEnvironmentVariable("MPV_HOME");
string? mpvnet_home = Environment.GetEnvironmentVariable("MPVNET_HOME");
if (Directory.Exists(mpv_home))
return _configFolder = mpv_home.AddSep();
if (Directory.Exists(mpvnet_home))
return _configFolder = mpvnet_home.AddSep();
_configFolder = Folder.Startup + "portable_config";