Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cf38669a0 | ||
|
|
f5c7864771 | ||
|
|
3c12d8a7da | ||
|
|
0b6f12198b | ||
|
|
215718dd63 | ||
|
|
1bbaae873a |
@@ -1,20 +1,4 @@
|
|||||||
' mpv.net
|
Imports System.ComponentModel.Composition
|
||||||
' 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.IO
|
Imports System.IO
|
||||||
|
|
||||||
Imports vbnet
|
Imports vbnet
|
||||||
@@ -29,12 +13,11 @@ Public Class CSScriptAddon
|
|||||||
Sub New()
|
Sub New()
|
||||||
Dim scriptDir = Folder.AppDataRoaming + "mpv\scripts"
|
Dim scriptDir = Folder.AppDataRoaming + "mpv\scripts"
|
||||||
If Not Directory.Exists(scriptDir) Then Return
|
If Not Directory.Exists(scriptDir) Then Return
|
||||||
Dim csxFiles = Directory.GetFiles(scriptDir, "*.cs")
|
Dim csFiles = Directory.GetFiles(scriptDir, "*.cs")
|
||||||
If csxFiles.Count = 0 Then Return
|
If csFiles.Count = 0 Then Return
|
||||||
CSScriptLibrary.CSScript.EvaluatorConfig.Engine = EvaluatorEngine.CodeDom
|
CSScriptLibrary.CSScript.EvaluatorConfig.Engine = EvaluatorEngine.CodeDom
|
||||||
CSScriptLibrary.CSScript.Evaluator.ReferenceDomainAssemblies()
|
|
||||||
|
|
||||||
For Each i In csxFiles
|
For Each i In csFiles
|
||||||
Try
|
Try
|
||||||
CSScriptLibrary.CSScript.Evaluator.LoadCode(File.ReadAllText(i))
|
CSScriptLibrary.CSScript.Evaluator.LoadCode(File.ReadAllText(i))
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
|
|||||||
@@ -55,11 +55,11 @@
|
|||||||
<Reference Include="mpvnet, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="mpvnet, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\mpvnet\bin\Debug\mpvnet.exe</HintPath>
|
<HintPath>..\mpvnet\bin\Debug\mpvnet.exe</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.Composition" />
|
<Reference Include="System.ComponentModel.Composition" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Management" />
|
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@@ -67,6 +67,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="vbnet">
|
<Reference Include="vbnet">
|
||||||
<HintPath>..\vbnet\bin\Debug\vbnet.dll</HintPath>
|
<HintPath>..\vbnet\bin\Debug\vbnet.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -13,6 +13,14 @@ https://mpv.io/manual/master/
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
### Context Menu
|
||||||
|
|
||||||
|
The context menu can be customized via input.conf file located at:
|
||||||
|
|
||||||
|
C:\Users\Frank\AppData\Roaming\mpv\input.conf
|
||||||
|
|
||||||
|
https://github.com/stax76/mpvnet/blob/master/mpvnet/Resources/input_conf.txt
|
||||||
|
|
||||||
### C# Scripting
|
### C# Scripting
|
||||||
|
|
||||||
A simple C# script located at: C:\Users\Frank\AppData\Roaming\mpv\scripts\test.cs
|
A simple C# script located at: C:\Users\Frank\AppData\Roaming\mpv\scripts\test.cs
|
||||||
@@ -36,10 +44,13 @@ class Script
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Context Menu
|
### Changes
|
||||||
|
|
||||||
The context menu can be customized via input.conf file located at:
|
### 0.2.2
|
||||||
|
|
||||||
C:\Users\Frank\AppData\Roaming\mpv\input.conf
|
- history feature added
|
||||||
|
- mpv lib updated
|
||||||
|
|
||||||
https://github.com/stax76/mpvnet/blob/master/mpvnet/Resources/input_conf.txt
|
### 0.2.1
|
||||||
|
|
||||||
|
- right-click in fullscreen in the right-left corner closes the app
|
||||||
@@ -1,22 +1,4 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="mpvnet">
|
<Reference Include="mpvnet">
|
||||||
<HintPath>..\mpvnet\bin\Debug\mpvnet.exe</HintPath>
|
<HintPath>..\mpvnet\bin\Debug\mpvnet.exe</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.Composition" />
|
<Reference Include="System.ComponentModel.Composition" />
|
||||||
|
|||||||
31
Scripts/seek-show-position.js
Normal file
31
Scripts/seek-show-position.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// when seeking displays position and
|
||||||
|
// duration like so: 00:00 / 120:00
|
||||||
|
// this is different from MPC which
|
||||||
|
// uses 00:00:00 / 02:00:00
|
||||||
|
|
||||||
|
function add_zero(val)
|
||||||
|
{
|
||||||
|
val = Math.round(val);
|
||||||
|
return val > 9 ? "" + val : "0" + val;
|
||||||
|
}
|
||||||
|
|
||||||
|
function format(val)
|
||||||
|
{
|
||||||
|
var sec = Math.round(val);
|
||||||
|
|
||||||
|
if (sec < 0)
|
||||||
|
sec = 0;
|
||||||
|
|
||||||
|
pos_min_floor = Math.floor(sec / 60);
|
||||||
|
sec_rest = sec - pos_min_floor * 60;
|
||||||
|
return add_zero(pos_min_floor) + ":" + add_zero(sec_rest);
|
||||||
|
}
|
||||||
|
|
||||||
|
function on_seek(_)
|
||||||
|
{
|
||||||
|
mp.commandv("show-text",
|
||||||
|
format(mp.get_property_number("time-pos")) + " / " +
|
||||||
|
format(mp.get_property_number("duration")));
|
||||||
|
}
|
||||||
|
|
||||||
|
mp.register_event("seek", on_seek);
|
||||||
@@ -1,28 +1,10 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using vbnet;
|
using vbnet;
|
||||||
|
using static vbnet.UI.MainModule;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -99,5 +81,50 @@ namespace mpvnet
|
|||||||
|
|
||||||
ProcessHelp.Start(OS.GetTextEditor(), '"' + filepath + '"');
|
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
|
||||||
|
{
|
||||||
|
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"));
|
||||||
|
var br = Convert.ToInt32(mi.GetInfo(StreamKind.Video, "BitRate")) / 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,8 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using vbnet;
|
using vbnet;
|
||||||
@@ -48,13 +28,14 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
Application.ThreadException += Application_ThreadException;
|
Application.ThreadException += Application_ThreadException;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
SetFormPosSize();
|
||||||
Instance = this;
|
Instance = this;
|
||||||
Hwnd = Handle;
|
Hwnd = Handle;
|
||||||
mpv.Init();
|
mpv.Init();
|
||||||
mpv.ObserveBoolProp("fullscreen", MpvChangeFullscreen);
|
mpv.ObserveBoolProp("fullscreen", MpvChangeFullscreen);
|
||||||
mpv.AfterShutdown += Mpv_AfterShutdown;
|
mpv.AfterShutdown += Mpv_AfterShutdown;
|
||||||
mpv.VideoSizeChanged += Mpv_VideoSizeChanged;
|
mpv.VideoSizeChanged += Mpv_VideoSizeChanged;
|
||||||
mpv.PlaybackRestart += Mpv_PlaybackRestart;
|
mpv.PlaybackRestart += mpv_PlaybackRestart;
|
||||||
|
|
||||||
ToolStripManager.Renderer = new ToolStripRendererEx(ToolStripRenderModeEx.SystemDefault);
|
ToolStripManager.Renderer = new ToolStripRendererEx(ToolStripRenderModeEx.SystemDefault);
|
||||||
CMS = new ContextMenuStripEx(components);
|
CMS = new ContextMenuStripEx(components);
|
||||||
@@ -101,7 +82,7 @@ namespace mpvnet
|
|||||||
var menuItem = CMS.Add(path, () => {
|
var menuItem = CMS.Add(path, () => {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mpv.CommandString(cmd);
|
mpv.CommandString(cmd, false);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -119,9 +100,14 @@ namespace mpvnet
|
|||||||
CursorHelp.Show();
|
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)
|
private void CM_Popup(object sender, EventArgs e)
|
||||||
@@ -139,12 +125,6 @@ namespace mpvnet
|
|||||||
MsgException(e);
|
MsgException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void About()
|
|
||||||
{
|
|
||||||
mpv.Command("show-text", Application.ProductName + " v" + Application.ProductVersion.ToString() +
|
|
||||||
"\nCopyright (c) 2017 stax76\nGPL License", "5000");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Mpv_VideoSizeChanged()
|
private void Mpv_VideoSizeChanged()
|
||||||
{
|
{
|
||||||
BeginInvoke(new Action(() => SetFormPosSize()));
|
BeginInvoke(new Action(() => SetFormPosSize()));
|
||||||
@@ -267,6 +247,13 @@ namespace mpvnet
|
|||||||
Native.ReleaseCapture();
|
Native.ReleaseCapture();
|
||||||
Native.PostMessage(Handle, 0xA1 /* WM_NCLBUTTONDOWN */, HTCAPTION, IntPtr.Zero);
|
Native.PostMessage(Handle, 0xA1 /* WM_NCLBUTTONDOWN */, HTCAPTION, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sb = Screen.FromControl(this).Bounds;
|
||||||
|
var p1 = new Point(sb.Width, 0);
|
||||||
|
var p2 = PointToScreen(e.Location);
|
||||||
|
|
||||||
|
if (Math.Abs(p1.X - p2.X) < 10 && Math.Abs(p1.Y - p2.Y) < 10)
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseMove(MouseEventArgs e)
|
protected override void OnMouseMove(MouseEventArgs e)
|
||||||
|
|||||||
@@ -1,22 +1,4 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,4 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,22 +1,4 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.2.0.0")]
|
[assembly: AssemblyVersion("0.2.2.0")]
|
||||||
[assembly: AssemblyFileVersion("0.2.0.0")]
|
[assembly: AssemblyFileVersion("0.2.2.0")]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
o script-message mpv.net open-files #menu: O; Open Files
|
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
|
s stop #menu: S ; Stop
|
||||||
|
|
||||||
F11 playlist-prev #menu: F11 ; Navigate | Previous
|
F11 playlist-prev #menu: F11 ; Navigate | Previous
|
||||||
@@ -20,18 +20,18 @@ KP8 cycle sub #menu: Numpad 8 ; Cycle Subtitle
|
|||||||
- add volume -5 #menu: - ; Volume | Down
|
- add volume -5 #menu: - ; Volume | Down
|
||||||
Axis_Up add volume 5 # wheel up
|
Axis_Up add volume 5 # wheel up
|
||||||
Axis_Down add volume -5 # wheel down
|
Axis_Down add volume -5 # wheel down
|
||||||
_ _ #menu: _ ; Volume | -
|
_ ignore #menu: _ ; Volume | -
|
||||||
m mute #menu: M ; Volume | Mute
|
m cycle mute #menu: M ; Volume | Mute
|
||||||
|
|
||||||
Alt++ add audio-delay 0.1 #menu: Alt++ ; Audio | Delay +0.1
|
KP6 add audio-delay 0.100 #menu: Numpad 6 ; Audio | Delay +0.1
|
||||||
Alt+- add audio-delay -0.1 #menu: Alt+- ; Audio | Delay -0.1
|
KP9 add audio-delay -0.100 #menu: Numpad 9 ; Audio | Delay -0.1
|
||||||
|
|
||||||
Right seek 10 #menu: Right ; Seek | 10 sec forward
|
Right seek 5 #menu: Right ; Seek | 10 sec forward
|
||||||
Left seek -10 #menu: Left ; Seek | 10 sec backward
|
Left seek -5 #menu: Left ; Seek | 10 sec backward
|
||||||
_ _ #menu: _ ; Seek | -
|
_ ignore #menu: _ ; Seek | -
|
||||||
Up seek 60 #menu: Up ; Seek | 1 min forward
|
Up seek 60 #menu: Up ; Seek | 1 min forward
|
||||||
Down seek -60 #menu: Down ; Seek | 1 min backward
|
Down seek -60 #menu: Down ; Seek | 1 min backward
|
||||||
_ _ #menu: _ ; Seek | -
|
_ ignore #menu: _ ; Seek | -
|
||||||
Ctrl+Right seek 300 #menu: Ctrl+Right ; Seek | 5 min forward
|
Ctrl+Right seek 300 #menu: Ctrl+Right ; Seek | 5 min forward
|
||||||
Ctrl+Left seek -300 #menu: Ctrl+Left ; Seek | 5 min backward
|
Ctrl+Left seek -300 #menu: Ctrl+Left ; Seek | 5 min backward
|
||||||
|
|
||||||
@@ -45,5 +45,7 @@ KP5 script-message rate-file 5 #menu: Numpad 5 ; Addons | Rating | 5stars
|
|||||||
p script-message mpv.net show-prefs #menu: P ; Preferences
|
p script-message mpv.net show-prefs #menu: P ; Preferences
|
||||||
k script-message mpv.net show-keys #menu: K ; Keys
|
k script-message mpv.net show-keys #menu: K ; Keys
|
||||||
|
|
||||||
F8 script-message mpv.net open-config-folder #menu: _ ; Tools | Config Folder
|
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
|
Esc quit #menu: Escape ; Exit
|
||||||
@@ -1,32 +1,6 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
public static class StringExtensions
|
public static class StringExtensions
|
||||||
{
|
{
|
||||||
|
|||||||
20
mpvnet/UI.cs
20
mpvnet/UI.cs
@@ -1,22 +1,4 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,4 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
|
|||||||
@@ -1,23 +1,4 @@
|
|||||||
/**
|
using System;
|
||||||
*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/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -31,6 +12,7 @@ using static mpvnet.Native;
|
|||||||
|
|
||||||
using vbnet;
|
using vbnet;
|
||||||
using static vbnet.UI.MainModule;
|
using static vbnet.UI.MainModule;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace mpvnet
|
namespace mpvnet
|
||||||
{
|
{
|
||||||
@@ -49,7 +31,7 @@ namespace mpvnet
|
|||||||
public static IntPtr MpvWindowHandle;
|
public static IntPtr MpvWindowHandle;
|
||||||
public static Addon Addon;
|
public static Addon Addon;
|
||||||
public static List<Action<bool>> BoolPropChangeActions = new List<Action<bool>>();
|
public static List<Action<bool>> BoolPropChangeActions = new List<Action<bool>>();
|
||||||
public static Size VideoSize;
|
public static Size VideoSize = new Size(1920, 1080);
|
||||||
public static string InputConfPath = Folder.AppDataRoaming + "mpv\\input.conf";
|
public static string InputConfPath = Folder.AppDataRoaming + "mpv\\input.conf";
|
||||||
public static StringPairList BindingList = new StringPairList();
|
public static StringPairList BindingList = new StringPairList();
|
||||||
|
|
||||||
@@ -154,14 +136,14 @@ namespace mpvnet
|
|||||||
Marshal.FreeHGlobal(mainPtr);
|
Marshal.FreeHGlobal(mainPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CommandString(string command)
|
public static void CommandString(string command, bool throwException = true)
|
||||||
{
|
{
|
||||||
if (MpvHandle == IntPtr.Zero)
|
if (MpvHandle == IntPtr.Zero)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int err = mpv_command_string(MpvHandle, command);
|
int err = mpv_command_string(MpvHandle, command);
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0 && throwException)
|
||||||
throw new Exception($"{(mpv_error)err}" + BR2 + command);
|
throw new Exception($"{(mpv_error)err}" + BR2 + command);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,12 +169,12 @@ namespace mpvnet
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetIntProp(string name)
|
public static int GetIntProp(string name, bool throwException = true)
|
||||||
{
|
{
|
||||||
var lpBuffer = IntPtr.Zero;
|
var lpBuffer = IntPtr.Zero;
|
||||||
int err = mpv_get_property(MpvHandle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_INT64, ref lpBuffer);
|
int err = mpv_get_property(MpvHandle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_INT64, ref lpBuffer);
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0 && throwException)
|
||||||
throw new Exception($"{name}: {(mpv_error)err}");
|
throw new Exception($"{name}: {(mpv_error)err}");
|
||||||
else
|
else
|
||||||
return lpBuffer.ToInt32();
|
return lpBuffer.ToInt32();
|
||||||
|
|||||||
8
release_mpvnet.ps1
Normal file
8
release_mpvnet.ps1
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using namespace System.Diagnostics
|
||||||
|
$exePath = "D:\Projekte\VS\CS\mpvnet\mpvnet\bin\Debug\mpvnet.exe"
|
||||||
|
$version = [FileVersionInfo]::GetVersionInfo($exePath).FileVersion
|
||||||
|
$targetDir = "C:\Users\Frank\Desktop\mpv-net-" + $version
|
||||||
|
Copy-Item D:\Projekte\VS\CS\mpvnet\mpvnet\bin\Debug $targetDir -recurse
|
||||||
|
$addonDir = $targetDir + "\Addons"
|
||||||
|
remove-item $addonDir -Recurse -Include *vbnet.pdb, *mpvnet.exe, *mpvnet.exe.config, *mpvnet.pdb, *vbnet.dll
|
||||||
|
D:\Projekte\VS\VB\util\bin\util.exe -pack $targetDir
|
||||||
93
vbnet/MediaInfo.vb
Normal file
93
vbnet/MediaInfo.vb
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
Imports System.Runtime.InteropServices
|
||||||
|
|
||||||
|
Public Class MediaInfo
|
||||||
|
Implements IDisposable
|
||||||
|
|
||||||
|
Private Handle As IntPtr
|
||||||
|
Shared Loaded As Boolean
|
||||||
|
|
||||||
|
Sub New(sourcepath As String)
|
||||||
|
If Not Loaded Then
|
||||||
|
If LoadLibrary("MediaInfo.dll") = IntPtr.Zero Then Throw New Exception("Failed to load MediaInfo.dll.")
|
||||||
|
Loaded = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
Handle = MediaInfo_New()
|
||||||
|
MediaInfo_Open(Handle, sourcepath)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Function GetInfo(streamKind As StreamKind, parameter As String) As String
|
||||||
|
Return Marshal.PtrToStringUni(MediaInfo_Get(Handle, streamKind, 0, parameter, InfoKind.Text, InfoKind.Name))
|
||||||
|
End Function
|
||||||
|
|
||||||
|
#Region "IDisposable"
|
||||||
|
|
||||||
|
Private Disposed As Boolean
|
||||||
|
|
||||||
|
Sub Dispose() Implements IDisposable.Dispose
|
||||||
|
If Not Disposed Then
|
||||||
|
Disposed = True
|
||||||
|
MediaInfo_Close(Handle)
|
||||||
|
MediaInfo_Delete(Handle)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Overrides Sub Finalize()
|
||||||
|
Dispose()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
#Region "native"
|
||||||
|
|
||||||
|
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
||||||
|
Private Shared Function LoadLibrary(path As String) As IntPtr
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<DllImport("MediaInfo.dll")>
|
||||||
|
Private Shared Function MediaInfo_New() As IntPtr
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<DllImport("MediaInfo.dll")>
|
||||||
|
Private Shared Sub MediaInfo_Delete(Handle As IntPtr)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
<DllImport("MediaInfo.dll", CharSet:=CharSet.Unicode)>
|
||||||
|
Private Shared Function MediaInfo_Open(Handle As IntPtr, FileName As String) As Integer
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<DllImport("MediaInfo.dll")>
|
||||||
|
Private Shared Function MediaInfo_Close(Handle As IntPtr) As Integer
|
||||||
|
End Function
|
||||||
|
|
||||||
|
<DllImport("MediaInfo.dll", CharSet:=CharSet.Unicode)>
|
||||||
|
Private Shared Function MediaInfo_Get(Handle As IntPtr,
|
||||||
|
StreamKind As StreamKind,
|
||||||
|
StreamNumber As Integer, Parameter As String,
|
||||||
|
KindOfInfo As InfoKind,
|
||||||
|
KindOfSearch As InfoKind) As IntPtr
|
||||||
|
End Function
|
||||||
|
|
||||||
|
#End Region
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Public Enum StreamKind
|
||||||
|
General
|
||||||
|
Video
|
||||||
|
Audio
|
||||||
|
Text
|
||||||
|
Chapters
|
||||||
|
Image
|
||||||
|
End Enum
|
||||||
|
|
||||||
|
Public Enum InfoKind
|
||||||
|
Name
|
||||||
|
Text
|
||||||
|
Measure
|
||||||
|
Options
|
||||||
|
NameText
|
||||||
|
MeasureText
|
||||||
|
Info
|
||||||
|
HowTo
|
||||||
|
End Enum
|
||||||
@@ -75,6 +75,7 @@
|
|||||||
<Compile Include="Extensions.vb" />
|
<Compile Include="Extensions.vb" />
|
||||||
<Compile Include="HSLColor.vb" />
|
<Compile Include="HSLColor.vb" />
|
||||||
<Compile Include="MainModule.vb" />
|
<Compile Include="MainModule.vb" />
|
||||||
|
<Compile Include="MediaInfo.vb" />
|
||||||
<Compile Include="Menu.vb">
|
<Compile Include="Menu.vb">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Reference in New Issue
Block a user