diff --git a/CSScriptAddon/CSScriptAddon.vbproj b/CSScriptAddon/CSScriptAddon.vbproj
index 7f5a970..656f309 100644
--- a/CSScriptAddon/CSScriptAddon.vbproj
+++ b/CSScriptAddon/CSScriptAddon.vbproj
@@ -10,7 +10,7 @@
CSScriptAddon
512
Windows
- v4.7
+ v4.7.2
diff --git a/CSScriptAddon/My Project/Settings.Designer.vb b/CSScriptAddon/My Project/Settings.Designer.vb
index 788fc48..73cf5cd 100644
--- a/CSScriptAddon/My Project/Settings.Designer.vb
+++ b/CSScriptAddon/My Project/Settings.Designer.vb
@@ -15,7 +15,7 @@ Option Explicit On
Namespace My
_
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
diff --git a/README.md b/README.md
index 98ec801..36cc52d 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,16 @@ class Script
### Changes
+### 0.2.3
+
+- 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
- history feature added
diff --git a/RatingAddon/Rating.csproj b/RatingAddon/Rating.csproj
index 739fcc5..b60df57 100644
--- a/RatingAddon/Rating.csproj
+++ b/RatingAddon/Rating.csproj
@@ -9,7 +9,7 @@
Properties
Rating
RatingAddon
- v4.7
+ v4.7.2
512
diff --git a/mpvnet/App.config b/mpvnet/App.config
index 9d2c7ad..ecdcf8a 100644
--- a/mpvnet/App.config
+++ b/mpvnet/App.config
@@ -1,6 +1,6 @@
-
+
diff --git a/mpvnet/Command.cs b/mpvnet/Command.cs
index a5b012e..60ead9f 100644
--- a/mpvnet/Command.cs
+++ b/mpvnet/Command.cs
@@ -5,7 +5,6 @@ using System.IO;
using System.Windows.Forms;
using vbnet;
-using vbnet.UI;
using static vbnet.UI.MainModule;
namespace mpvnet
@@ -67,21 +66,23 @@ namespace mpvnet
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(filepath))
+ if (!File.Exists(mpv.mpvConfPath))
{
var dirPath = Folder.AppDataRoaming + "mpv\\";
if (!Directory.Exists(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)
@@ -95,46 +96,74 @@ namespace mpvnet
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++)
{
- var fi = new FileInfo(mpv.GetStringProp("path"));
-
- using (var mi = new MediaInfo(fi.FullName))
+ if (confLines[i].Left("=").Trim() == args[0])
{
- var w = mi.GetInfo(StreamKind.Video, "Width");
- var h = mi.GetInfo(StreamKind.Video, "Height");
- var pos = TimeSpan.FromSeconds(mpv.GetIntProp("time-pos"));
- var dur = TimeSpan.FromSeconds(mpv.GetIntProp("duration"));
- 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 fn = fi.Name;
-
- if (fn.Length > 60)
- fn = fn.Insert(59, BR);
-
- var info =
- FormatTime(pos.TotalMinutes) + ":" +
- FormatTime(pos.Seconds) + " / " +
- FormatTime(dur.TotalMinutes) + ":" +
- FormatTime(dur.Seconds) + "\n" +
- ((int)(fi.Length / 1024 / 1024)).ToString() +
- $" MB - {w} x {h}\n{vf} - {br.ToString("f1")} Mb/s" + "\n" + fn;
-
- mpv.Command("show-text", info, "5000");
-
- string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00");
+ confLines[i] = args[0] + "=" + args[1];
+ changed = true;
}
}
- catch (Exception ex)
+
+ if (changed)
{
- MsgError(ex.GetType().Name, ex.ToString());
+ 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"));
+
+ using (var mi = new MediaInfo(fi.FullName))
+ {
+ var w = mi.GetInfo(StreamKind.Video, "Width");
+ var h = mi.GetInfo(StreamKind.Video, "Height");
+ var pos = TimeSpan.FromSeconds(mpv.GetIntProp("time-pos"));
+ var dur = TimeSpan.FromSeconds(mpv.GetIntProp("duration"));
+ 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 fn = fi.Name;
+
+ if (fn.Length > 60)
+ fn = fn.Insert(59, BR);
+
+ var info =
+ FormatTime(pos.TotalMinutes) + ":" +
+ FormatTime(pos.Seconds) + " / " +
+ FormatTime(dur.TotalMinutes) + ":" +
+ FormatTime(dur.Seconds) + "\n" +
+ ((int)(fi.Length / 1024 / 1024)).ToString() +
+ $" MB - {w} x {h}\n{vf} - {br.ToString("f1")} Mb/s" + "\n" + fn;
+
+ mpv.Command("show-text", info, "5000");
+
+ string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00");
}
}
}
diff --git a/mpvnet/MainForm.cs b/mpvnet/MainForm.cs
index aec7d95..d427432 100644
--- a/mpvnet/MainForm.cs
+++ b/mpvnet/MainForm.cs
@@ -258,7 +258,7 @@ namespace mpvnet
var p2 = PointToScreen(e.Location);
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)
diff --git a/mpvnet/Properties/AssemblyInfo.cs b/mpvnet/Properties/AssemblyInfo.cs
index 6df6eb9..a3af9e9 100644
--- a/mpvnet/Properties/AssemblyInfo.cs
+++ b/mpvnet/Properties/AssemblyInfo.cs
@@ -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("0.2.2.0")]
-[assembly: AssemblyFileVersion("0.2.2.0")]
+[assembly: AssemblyVersion("0.2.3.0")]
+[assembly: AssemblyFileVersion("0.2.3.0")]
diff --git a/mpvnet/Properties/Resources.Designer.cs b/mpvnet/Properties/Resources.Designer.cs
index 44dbbf2..47b99f7 100644
--- a/mpvnet/Properties/Resources.Designer.cs
+++ b/mpvnet/Properties/Resources.Designer.cs
@@ -66,7 +66,7 @@ namespace mpvnet.Properties {
///
///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
///
///F11 playlist-prev #menu: F11 ; Navigate | Previous
diff --git a/mpvnet/Properties/Settings.Designer.cs b/mpvnet/Properties/Settings.Designer.cs
index 95000f6..be1953b 100644
--- a/mpvnet/Properties/Settings.Designer.cs
+++ b/mpvnet/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace mpvnet.Properties {
[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 {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/mpvnet/Resources/input_conf.txt b/mpvnet/Resources/input_conf.txt
index 10e7f70..0e1daf1 100644
--- a/mpvnet/Resources/input_conf.txt
+++ b/mpvnet/Resources/input_conf.txt
@@ -1,7 +1,7 @@
#key command key caption menu path/caption
-o script-message mpv.net open-files #menu: O; Open Files
+o script-message mpv.net open-files #menu: O; Open Files
Space cycle pause #menu: Space ; Play/Pause
s stop #menu: S ; Stop
@@ -26,14 +26,14 @@ m cycle mute #menu: M ; Volume | Mute
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
-Right no-osd seek 10 #menu: Right ; Seek | 10 sec forward
-Left no-osd seek -10 #menu: Left ; Seek | 10 sec backward
-_ ignore #menu: _ ; Seek | -
-Up no-osd seek 40 #menu: Up ; Seek | 1 min forward
-Down no-osd seek -40 #menu: Down ; Seek | 1 min backward
-_ ignore #menu: _ ; Seek | -
-Ctrl+Right no-osd seek 300 #menu: Ctrl+Right ; Seek | 5 min forward
-Ctrl+Left no-osd seek -300 #menu: Ctrl+Left ; Seek | 5 min backward
+Right no-osd seek 10 #menu: Right ; Seek | 10 sec forward
+Left no-osd seek -10 #menu: Left ; Seek | 10 sec backward
+_ ignore #menu: _ ; Seek | -
+Up no-osd seek 40 #menu: Up ; Seek | 1 min forward
+Down no-osd seek -40 #menu: Down ; Seek | 1 min backward
+_ ignore #menu: _ ; Seek | -
+Ctrl+Right no-osd seek 300 #menu: Ctrl+Right ; Seek | 5 min forward
+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
KP1 script-message rate-file 1 #menu: Numpad 1 ; Addons | Rating | 1stars
@@ -42,10 +42,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
KP5 script-message rate-file 5 #menu: Numpad 5 ; Addons | Rating | 5stars
-p script-message mpv.net show-prefs #menu: P ; Preferences
-k script-message mpv.net show-keys #menu: K ; Keys
+_ script-message mpv.net set-setting hwdec yes #menu: _ ; Settings | Hardware Decoding | Enable Hardware Decoding
+_ 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
c script-message mpv.net open-config-folder #menu: _ ; Tools | Config Folder
h script-message mpv.net history #menu: H ; Tools | History
-Esc quit #menu: Escape ; Exit
\ No newline at end of file
+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
+Q quit-watch-later #menu: Shift+Q; Exit Watch Later
\ No newline at end of file
diff --git a/mpvnet/mpv.cs b/mpvnet/mpv.cs
index 1068a94..a854f2b 100644
--- a/mpvnet/mpv.cs
+++ b/mpvnet/mpv.cs
@@ -23,7 +23,6 @@ namespace mpvnet
public static event Action ClientMessage;
public static event Action Shutdown;
public static event Action AfterShutdown;
- public static event Action FileLoaded;
public static event Action PlaybackRestart;
public static event Action VideoSizeChanged;
@@ -33,6 +32,7 @@ namespace mpvnet
public static List> BoolPropChangeActions = new List>();
public static Size VideoSize = new Size(1920, 1080);
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 void Init()
@@ -79,13 +79,14 @@ namespace mpvnet
AfterShutdown?.Invoke();
return;
case mpv_event_id.MPV_EVENT_FILE_LOADED:
- FileLoaded?.Invoke();
+ LoadFolder();
break;
case mpv_event_id.MPV_EVENT_PLAYBACK_RESTART:
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;
VideoSizeChanged?.Invoke();
@@ -101,7 +102,14 @@ namespace mpvnet
if (args != null && args.Length > 1 && args[0] == "mpv.net")
foreach (var i in mpvnet.Command.Commands)
if (args[1] == i.Name)
- i.Action(args.Skip(2).ToArray());
+ try
+ {
+ i.Action(args.Skip(2).ToArray());
+ }
+ catch (Exception ex)
+ {
+ MsgError(ex.GetType().Name, ex.ToString());
+ }
ClientMessage?.Invoke(args);
}
@@ -160,12 +168,13 @@ namespace mpvnet
{
var lpBuffer = IntPtr.Zero;
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)
throw new Exception($"{name}: {(mpv_error)err}");
+ var ret = StringFromNativeUtf8(lpBuffer);
+ mpv_free(lpBuffer);
+
return ret;
}
@@ -231,8 +240,6 @@ namespace mpvnet
mpv.SetStringProp(i.Substring(2), "yes");
}
}
-
- LoadFolder();
}
public static void LoadFiles(string[] files)
@@ -250,8 +257,13 @@ namespace mpvnet
mpv.LoadFolder();
}
+ private static bool WasFolderLoaded;
+
public static void LoadFolder()
{
+ if (WasFolderLoaded)
+ return;
+
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(' ');
@@ -268,6 +280,8 @@ namespace mpvnet
if (index > 0)
Command("playlist-move", "0", (index + 1).ToString());
}
+
+ WasFolderLoaded = true;
}
public static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
diff --git a/mpvnet/mpv.net.csproj b/mpvnet/mpv.net.csproj
index ec582be..871a6ff 100644
--- a/mpvnet/mpv.net.csproj
+++ b/mpvnet/mpv.net.csproj
@@ -9,7 +9,7 @@
Properties
mpvnet
mpvnet
- v4.7
+ v4.7.2
512
true
diff --git a/vbnet/My Project/Settings.Designer.vb b/vbnet/My Project/Settings.Designer.vb
index 4aaa63e..663aa6c 100644
--- a/vbnet/My Project/Settings.Designer.vb
+++ b/vbnet/My Project/Settings.Designer.vb
@@ -15,7 +15,7 @@ Option Explicit On
Namespace My
_
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
diff --git a/vbnet/vbnet.vbproj b/vbnet/vbnet.vbproj
index ff99d80..29f2677 100644
--- a/vbnet/vbnet.vbproj
+++ b/vbnet/vbnet.vbproj
@@ -10,7 +10,7 @@
vbnet
512
Windows
- v4.7
+ v4.7.2