terminal support added via mpvnet.com

This commit is contained in:
Frank Skare
2019-07-26 18:32:42 +02:00
parent e98ff53058
commit 9d37e67901
4 changed files with 12 additions and 6 deletions

View File

@@ -17,10 +17,8 @@
to fail if it was waiting for a drive to wakeup 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, - a new JavaScript was included to show the playlist with a smaller font size,
the script is located at startup/scripts the script is located at startup/scripts
- mpv.net attaches now to the parent terminal, when started from - terminal support added via mpvnet.com, reading input keys from stdin
a PowerShell terminal using the --terminal switch mpvnet gives is not supported
status messages on the console and debug messages useful to write
JavaScript and Lua scripts
### 4.7.7 ### 4.7.7

View File

@@ -34,6 +34,7 @@ namespace mpvnet
public static bool RememberHeight { get; set; } = true; public static bool RememberHeight { get; set; } = true;
public static bool RememberPosition { get; set; } public static bool RememberPosition { get; set; }
public static bool DebugMode { get; set; } public static bool DebugMode { get; set; }
public static bool IsTerminalHosted { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes";
public static int StartThreshold { get; set; } = 1500; public static int StartThreshold { get; set; } = 1500;

View File

@@ -64,9 +64,9 @@ namespace mpvnet
return; return;
} }
Native.AttachConsole(-1 /*ATTACH_PARENT_PROCESS*/); if (App.IsTerminalHosted) Native.AttachConsole(-1 /*ATTACH_PARENT_PROCESS*/);
Application.Run(new MainForm()); Application.Run(new MainForm());
Native.FreeConsole(); if (App.IsTerminalHosted) Native.FreeConsole();
mutex.Dispose(); mutex.Dispose();
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -89,6 +89,13 @@ namespace mpvnet
{ {
LoadLibrary("mpv-1.dll"); LoadLibrary("mpv-1.dll");
Handle = mpv_create(); Handle = mpv_create();
if (App.IsTerminalHosted)
{
set_property_string("terminal", "yes");
set_property_string("msg-level", "osd/libass=fatal");
}
set_property_string("config-dir", ConfigFolder); set_property_string("config-dir", ConfigFolder);
set_property_string("osc", "yes"); set_property_string("osc", "yes");
set_property_string("config", "yes"); set_property_string("config", "yes");