Compare commits

..

7 Commits
0.2.2 ... 0.2.6

Author SHA1 Message Date
Frank Skare
6022809080 - 2019-03-08 22:51:34 +01:00
Frank Skare
714eb7c9fa 0.2.5 2019-02-27 21:18:12 +01:00
Frank Skare
0f68c0cd3e 0.2.4 2018-12-20 00:08:21 +01:00
Frank Skare
ea8de8bd5a 0.2.3 2018-12-19 23:42:32 +01:00
Frank Skare
e31284171c 0.2.3 2018-12-19 23:35:16 +01:00
Frank Skare
f115a5cf3a 0.2.3 2018-12-19 23:28:38 +01:00
stax76
5e3e734245 - 2018-05-28 22:18:34 +02:00
18 changed files with 228 additions and 123 deletions

View File

@@ -10,7 +10,7 @@
<AssemblyName>CSScriptAddon</AssemblyName> <AssemblyName>CSScriptAddon</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<MyType>Windows</MyType> <MyType>Windows</MyType>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

View File

@@ -15,7 +15,7 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase

View File

@@ -46,6 +46,23 @@ class Script
### Changes ### Changes
### 0.2.5
- mpv lib updated to 2019-02-24
- UI glitch fixed the appeared when started in fullscreen mode
- fixed default video output mode which caused video playback to fail
### 0.2.4
- changed minimum runtime to .NET 4.7.2
- fixed mpv.net not working with new mpv lib
- the track name in the title bar was sometimes wrong
- mpv lib updated to 2018-12-16
- quit-watch-later added to context menu (Shift+Q) to exit and resume at the last position
- ab loop added to menu
- added the possibility to modify mpv.conf settings using the context menu
- added link to the manual and default keys to the menu
### 0.2.2 ### 0.2.2
- history feature added - history feature added

View File

@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Rating</RootNamespace> <RootNamespace>Rating</RootNamespace>
<AssemblyName>RatingAddon</AssemblyName> <AssemblyName>RatingAddon</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup> </startup>
</configuration> </configuration>

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@@ -65,34 +66,72 @@ namespace mpvnet
ProcessHelp.Start(OS.GetTextEditor(), '"' + mpv.InputConfPath + '"'); ProcessHelp.Start(OS.GetTextEditor(), '"' + mpv.InputConfPath + '"');
} }
public static void show_prefs(string[] args) private static void CreateMpvConf()
{ {
string filepath = Folder.AppDataRoaming + "mpv\\mpv.conf"; if (!File.Exists(mpv.mpvConfPath))
if (!File.Exists(filepath))
{ {
var dirPath = Folder.AppDataRoaming + "mpv\\"; var dirPath = Folder.AppDataRoaming + "mpv\\";
if (!Directory.Exists(dirPath)) if (!Directory.Exists(dirPath))
Directory.CreateDirectory(dirPath); Directory.CreateDirectory(dirPath);
File.WriteAllText(filepath, "# https://mpv.io/manual/master/#configuration-files"); File.WriteAllText(mpv.mpvConfPath, "# https://mpv.io/manual/master/#configuration-files");
}
} }
ProcessHelp.Start(OS.GetTextEditor(), '"' + filepath + '"'); public static void show_prefs(string[] args)
{
CreateMpvConf();
ProcessHelp.Start(OS.GetTextEditor(), '"' + mpv.mpvConfPath + '"');
} }
public static void history(string[] args) public static void history(string[] args)
{ {
var fp = Folder.AppDataRoaming + "mpv\\history.txt"; var fp = Folder.AppDataRoaming + "mpv\\history.txt";
if (MsgQuestion($"Create history.txt file in config folder?{BR2}mpv.net will write the date, time and filename of opened file to it.") == DialogResult.OK) if (File.Exists(fp))
Process.Start(fp);
else
if (MsgQuestion($"Create history.txt file in config folder?{BR2}mpv.net will write the date, time and filename of opened files to it.") == DialogResult.OK)
File.WriteAllText(fp, ""); File.WriteAllText(fp, "");
} }
public static void show_info(string[] args) public static void shell_execute(string[] args)
{ {
try Process.Start(args[0]);
}
public static void set_setting(string[] args)
{
CreateMpvConf();
bool changed = false;
string fp = mpv.mpvConfPath;
var confLines = File.ReadAllLines(fp);
for (int i = 0; i < confLines.Length; i++)
{
if (confLines[i].Left("=").Trim() == args[0])
{
confLines[i] = args[0] + "=" + args[1];
changed = true;
}
}
if (changed)
{
File.WriteAllText(fp, String.Join(Environment.NewLine, confLines));
}
else
{
File.WriteAllText(fp,
File.ReadAllText(fp) + Environment.NewLine + args[0] + "=" + args[1]);
}
MsgInfo("Please restart mpv.net");
}
public static void show_info(string[] args)
{ {
var fi = new FileInfo(mpv.GetStringProp("path")); var fi = new FileInfo(mpv.GetStringProp("path"));
@@ -102,7 +141,12 @@ namespace mpvnet
var h = mi.GetInfo(StreamKind.Video, "Height"); var h = mi.GetInfo(StreamKind.Video, "Height");
var pos = TimeSpan.FromSeconds(mpv.GetIntProp("time-pos")); var pos = TimeSpan.FromSeconds(mpv.GetIntProp("time-pos"));
var dur = TimeSpan.FromSeconds(mpv.GetIntProp("duration")); var dur = TimeSpan.FromSeconds(mpv.GetIntProp("duration"));
var br = Convert.ToInt32(mi.GetInfo(StreamKind.Video, "BitRate")) / 1000.0 / 1000.0; string mibr = mi.GetInfo(StreamKind.Video, "BitRate");
if (mibr == "")
mibr = "0";
var br = Convert.ToInt32(mibr) / 1000.0 / 1000.0;
var vf = mpv.GetStringProp("video-format").ToUpper(); var vf = mpv.GetStringProp("video-format").ToUpper();
var fn = fi.Name; var fn = fi.Name;
@@ -122,9 +166,5 @@ namespace mpvnet
string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00"); string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00");
} }
} }
catch (Exception)
{
}
}
} }
} }

View File

@@ -42,8 +42,8 @@
// MainForm // MainForm
// //
this.AllowDrop = true; this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(20F, 48F); this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.Black; this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(1553, 1000); this.ClientSize = new System.Drawing.Size(1553, 1000);
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -52,6 +52,7 @@
this.Name = "MainForm"; this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "mpv.net"; this.Text = "mpv.net";
this.Load += new System.EventHandler(this.MainForm_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@@ -24,28 +24,23 @@ namespace mpvnet
public MainForm() public MainForm()
{ {
InitializeComponent();
try try
{ {
Application.ThreadException += Application_ThreadException; Application.ThreadException += Application_ThreadException;
InitializeComponent();
SetFormPosSize(); SetFormPosSize();
Instance = this; Instance = this;
Hwnd = Handle; Hwnd = Handle;
mpv.Init(); ChangeFullscreen((mpv.mpvConv.ContainsKey("fullscreen") && mpv.mpvConv["fullscreen"] == "yes") || (mpv.mpvConv.ContainsKey("fs") && mpv.mpvConv["fs"] == "yes"));
mpv.ObserveBoolProp("fullscreen", MpvChangeFullscreen);
mpv.AfterShutdown += Mpv_AfterShutdown;
mpv.VideoSizeChanged += Mpv_VideoSizeChanged;
mpv.PlaybackRestart += mpv_PlaybackRestart;
ToolStripManager.Renderer = new ToolStripRendererEx(ToolStripRenderModeEx.SystemDefault);
CMS = new ContextMenuStripEx(components); CMS = new ContextMenuStripEx(components);
CMS.Opened += CMS_Opened; CMS.Opened += CMS_Opened;
ContextMenuStrip = CMS; ContextMenuStrip = CMS;
BuildMenu(); BuildMenu();
} }
catch (Exception e) catch (Exception ex)
{ {
HandleException(e); HandleException(ex);
} }
} }
@@ -100,14 +95,19 @@ namespace mpvnet
CursorHelp.Show(); CursorHelp.Show();
} }
private string LastHistory;
private void mpv_PlaybackRestart() private void mpv_PlaybackRestart()
{ {
var fn = mpv.GetStringProp("filename"); var fn = mpv.GetStringProp("filename");
BeginInvoke(new Action(() => { Text = fn + " - mpv.net " + Application.ProductVersion; })); BeginInvoke(new Action(() => { Text = fn + " - mpv.net " + Application.ProductVersion; }));
var fp = Folder.AppDataRoaming + "mpv\\history.txt"; var fp = Folder.AppDataRoaming + "mpv\\history.txt";
if (File.Exists(fp)) if (LastHistory != fn && File.Exists(fp))
{
File.AppendAllText(fp, DateTime.Now.ToString() + " " + Path.GetFileNameWithoutExtension(fn) + BR); File.AppendAllText(fp, DateTime.Now.ToString() + " " + Path.GetFileNameWithoutExtension(fn) + BR);
LastHistory = fn;
}
} }
private void CM_Popup(object sender, EventArgs e) private void CM_Popup(object sender, EventArgs e)
@@ -253,7 +253,7 @@ namespace mpvnet
var p2 = PointToScreen(e.Location); var p2 = PointToScreen(e.Location);
if (Math.Abs(p1.X - p2.X) < 10 && Math.Abs(p1.Y - p2.Y) < 10) if (Math.Abs(p1.X - p2.X) < 10 && Math.Abs(p1.Y - p2.Y) < 10)
Close(); mpv.Command("quit");
} }
protected override void OnMouseMove(MouseEventArgs e) protected override void OnMouseMove(MouseEventArgs e)
@@ -293,5 +293,14 @@ namespace mpvnet
CursorHelp.Hide(); CursorHelp.Hide();
} }
} }
private void MainForm_Load(object sender, EventArgs ea)
{
mpv.Init();
mpv.ObserveBoolProp("fullscreen", MpvChangeFullscreen);
mpv.AfterShutdown += Mpv_AfterShutdown;
mpv.VideoSizeChanged += Mpv_VideoSizeChanged;
mpv.PlaybackRestart += mpv_PlaybackRestart;
}
} }
} }

View File

@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("mpv.net")] [assembly: AssemblyProduct("mpv.net")]
[assembly: AssemblyCopyright("Copyright © 2017 stax76")] [assembly: AssemblyCopyright("Copyright © 2019 stax76")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.2.0")] [assembly: AssemblyVersion("0.2.6.0")]
[assembly: AssemblyFileVersion("0.2.2.0")] [assembly: AssemblyFileVersion("0.2.6.0")]

View File

@@ -66,7 +66,7 @@ namespace mpvnet.Properties {
/// ///
///o script-message mpv.net open-files #menu: O; Open Files ///o script-message mpv.net open-files #menu: O; Open Files
/// ///
///Space pause #menu: Space ; Play/Pause ///Space cycle pause #menu: Space ; Play/Pause
///s stop #menu: S ; Stop ///s stop #menu: S ; Stop
/// ///
///F11 playlist-prev #menu: F11 ; Navigate | Previous ///F11 playlist-prev #menu: F11 ; Navigate | Previous

View File

@@ -12,7 +12,7 @@ namespace mpvnet.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@@ -1,3 +1,4 @@
#this file defines the shortcut keys and the context menu
#key command key caption menu path/caption #key command key caption menu path/caption
@@ -12,28 +13,28 @@ F12 playlist-next #menu: F12 ; Navigate | Next
Ctrl++ add video-zoom 0.1 #menu: Ctrl++ ; Pan && Scan | Increase Size Ctrl++ add video-zoom 0.1 #menu: Ctrl++ ; Pan && Scan | Increase Size
Ctrl+- add video-zoom -0.1 #menu: Ctrl+- ; Pan && Scan | Decrease Size Ctrl+- add video-zoom -0.1 #menu: Ctrl+- ; Pan && Scan | Decrease Size
Enter cycle fullscreen #menu: Enter ; Cycle Fullscreen Enter cycle pause #menu: Enter ; Cycle Fullscreen
KP7 cycle audio #menu: Numpad 7 ; Cycle Audio KP7 cycle audio #menu: Numpad 7 ; Cycle Audio
KP8 cycle sub #menu: Numpad 8 ; Cycle Subtitle KP8 cycle sub #menu: Numpad 8 ; Cycle Subtitle
+ add volume 5 #menu: + ; Volume | Up + add volume 10 #menu: + ; Volume | Up
- add volume -5 #menu: - ; Volume | Down - add volume -10 #menu: - ; Volume | Down
Axis_Up add volume 5 # wheel up Axis_Up add volume 10 #wheel up
Axis_Down add volume -5 # wheel down Axis_Down add volume -10 #wheel down
_ ignore #menu: _ ; Volume | - _ ignore #menu: _ ; Volume | -
m cycle mute #menu: M ; Volume | Mute m cycle mute #menu: M ; Volume | Mute
KP6 add audio-delay 0.100 #menu: Numpad 6 ; Audio | Delay +0.1 KP6 add audio-delay 0.100 #menu: Numpad 6 ; Audio | Delay +0.1
KP9 add audio-delay -0.100 #menu: Numpad 9 ; Audio | Delay -0.1 KP9 add audio-delay -0.100 #menu: Numpad 9 ; Audio | Delay -0.1
Right seek 5 #menu: Right ; Seek | 10 sec forward Right no-osd seek 7 #menu: Right ; Seek | 7 sec forward
Left seek -5 #menu: Left ; Seek | 10 sec backward Left no-osd seek -7 #menu: Left ; Seek | 7 sec backward
_ ignore #menu: _ ; Seek | - _ ignore #menu: _ ; Seek | -
Up seek 60 #menu: Up ; Seek | 1 min forward Up no-osd seek 40 #menu: Up ; Seek | 1 min forward
Down seek -60 #menu: Down ; Seek | 1 min backward Down no-osd seek -40 #menu: Down ; Seek | 1 min backward
_ ignore #menu: _ ; Seek | - _ ignore #menu: _ ; Seek | -
Ctrl+Right seek 300 #menu: Ctrl+Right ; Seek | 5 min forward Ctrl+Right no-osd seek 300 #menu: Ctrl+Right ; Seek | 5 min forward
Ctrl+Left seek -300 #menu: Ctrl+Left ; Seek | 5 min backward Ctrl+Left no-osd seek -300 #menu: Ctrl+Left ; Seek | 5 min backward
KP0 script-message rate-file 0 #menu: Numpad 0 ; Addons | Rating | 0stars KP0 script-message rate-file 0 #menu: Numpad 0 ; Addons | Rating | 0stars
KP1 script-message rate-file 1 #menu: Numpad 1 ; Addons | Rating | 1stars KP1 script-message rate-file 1 #menu: Numpad 1 ; Addons | Rating | 1stars
@@ -42,10 +43,17 @@ KP3 script-message rate-file 3 #menu: Numpad 3 ; Addons | Rating | 3stars
KP4 script-message rate-file 4 #menu: Numpad 4 ; Addons | Rating | 4stars KP4 script-message rate-file 4 #menu: Numpad 4 ; Addons | Rating | 4stars
KP5 script-message rate-file 5 #menu: Numpad 5 ; Addons | Rating | 5stars KP5 script-message rate-file 5 #menu: Numpad 5 ; Addons | Rating | 5stars
p script-message mpv.net show-prefs #menu: P ; Preferences _ script-message mpv.net set-setting hwdec yes #menu: _ ; Settings | Hardware Decoding | Enable Hardware Decoding
k script-message mpv.net show-keys #menu: K ; Keys _ script-message mpv.net set-setting hwdec no #menu: _ ; Settings | Hardware Decoding | Disable Hardware Decoding
p script-message mpv.net show-prefs #menu: P ; Settings | Show Preferences
k script-message mpv.net show-keys #menu: K ; Settings | Show Keys
i script-message mpv.net show-info #menu: I ; Tools | Info i script-message mpv.net show-info #menu: I ; Tools | Info
c script-message mpv.net open-config-folder #menu: _ ; Tools | Config Folder c script-message mpv.net open-config-folder #menu: _ ; Tools | Config Folder
h script-message mpv.net history #menu: H ; Tools | History h script-message mpv.net history #menu: H ; Tools | History
l ab-loop #menu: L ; Tools | AB Loop
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: _ ; Tools | mpv Manual
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: _ ; Tools | mpv Default Keys
Esc quit #menu: Escape ; Exit Esc quit #menu: Escape ; Exit
Q quit-watch-later #menu: Shift+Q; Exit Watch Later

View File

@@ -23,7 +23,6 @@ namespace mpvnet
public static event Action<string[]> ClientMessage; public static event Action<string[]> ClientMessage;
public static event Action Shutdown; public static event Action Shutdown;
public static event Action AfterShutdown; public static event Action AfterShutdown;
public static event Action FileLoaded;
public static event Action PlaybackRestart; public static event Action PlaybackRestart;
public static event Action VideoSizeChanged; public static event Action VideoSizeChanged;
@@ -33,8 +32,32 @@ namespace mpvnet
public static List<Action<bool>> BoolPropChangeActions = new List<Action<bool>>(); public static List<Action<bool>> BoolPropChangeActions = new List<Action<bool>>();
public static Size VideoSize = new Size(1920, 1080); public static Size VideoSize = new Size(1920, 1080);
public static string InputConfPath = Folder.AppDataRoaming + "mpv\\input.conf"; public static string InputConfPath = Folder.AppDataRoaming + "mpv\\input.conf";
public static string mpvConfPath = Folder.AppDataRoaming + "mpv\\mpv.conf";
public static StringPairList BindingList = new StringPairList(); public static StringPairList BindingList = new StringPairList();
private static Dictionary<string, string> _mpvConv;
public static Dictionary<string, string> mpvConv {
get {
if (_mpvConv == null)
{
_mpvConv = new Dictionary<string, string>();
if (File.Exists(mpvConfPath))
{
foreach (var i in File.ReadAllLines(mpvConfPath))
{
if (i.Contains("=") && ! i.StartsWith("#"))
{
_mpvConv[i.Left("=").Trim()] = i.Right("=").Trim();
}
}
}
}
return _mpvConv;
}
}
public static void Init() public static void Init()
{ {
LoadLibrary("mpv-1.dll"); LoadLibrary("mpv-1.dll");
@@ -42,14 +65,12 @@ namespace mpvnet
SetIntProp("input-ar-delay", 500); SetIntProp("input-ar-delay", 500);
SetIntProp("input-ar-rate", 20); SetIntProp("input-ar-rate", 20);
SetIntProp("volume", 50); SetIntProp("volume", 50);
SetStringProp("hwdec", "auto"); SetStringProp("hwdec", "yes");
SetStringProp("vo", "direct3d");
SetStringProp("input-default-bindings", "yes"); SetStringProp("input-default-bindings", "yes");
SetStringProp("opengl-backend", "angle");
SetStringProp("osd-playing-msg", "'${filename}'"); SetStringProp("osd-playing-msg", "'${filename}'");
SetStringProp("profile", "opengl-hq");
SetStringProp("screenshot-directory", "~~desktop/"); SetStringProp("screenshot-directory", "~~desktop/");
SetStringProp("vo", "opengl"); SetStringProp("keep-open", "yes");
SetStringProp("keep-open", "always");
SetStringProp("keep-open-pause", "no"); SetStringProp("keep-open-pause", "no");
SetStringProp("osc", "yes"); SetStringProp("osc", "yes");
SetStringProp("config", "yes"); SetStringProp("config", "yes");
@@ -79,13 +100,14 @@ namespace mpvnet
AfterShutdown?.Invoke(); AfterShutdown?.Invoke();
return; return;
case mpv_event_id.MPV_EVENT_FILE_LOADED: case mpv_event_id.MPV_EVENT_FILE_LOADED:
FileLoaded?.Invoke(); LoadFolder();
break; break;
case mpv_event_id.MPV_EVENT_PLAYBACK_RESTART: case mpv_event_id.MPV_EVENT_PLAYBACK_RESTART:
PlaybackRestart?.Invoke(); PlaybackRestart?.Invoke();
var s = new Size(GetIntProp("dwidth"), GetIntProp("dheight"));
if (VideoSize != s) Size s = new Size(GetIntProp("dwidth", false), GetIntProp("dheight", false));
if (VideoSize != s && s != Size.Empty)
{ {
VideoSize = s; VideoSize = s;
VideoSizeChanged?.Invoke(); VideoSizeChanged?.Invoke();
@@ -101,7 +123,14 @@ namespace mpvnet
if (args != null && args.Length > 1 && args[0] == "mpv.net") if (args != null && args.Length > 1 && args[0] == "mpv.net")
foreach (var i in mpvnet.Command.Commands) foreach (var i in mpvnet.Command.Commands)
if (args[1] == i.Name) if (args[1] == i.Name)
try
{
i.Action(args.Skip(2).ToArray()); i.Action(args.Skip(2).ToArray());
}
catch (Exception ex)
{
MsgError(ex.GetType().Name, ex.ToString());
}
ClientMessage?.Invoke(args); ClientMessage?.Invoke(args);
} }
@@ -160,12 +189,13 @@ namespace mpvnet
{ {
var lpBuffer = IntPtr.Zero; var lpBuffer = IntPtr.Zero;
int err = mpv_get_property(MpvHandle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_STRING, ref lpBuffer); int err = mpv_get_property(MpvHandle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_STRING, ref lpBuffer);
var ret = StringFromNativeUtf8(lpBuffer);
mpv_free(lpBuffer);
if (err < 0) if (err < 0)
throw new Exception($"{name}: {(mpv_error)err}"); throw new Exception($"{name}: {(mpv_error)err}");
var ret = StringFromNativeUtf8(lpBuffer);
mpv_free(lpBuffer);
return ret; return ret;
} }
@@ -231,8 +261,6 @@ namespace mpvnet
mpv.SetStringProp(i.Substring(2), "yes"); mpv.SetStringProp(i.Substring(2), "yes");
} }
} }
LoadFolder();
} }
public static void LoadFiles(string[] files) public static void LoadFiles(string[] files)
@@ -250,8 +278,13 @@ namespace mpvnet
mpv.LoadFolder(); mpv.LoadFolder();
} }
private static bool WasFolderLoaded;
public static void LoadFolder() public static void LoadFolder()
{ {
if (WasFolderLoaded)
return;
if (GetIntProp("playlist-count") == 1) if (GetIntProp("playlist-count") == 1)
{ {
string[] types = "264 265 3gp aac ac3 avc avi avs bmp divx dts dtshd dtshr dtsma eac3 evo flac flv h264 h265 hevc hvc jpg jpeg m2t m2ts m2v m4a m4v mka mkv mlp mov mp2 mp3 mp4 mpa mpeg mpg mpv mts ogg ogm opus pcm png pva raw rmvb thd thd+ac3 true-hd truehd ts vdr vob vpy w64 wav webm wmv y4m".Split(' '); string[] types = "264 265 3gp aac ac3 avc avi avs bmp divx dts dtshd dtshr dtsma eac3 evo flac flv h264 h265 hevc hvc jpg jpeg m2t m2ts m2v m4a m4v mka mkv mlp mov mp2 mp3 mp4 mpa mpeg mpg mpv mts ogg ogm opus pcm png pva raw rmvb thd thd+ac3 true-hd truehd ts vdr vob vpy w64 wav webm wmv y4m".Split(' ');
@@ -268,6 +301,8 @@ namespace mpvnet
if (index > 0) if (index > 0)
Command("playlist-move", "0", (index + 1).ToString()); Command("playlist-move", "0", (index + 1).ToString());
} }
WasFolderLoaded = true;
} }
public static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers) public static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)

View File

@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>mpvnet</RootNamespace> <RootNamespace>mpvnet</RootNamespace>
<AssemblyName>mpvnet</AssemblyName> <AssemblyName>mpvnet</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile /> <TargetFrameworkProfile />

View File

@@ -1,8 +1,8 @@
using namespace System.Diagnostics using namespace System.Diagnostics
$exePath = "D:\Projekte\VS\CS\mpvnet\mpvnet\bin\Debug\mpvnet.exe" $exePath = "C:\Users\frank\C-Daten\Projekte\VS\CS\mpvnet\mpvnet\bin\Debug\mpvnet.exe"
$version = [FileVersionInfo]::GetVersionInfo($exePath).FileVersion $version = [FileVersionInfo]::GetVersionInfo($exePath).FileVersion
$targetDir = "C:\Users\Frank\Desktop\mpv-net-" + $version $targetDir = "C:\Users\Frank\Desktop\mpv.net-" + $version
Copy-Item D:\Projekte\VS\CS\mpvnet\mpvnet\bin\Debug $targetDir -recurse Copy-Item C:\Users\frank\C-Daten\Projekte\VS\CS\mpvnet\mpvnet\bin\Debug $targetDir -recurse
$addonDir = $targetDir + "\Addons" $addonDir = $targetDir + "\Addons"
remove-item $addonDir -Recurse -Include *vbnet.pdb, *mpvnet.exe, *mpvnet.exe.config, *mpvnet.pdb, *vbnet.dll remove-item $addonDir -Recurse -Include *vbnet.pdb, *mpvnet.exe, *mpvnet.exe.config, *mpvnet.pdb, *vbnet.dll
D:\Projekte\VS\VB\util\bin\util.exe -pack $targetDir C:\Users\frank\C-Daten\Projekte\VS\VB\util\bin\util.exe -pack $targetDir

View File

@@ -254,14 +254,9 @@ Namespace UI
MyBase.New(container) MyBase.New(container)
End Sub End Sub
Protected Overrides Sub OnOpening(e As CancelEventArgs)
MyBase.OnOpening(e)
MenuHelp.SetRenderer(Me)
End Sub
Protected Overrides Sub OnHandleCreated(e As EventArgs) Protected Overrides Sub OnHandleCreated(e As EventArgs)
MyBase.OnHandleCreated(e) MyBase.OnHandleCreated(e)
Font = New Font("Segoe UI", 9) MenuHelp.SetRenderer(Me)
End Sub End Sub
<DefaultValue(GetType(Form), Nothing)> <DefaultValue(GetType(Form), Nothing)>

View File

@@ -15,7 +15,7 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase

View File

@@ -10,7 +10,7 @@
<AssemblyName>vbnet</AssemblyName> <AssemblyName>vbnet</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<MyType>Windows</MyType> <MyType>Windows</MyType>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">