This commit is contained in:
Frank Skare
2019-06-27 06:59:34 +02:00
parent e7fd268927
commit 8899f4b772
5 changed files with 22 additions and 22 deletions

View File

@@ -1,6 +1,9 @@
###
- opening a URL manually no longer uses a input box but uses the clipboard directly
- the manifest was missing the company attribute which caused
mpv.net not appearing in the 'Open with' menu of the Windows File Explorer,
thanks to 44vince44 for pointing this out!!!
### 4.4

View File

@@ -46,11 +46,8 @@ namespace RatingAddon
void ClientMessage(string[] args)
{
if (args == null || args.Length != 2 || args[0] != "rate-file" ||
! int.TryParse(args[1], out int rating))
if (args.Length != 2 || args[0] != "rate-file" || ! int.TryParse(args[1], out int rating))
return;
Dic[mp.get_property_string("path")] = rating;
mp.commandv("show-text", $"Rating: {rating}");
}

View File

@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("mpv.net")]
[assembly: AssemblyDescription("A modern media player")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Frank Skare (stax76)")]
[assembly: AssemblyProduct("mpv.net")]
[assembly: AssemblyCopyright("Copyright © 2017-2019 Frank Skare (stax76)")]
[assembly: AssemblyTrademark("")]

View File

@@ -17,7 +17,7 @@ help = "Whitelist to monitor the clipboard for URLs to play.\n\nDefault: tube vi
name = "process-instance"
default = "single"
filter = "mpv.net"
help = "Defines if more then one mpv.net process is allowed."
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."
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" }]

View File

@@ -179,23 +179,22 @@ namespace mpvnet
public static void LoadScripts()
{
string[] jsLua = { ".lua", ".js" };
string[] startupScripts = Directory.GetFiles(Application.StartupPath + "\\Scripts");
foreach (var scriptPath in startupScripts)
if (jsLua.Contains(Path.GetExtension(scriptPath).ToLower()))
foreach (string scriptPath in startupScripts)
if (scriptPath.EndsWith(".lua") || scriptPath.EndsWith(".js"))
commandv("load-script", $"{scriptPath}");
foreach (var scriptPath in startupScripts)
foreach (string scriptPath in startupScripts)
if (Path.GetExtension(scriptPath) == ".py")
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
foreach (var scriptPath in startupScripts)
foreach (string scriptPath in startupScripts)
if (Path.GetExtension(scriptPath) == ".ps1")
PowerShellScript.Init(scriptPath);
if (Directory.Exists(ConfFolder + "Scripts"))
foreach (var scriptPath in Directory.GetFiles(ConfFolder + "Scripts"))
foreach (string scriptPath in Directory.GetFiles(ConfFolder + "Scripts"))
if (Path.GetExtension(scriptPath) == ".py")
PythonScripts.Add(new PythonScript(File.ReadAllText(scriptPath)));
else if (Path.GetExtension(scriptPath) == ".ps1")
@@ -274,11 +273,11 @@ namespace mpvnet
var client_messageData = (mpv_event_client_message)Marshal.PtrToStructure(evt.data, typeof(mpv_event_client_message));
string[] args = NativeUtf8StrArray2ManagedStrArray(client_messageData.args, client_messageData.num_args);
if (args != null && args.Length > 1 && args[0] == "mpv.net")
if (args.Length > 1 && args[0] == "mpv.net")
{
bool found = false;
foreach (var i in mpvnet.Command.Commands)
foreach (Command i in Command.Commands)
{
if (args[1] == i.Name)
{
@@ -293,6 +292,7 @@ namespace mpvnet
Msg.ShowError($"No command '{args[1]}' found.", $"Available commands are:\n\n{string.Join("\n", names)}\n\nHow to bind these commands can be seen in the [default input bindings and menu definition](https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt).");
}
}
else if (args.Length > 0)
ClientMessage?.Invoke(args);
break;
case mpv_event_id.MPV_EVENT_VIDEO_RECONFIG:
@@ -603,16 +603,16 @@ namespace mpvnet
return rootPointer;
}
static string[] NativeUtf8StrArray2ManagedStrArray(IntPtr pUnmanagedStringArray, int StringCount)
static string[] NativeUtf8StrArray2ManagedStrArray(IntPtr unmanagedStringArray, int StringCount)
{
IntPtr[] pIntPtrArray = new IntPtr[StringCount];
string[] ManagedStringArray = new string[StringCount];
Marshal.Copy(pUnmanagedStringArray, pIntPtrArray, 0, StringCount);
IntPtr[] intPtrArray = new IntPtr[StringCount];
string[] stringArray = new string[StringCount];
Marshal.Copy(unmanagedStringArray, intPtrArray, 0, StringCount);
for (int i = 0; i < StringCount; i++)
ManagedStringArray[i] = StringFromNativeUtf8(pIntPtrArray[i]);
stringArray[i] = StringFromNativeUtf8(intPtrArray[i]);
return ManagedStringArray;
return stringArray;
}
static string StringFromNativeUtf8(IntPtr nativeUtf8)