This commit is contained in:
Frank Skare
2019-07-01 02:45:22 +02:00
parent d1c58585f5
commit cedd694e8e
9 changed files with 37 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
###
### 4.5
- opening a URL manually no longer uses a input box but uses the clipboard directly
- the manifest was missing the company attribute which caused
@@ -10,6 +10,9 @@
- a description on how to start mpv.net from Google Chrome was added to the
manual, it's useful to play videos from sites like YouTube, find the
description [here](https://github.com/stax76/mpv.net/blob/master/Manual.md#chrome-extension)
- new config setting remember-height added to remember the window height,
otherwise the video's native resolution is used
- support for protocols other then http added
### 4.4

View File

@@ -219,9 +219,9 @@ namespace mpvnet
{
MainForm.Instance.Invoke(new Action(() => {
string clipboard = Clipboard.GetText();
if (string.IsNullOrEmpty(clipboard) || !clipboard.Contains("://") || clipboard.Contains("\n") || clipboard.Contains(" "))
if (string.IsNullOrEmpty(clipboard) || (!clipboard.Contains("://") && !File.Exists(clipboard)) || clipboard.Contains("\n"))
{
Msg.ShowError("The clipboard does not contain a valid URL, it has to contain :// and is not allowed to contain a newline or space character.");
Msg.ShowError("The clipboard does not contain a valid URL or file, URLs have to contain :// and is not allowed to contain a newline character.");
return;
}
mp.Load(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control));

View File

@@ -33,7 +33,7 @@ namespace mpvnet
List<string> files = new List<string>();
foreach (string arg in args)
if (!arg.StartsWith("--") && (File.Exists(arg) || arg == "-" || arg.StartsWith("http")))
if (!arg.StartsWith("--") && (arg == "-" || arg.Contains("://") || File.Exists(arg)))
files.Add(arg);
if (files.Count > 0)

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.4.0.0")]
[assembly: AssemblyFileVersion("4.4.0.0")]
[assembly: AssemblyVersion("4.5.0.0")]
[assembly: AssemblyFileVersion("4.5.0.0")]

View File

@@ -25,7 +25,7 @@
# mpv input keys: https://github.com/stax76/mpv.net/wiki/mpv-input-keys
o script-message mpv.net open-files #menu: Open > Open Files...
u script-message mpv.net open-url #menu: Open > Open URL...
u script-message mpv.net open-url #menu: Open > Open URL or file path from clipboard
_ ignore #menu: Open > -
Alt+a script-message mpv.net load-audio #menu: Open > Load external audio files...
Alt+s script-message mpv.net load-sub #menu: Open > Load external subtitle files...

View File

@@ -254,6 +254,14 @@ default = "50%"
filter = "Screen"
help = "Set the initial window size in percent. Please note that this setting is only partly implemented in mpv.net, accepted are only integer values with percent sign added. Default: 50%"
[[settings]]
name = "remember-height"
default = "yes"
filter = "Screen"
help = "mpv.net specific setting to remember the window height, otherwise the video's native resolution is used."
options = [{ name = "yes" },
{ name = "no" }]
[[settings]]
name = "keep-open-pause"
default = "yes"

View File

@@ -1,7 +1,7 @@
[[settings]]
name = "dark-mode"
default = "always"
filter = "mpv.net"
filter = "General"
help = "Enables a dark theme."
options = [{ name = "always" },
{ name = "system" , help = "Available on Windows 10 or higher" },
@@ -9,15 +9,15 @@ options = [{ name = "always" },
[[settings]]
name = "url-whitelist"
filter = "mpv.net"
filter = "General"
type = "string"
help = "Whitelist to monitor the clipboard for URLs to play.\n\nDefault: tube vimeo ard zdf"
help = "mpv.net specific whitelist setting to monitor the clipboard for URLs to play.\n\nDefault: tube vimeo ard zdf"
[[settings]]
name = "process-instance"
default = "single"
filter = "mpv.net"
help = "Defines if more then one mpv.net process is allowed.\n\nTip: Whenever the control key is pressed when files or URLs are opened, the playlist is not cleared but the files or URLs are appended to the playlist."
filter = "General"
help = "mpv.net specific setting that defines if more then one mpv.net process is allowed.\n\nTip: Whenever the control key is pressed when files or URLs are opened, the playlist is not cleared but the files or URLs are appended to the playlist."
options = [{ name = "multi", help = "Create a new process everytime the shell starts mpv.net" },
{ name = "single", help = "Force a single process everytime the shell starts mpv.net" },
{ name = "queue", help = "Force a single process and add files to playlist" }]
@@ -25,7 +25,7 @@ options = [{ name = "multi", help = "Create a new process everytime the shell s
[[settings]]
name = "debug-mode"
default = "no"
filter = "mpv.net"
help = "Writes debug info to a file located on the desktop."
filter = "General"
help = "mpv.net specific setting that writes debug info to a file located on the desktop."
options = [{ name = "yes" },
{ name = "no" }]

View File

@@ -64,7 +64,7 @@ namespace mpvnet
void CM_Popup(object sender, EventArgs e) => CursorHelp.Show();
void VideoSizeChanged() => BeginInvoke(new Action(() => SetFormPosAndSizeKeepHeight()));
void VideoSizeChanged() => BeginInvoke(new Action(() => SetFormPosAndSize()));
void Shutdown() => BeginInvoke(new Action(() => Close()));
@@ -222,11 +222,12 @@ namespace mpvnet
Native.SetWindowPos(Handle, IntPtr.Zero /* HWND_TOP */, left, top, rect.Width, rect.Height, 4 /* SWP_NOZORDER */);
}
void SetFormPosAndSizeKeepHeight()
void SetFormPosAndSize()
{
if (IsFullscreen || mp.VideoSize.Width == 0) return;
Screen screen = Screen.FromControl(this);
int height = ClientSize.Height;
int height = mp.VideoSize.Height;
if (mp.RememberHeight) height = ClientSize.Height;
if (height > screen.Bounds.Height * 0.9) height = Convert.ToInt32(screen.Bounds.Height * mp.Autofit);
int width = Convert.ToInt32(height * mp.VideoSize.Width / (double)mp.VideoSize.Height);
Point middlePos = new Point(Left + Width / 2, Top + Height / 2);
@@ -272,7 +273,7 @@ namespace mpvnet
{
string path = mp.get_property_string("path");
BeginInvoke(new Action(() => {
if (File.Exists(path) || path.StartsWith("http"))
if (File.Exists(path) || path.Contains("://"))
Text = Path.GetFileName(path) + " - mpv.net " + Application.ProductVersion;
else
Text = "mpv.net " + Application.ProductVersion;
@@ -311,7 +312,7 @@ namespace mpvnet
else
FormBorderStyle = FormBorderStyle.None;
SetFormPosAndSizeKeepHeight();
SetFormPosAndSize();
}
}

View File

@@ -72,11 +72,12 @@ namespace mpvnet
public static bool Fullscreen { get; set; }
public static bool Border { get; set; } = true;
public static bool RememberHeight { get; set; } = true;
public static int Screen { get; set; } = -1;
public static int Edition { get; set; }
public static float Autofit { get; set; } = 0.50f;
public static float Autofit { get; set; } = 0.5f;
public static void ProcessProperty(string name, string value)
{
@@ -91,6 +92,7 @@ namespace mpvnet
case "fullscreen": Fullscreen = value == "yes"; break;
case "border": Border = value == "yes"; break;
case "screen": Screen = Convert.ToInt32(value); break;
case "remember-height": RememberHeight = value == "yes"; break;
}
}
@@ -524,11 +526,10 @@ namespace mpvnet
foreach (string i in args)
{
if (!i.StartsWith("--") && (i == "-" || i.StartsWith("http") || File.Exists(i)))
if (!i.StartsWith("--") && (i == "-" || i.Contains("://") || File.Exists(i)))
{
files.Add(i);
if (i.StartsWith("http"))
RegHelp.SetObject(App.RegPath, "LastURL", i);
if (i.Contains("://")) RegHelp.SetObject(App.RegPath, "LastURL", i);
}
}