This commit is contained in:
Frank Skare
2020-06-20 03:35:27 +02:00
parent b0ef161ed9
commit dbc8ddaf2b
9 changed files with 27 additions and 22 deletions

View File

@@ -2,7 +2,7 @@
5.4.8.2 Beta (not yet released)
============
- CLI --shuffle issue fix
5.4.8.1 Beta

View File

@@ -45,7 +45,11 @@ namespace mpvnet
if (Padding > 0 && value.Length < Padding)
value = value.PadRight(Padding);
if (color == ConsoleColor.Red)
Console.Error.WriteLine(value);
else
Console.WriteLine(value);
Console.ResetColor();
Trace.WriteLine(obj);
}

View File

@@ -26,7 +26,7 @@ namespace mpvnet
public List<KeyValuePair<string, ScriptBlock>> EventHandlers = new List<KeyValuePair<string, ScriptBlock>>();
public List<KeyValuePair<string, ScriptBlock>> PropChangedHandlers = new List<KeyValuePair<string, ScriptBlock>>();
public static List<PowerShell> Instances { get; } = new List<PowerShell>();
public static List<PowerShell> References { get; } = new List<PowerShell>();
public object Invoke() => Invoke(null, null);

View File

@@ -164,7 +164,7 @@
h script-message mpv.net show-history #menu: Tools > Show History
l ab-loop #menu: Tools > Set/clear A-B loop points
L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping
_ cycle shuffle #menu: Tools > Toggle Shuffle
_ playlist-shuffle #menu: Tools > Shuffle Playlist
Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Toggle Hardware Decoding
_ script-message mpv.net show-setup-dialog #menu: Tools > Setup...

View File

@@ -8,7 +8,6 @@ osd-duration = 2000
osd-playing-msg = '${filename}'
script-opts = osc-scalewindowed=1.5,osc-hidetimeout=2000,console-scale=1
screenshot-directory = '~~desktop/'
hwdec = yes
[protocol.https]
osd-playing-msg = '${media-title}'

View File

@@ -3,16 +3,19 @@ $ErrorActionPreference = 'Stop'
if ($args.Length -ne 2) {
Write-Host 'Invalid arguments' -ForegroundColor Red
pause
exit
}
if (-not (Get-Command curl.exe)) {
Write-Host 'Error using curl.exe' -ForegroundColor Red
pause
exit
}
if ($PSVersionTable.PSVersion.Major -lt 5) {
Write-Host 'PowerShell 5.1 not found' -ForegroundColor Red
pause
exit
}

View File

@@ -582,15 +582,6 @@ namespace mpvnet
int d_w = (int)(c_h * aspect - c_w);
int d_h = (int)(c_w / aspect - c_h);
Debug.WriteLine(d_w);
Debug.WriteLine(d_h);
int d_w2 = (int)(c_h * aspect - c_w);
int d_h2 = (int)(c_w / aspect - c_h);
Debug.WriteLine(d_w2);
Debug.WriteLine(d_h2);
int[] d_corners = { d_w, d_h, -d_w, -d_h };
int[] corners = { rc.Left, rc.Top, rc.Right, rc.Bottom };
int corner = NativeHelp.GetResizeBorder(m.WParam.ToInt32());

View File

@@ -237,8 +237,7 @@ public class ToolStripRendererEx : ToolStripSystemRenderer
RectangleF rectF = new RectangleF(rect.X + rect.Height / 2f - ellipseWidth / 2f,
rect.Y + rect.Height / 2f - ellipseWidth / 2f,
ellipseWidth,
ellipseWidth);
ellipseWidth, ellipseWidth);
using (Brush brush = new SolidBrush(ForegroundColor))
e.Graphics.FillEllipse(brush, rectF);

View File

@@ -366,8 +366,8 @@ namespace mpvnet
ps.Module = Path.GetFileName(file);
ps.Print = true;
lock (PowerShell.Instances)
PowerShell.Instances.Add(ps);
lock (PowerShell.References)
PowerShell.References.Add(ps);
ps.Invoke();
}
@@ -874,6 +874,7 @@ namespace mpvnet
public void ProcessCommandLine(bool preInit)
{
bool shuffle = false;
var args = Environment.GetCommandLineArgs().Skip(1);
string[] preInitProperties = { "input-terminal", "terminal", "input-file", "config",
@@ -919,7 +920,12 @@ namespace mpvnet
core.ProcessProperty(left, right);
if (!App.ProcessProperty(left, right))
{
set_property_string(left, right, true);
if (left == "shuffle" && right == "yes")
shuffle = true;
}
}
}
catch (Exception e)
@@ -935,16 +941,19 @@ namespace mpvnet
List<string> files = new List<string>();
foreach (string i in args)
{
if (!i.StartsWith("--") && (i == "-" || i.Contains("://") ||
i.Contains(":\\") || i.StartsWith("\\\\") || File.Exists(i)))
{
files.Add(i);
}
}
LoadFiles(files.ToArray(), !App.Queue, Control.ModifierKeys.HasFlag(Keys.Control) || App.Queue);
if (shuffle)
{
core.command("playlist-shuffle");
set_property_int("playlist-pos", 0);
}
if (files.Count == 0 || files[0].Contains("://"))
{
VideoSizeChanged?.Invoke();