diff --git a/CSScriptAddon/CSScriptAddon.vb b/CSScriptAddon/CSScriptAddon.vb index b84a813..c191cd6 100644 --- a/CSScriptAddon/CSScriptAddon.vb +++ b/CSScriptAddon/CSScriptAddon.vb @@ -1,20 +1,4 @@ -' mpv.net -' Copyright(C) 2017 stax76 -' -' This program Is free software: you can redistribute it And/Or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, Or -' (at your option) any later version. -' -' This program Is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE.See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If Not, see http://www.gnu.org/licenses/. - -Imports System.ComponentModel.Composition +Imports System.ComponentModel.Composition Imports System.IO Imports vbnet diff --git a/README.md b/README.md index 681a76f..98ec801 100644 --- a/README.md +++ b/README.md @@ -42,4 +42,15 @@ class Script mpv.Command("show-text", "fullscreen: " + val.ToString()); } } -``` \ No newline at end of file +``` + +### Changes + +### 0.2.2 + +- history feature added +- mpv lib updated + +### 0.2.1 + +- right-click in fullscreen in the right-left corner closes the app \ No newline at end of file diff --git a/mpvnet/Command.cs b/mpvnet/Command.cs index 4ac7f83..f8a81ba 100644 --- a/mpvnet/Command.cs +++ b/mpvnet/Command.cs @@ -82,6 +82,14 @@ namespace mpvnet ProcessHelp.Start(OS.GetTextEditor(), '"' + filepath + '"'); } + public static void history(string[] args) + { + 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) + File.WriteAllText(fp, ""); + } + public static void show_info(string[] args) { try @@ -94,7 +102,7 @@ namespace mpvnet var h = mi.GetInfo(StreamKind.Video, "Height"); var pos = TimeSpan.FromSeconds(mpv.GetIntProp("time-pos")); var dur = TimeSpan.FromSeconds(mpv.GetIntProp("duration")); - var br = Convert.ToInt32(mi.GetInfo(StreamKind.Video, "BitRate")) / 1000; + var br = Convert.ToInt32(mi.GetInfo(StreamKind.Video, "BitRate")) / 1000.0 / 1000.0; var vf = mpv.GetStringProp("video-format").ToUpper(); var fn = fi.Name; @@ -107,7 +115,7 @@ namespace mpvnet FormatTime(dur.TotalMinutes) + ":" + FormatTime(dur.Seconds) + "\n" + ((int)(fi.Length / 1024 / 1024)).ToString() + - $" MB - {w} x {h}\n{vf} - {br} Kbps" + "\n" + fn; + $" MB - {w} x {h}\n{vf} - {br.ToString("f1")} Mb/s" + "\n" + fn; mpv.Command("show-text", info, "5000"); diff --git a/mpvnet/MainForm.cs b/mpvnet/MainForm.cs index b7732df..04e157a 100644 --- a/mpvnet/MainForm.cs +++ b/mpvnet/MainForm.cs @@ -35,7 +35,7 @@ namespace mpvnet mpv.ObserveBoolProp("fullscreen", MpvChangeFullscreen); mpv.AfterShutdown += Mpv_AfterShutdown; mpv.VideoSizeChanged += Mpv_VideoSizeChanged; - mpv.PlaybackRestart += Mpv_PlaybackRestart; + mpv.PlaybackRestart += mpv_PlaybackRestart; ToolStripManager.Renderer = new ToolStripRendererEx(ToolStripRenderModeEx.SystemDefault); CMS = new ContextMenuStripEx(components); @@ -100,9 +100,14 @@ namespace mpvnet CursorHelp.Show(); } - private void Mpv_PlaybackRestart() + private void mpv_PlaybackRestart() { - BeginInvoke(new Action(() => Text = mpv.GetStringProp("filename") + " - mpv.net " + Application.ProductVersion)); + var fn = mpv.GetStringProp("filename"); + BeginInvoke(new Action(() => { Text = fn + " - mpv.net " + Application.ProductVersion; })); + var fp = Folder.AppDataRoaming + "mpv\\history.txt"; + + if (File.Exists(fp)) + File.AppendAllText(fp, DateTime.Now.ToString() + " " + Path.GetFileNameWithoutExtension(fn) + BR); } private void CM_Popup(object sender, EventArgs e) diff --git a/mpvnet/Properties/AssemblyInfo.cs b/mpvnet/Properties/AssemblyInfo.cs index 0919bad..6df6eb9 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.1.0")] -[assembly: AssemblyFileVersion("0.2.1.0")] +[assembly: AssemblyVersion("0.2.2.0")] +[assembly: AssemblyFileVersion("0.2.2.0")] diff --git a/mpvnet/Resources/input_conf.txt b/mpvnet/Resources/input_conf.txt index 28ca324..9aec956 100644 --- a/mpvnet/Resources/input_conf.txt +++ b/mpvnet/Resources/input_conf.txt @@ -47,4 +47,5 @@ k script-message mpv.net show-keys #menu: K ; 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 diff --git a/mpvnet/docs/changelog.md b/mpvnet/docs/changelog.md deleted file mode 100644 index 10942aa..0000000 --- a/mpvnet/docs/changelog.md +++ /dev/null @@ -1,3 +0,0 @@ -### 0.2.1 - -- right-click in fullscreen in the right-left corner closes the app \ No newline at end of file diff --git a/mpvnet/mpv.cs b/mpvnet/mpv.cs index e9f1d17..1068a94 100644 --- a/mpvnet/mpv.cs +++ b/mpvnet/mpv.cs @@ -12,6 +12,7 @@ using static mpvnet.Native; using vbnet; using static vbnet.UI.MainModule; +using System.Diagnostics; namespace mpvnet { @@ -66,7 +67,7 @@ namespace mpvnet { IntPtr ptr = mpv_wait_event(MpvHandle, -1); mpv_event evt = (mpv_event)Marshal.PtrToStructure(ptr, typeof(mpv_event)); - //Debug.WriteLine(evt.event_id); + Debug.WriteLine(evt.event_id); if (MpvWindowHandle == IntPtr.Zero) MpvWindowHandle = FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null); diff --git a/mpvnet/mpv.net.csproj b/mpvnet/mpv.net.csproj index f23f12d..ec582be 100644 --- a/mpvnet/mpv.net.csproj +++ b/mpvnet/mpv.net.csproj @@ -104,7 +104,6 @@ -