This commit is contained in:
stax76
2017-10-04 06:08:59 +02:00
parent f5c7864771
commit 0cf38669a0
9 changed files with 36 additions and 30 deletions

View File

@@ -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

View File

@@ -42,4 +42,15 @@ class Script
mpv.Command("show-text", "fullscreen: " + val.ToString());
}
}
```
```
### 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

View File

@@ -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");

View File

@@ -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)

View File

@@ -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")]

View File

@@ -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

View File

@@ -1,3 +0,0 @@
### 0.2.1
- right-click in fullscreen in the right-left corner closes the app

View File

@@ -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);

View File

@@ -104,7 +104,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Addon.cs" />
<None Include="docs\changelog.md" />
<Compile Include="Extensions.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="libmpv.cs" />