This commit is contained in:
stax76
2018-05-28 22:18:34 +02:00
parent 0cf38669a0
commit 5e3e734245
3 changed files with 29 additions and 13 deletions

View File

@@ -1,9 +1,11 @@
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;
using vbnet; using vbnet;
using vbnet.UI;
using static vbnet.UI.MainModule; using static vbnet.UI.MainModule;
namespace mpvnet namespace mpvnet
@@ -86,8 +88,11 @@ namespace mpvnet
{ {
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))
File.WriteAllText(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) public static void show_info(string[] args)
@@ -102,7 +107,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,8 +132,9 @@ namespace mpvnet
string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00"); string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00");
} }
} }
catch (Exception) catch (Exception ex)
{ {
MsgError(ex.GetType().Name, ex.ToString());
} }
} }
} }

View File

@@ -100,14 +100,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)

View File

@@ -26,14 +26,14 @@ 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 10 #menu: Right ; Seek | 10 sec forward
Left seek -5 #menu: Left ; Seek | 10 sec backward Left no-osd seek -10 #menu: Left ; Seek | 10 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