diff --git a/Changelog.md b/Changelog.md index de621ad..ee330eb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,6 +17,10 @@ to fail if it was waiting for a drive to wakeup - a new JavaScript was included to show the playlist with a smaller font size, the script is located at startup/scripts +- mpv.net attaches now to the parent terminal, when started from + a PowerShell terminal using the --terminal switch mpvnet gives + status messages on the console and debug messages useful to write + JavaScript and Lua scripts ### 4.7.7 diff --git a/mpv.net/Misc/Program.cs b/mpv.net/Misc/Program.cs index 0ab8508..fe831e6 100644 --- a/mpv.net/Misc/Program.cs +++ b/mpv.net/Misc/Program.cs @@ -64,7 +64,9 @@ namespace mpvnet return; } + Native.AttachConsole(-1 /*ATTACH_PARENT_PROCESS*/); Application.Run(new MainForm()); + Native.FreeConsole(); mutex.Dispose(); } catch (Exception ex) diff --git a/mpv.net/Native/Native.cs b/mpv.net/Native/Native.cs index 0ef8d9e..19d2717 100644 --- a/mpv.net/Native/Native.cs +++ b/mpv.net/Native/Native.cs @@ -6,6 +6,12 @@ namespace mpvnet { public class Native { + [DllImport("kernel32.dll")] + public static extern bool AttachConsole(int dwProcessId); + + [DllImport("kernel32.dll", SetLastError = true)] + public static extern bool FreeConsole(); + [DllImport("kernel32.dll")] public static extern IntPtr LoadLibrary(string dllToLoad); diff --git a/mpv.net/Resources/inputConf.txt b/mpv.net/Resources/inputConf.txt index cbeaf81..2aaab91 100644 --- a/mpv.net/Resources/inputConf.txt +++ b/mpv.net/Resources/inputConf.txt @@ -137,7 +137,7 @@ Ctrl+t set ontop yes #menu: View > On Top > Enable Ctrl+T set ontop no #menu: View > On Top > Disable b cycle border #menu: View > Toggle Border - i script-message mpv.net show-info #menu: View > File Info + i script-message mpv.net show-info #menu: View > File/Stream Info t script-binding stats/display-stats #menu: View > Show Statistics T script-binding stats/display-stats-toggle #menu: View > Toggle Statistics Del script-binding osc/visibility #menu: View > Toggle OSC Visibility @@ -190,4 +190,5 @@ Ctrl+Wheel_Up no-osd seek 7 Ctrl+Wheel_Down no-osd seek -7 MBTN_Left_DBL cycle fullscreen - KP_Enter cycle fullscreen \ No newline at end of file + KP_Enter cycle fullscreen + MBTN_Left ignore \ No newline at end of file diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index e186e94..70bc552 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -598,7 +598,7 @@ namespace mpvnet foreach (string url in App.UrlWhitelist) { if (clipboard.Contains("://") && ! clipboard.Contains("\n") && - ! clipboard.Contains(" ") && clipboard.Contains(url.ToLower()) && + ! clipboard.Contains(" ") && clipboard.Contains(url.ToLower().Trim()) && RegHelp.GetString(App.RegPath, "LastURL") != clipboard && Visible) { RegHelp.SetObject(App.RegPath, "LastURL", clipboard); diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index 4c15a72..b14c786 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -554,14 +554,6 @@ namespace mpvnet } } - Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control)); - - if (files.Count == 0 || files[0].Contains("://")) - { - VideoSizeAutoResetEvent.Set(); - VideoSizeChanged?.Invoke(); - } - foreach (string i in args) { if (i.StartsWith("--")) @@ -583,6 +575,14 @@ namespace mpvnet } } } + + Load(files.ToArray(), App.ProcessInstance != "queue", Control.ModifierKeys.HasFlag(Keys.Control)); + + if (files.Count == 0 || files[0].Contains("://")) + { + VideoSizeAutoResetEvent.Set(); + VideoSizeChanged?.Invoke(); + } } public static DateTime LastLoad;