diff --git a/mpvnet/Command.cs b/mpvnet/Command.cs index f8a81ba..a5b012e 100644 --- a/mpvnet/Command.cs +++ b/mpvnet/Command.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Windows.Forms; using vbnet; +using vbnet.UI; using static vbnet.UI.MainModule; namespace mpvnet @@ -86,8 +88,11 @@ namespace mpvnet { 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, ""); + 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, ""); } public static void show_info(string[] args) @@ -102,7 +107,12 @@ 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.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 fn = fi.Name; @@ -122,8 +132,9 @@ namespace mpvnet string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00"); } } - catch (Exception) + catch (Exception ex) { + MsgError(ex.GetType().Name, ex.ToString()); } } } diff --git a/mpvnet/MainForm.cs b/mpvnet/MainForm.cs index 04e157a..aec7d95 100644 --- a/mpvnet/MainForm.cs +++ b/mpvnet/MainForm.cs @@ -100,14 +100,19 @@ namespace mpvnet CursorHelp.Show(); } + private string LastHistory; + private void mpv_PlaybackRestart() { 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)) + if (LastHistory != fn && File.Exists(fp)) + { File.AppendAllText(fp, DateTime.Now.ToString() + " " + Path.GetFileNameWithoutExtension(fn) + BR); + LastHistory = fn; + } } private void CM_Popup(object sender, EventArgs e) diff --git a/mpvnet/Resources/input_conf.txt b/mpvnet/Resources/input_conf.txt index 9aec956..10e7f70 100644 --- a/mpvnet/Resources/input_conf.txt +++ b/mpvnet/Resources/input_conf.txt @@ -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 seek 5 #menu: Right ; Seek | 10 sec forward -Left seek -5 #menu: Left ; Seek | 10 sec backward -_ ignore #menu: _ ; Seek | - -Up seek 60 #menu: Up ; Seek | 1 min forward -Down seek -60 #menu: Down ; Seek | 1 min backward -_ ignore #menu: _ ; Seek | - -Ctrl+Right seek 300 #menu: Ctrl+Right ; Seek | 5 min forward -Ctrl+Left 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