Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6022809080 | ||
|
|
714eb7c9fa | ||
|
|
0f68c0cd3e | ||
|
|
ea8de8bd5a | ||
|
|
e31284171c | ||
|
|
f115a5cf3a | ||
|
|
5e3e734245 |
@@ -10,7 +10,7 @@
|
||||
<AssemblyName>CSScriptAddon</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
||||
2
CSScriptAddon/My Project/Settings.Designer.vb
generated
2
CSScriptAddon/My Project/Settings.Designer.vb
generated
@@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
17
README.md
17
README.md
@@ -46,6 +46,23 @@ class Script
|
||||
|
||||
### Changes
|
||||
|
||||
### 0.2.5
|
||||
|
||||
- mpv lib updated to 2019-02-24
|
||||
- UI glitch fixed the appeared when started in fullscreen mode
|
||||
- fixed default video output mode which caused video playback to fail
|
||||
|
||||
### 0.2.4
|
||||
|
||||
- changed minimum runtime to .NET 4.7.2
|
||||
- fixed mpv.net not working with new mpv lib
|
||||
- the track name in the title bar was sometimes wrong
|
||||
- mpv lib updated to 2018-12-16
|
||||
- quit-watch-later added to context menu (Shift+Q) to exit and resume at the last position
|
||||
- ab loop added to menu
|
||||
- added the possibility to modify mpv.conf settings using the context menu
|
||||
- added link to the manual and default keys to the menu
|
||||
|
||||
### 0.2.2
|
||||
|
||||
- history feature added
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Rating</RootNamespace>
|
||||
<AssemblyName>RatingAddon</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -65,65 +66,104 @@ namespace mpvnet
|
||||
ProcessHelp.Start(OS.GetTextEditor(), '"' + mpv.InputConfPath + '"');
|
||||
}
|
||||
|
||||
public static void show_prefs(string[] args)
|
||||
private static void CreateMpvConf()
|
||||
{
|
||||
string filepath = Folder.AppDataRoaming + "mpv\\mpv.conf";
|
||||
|
||||
if (!File.Exists(filepath))
|
||||
if (!File.Exists(mpv.mpvConfPath))
|
||||
{
|
||||
var dirPath = Folder.AppDataRoaming + "mpv\\";
|
||||
|
||||
if (!Directory.Exists(dirPath))
|
||||
Directory.CreateDirectory(dirPath);
|
||||
|
||||
File.WriteAllText(filepath, "# https://mpv.io/manual/master/#configuration-files");
|
||||
File.WriteAllText(mpv.mpvConfPath, "# https://mpv.io/manual/master/#configuration-files");
|
||||
}
|
||||
}
|
||||
|
||||
ProcessHelp.Start(OS.GetTextEditor(), '"' + filepath + '"');
|
||||
public static void show_prefs(string[] args)
|
||||
{
|
||||
CreateMpvConf();
|
||||
ProcessHelp.Start(OS.GetTextEditor(), '"' + mpv.mpvConfPath + '"');
|
||||
}
|
||||
|
||||
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, "");
|
||||
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 shell_execute(string[] args)
|
||||
{
|
||||
Process.Start(args[0]);
|
||||
}
|
||||
|
||||
public static void set_setting(string[] args)
|
||||
{
|
||||
CreateMpvConf();
|
||||
|
||||
bool changed = false;
|
||||
string fp = mpv.mpvConfPath;
|
||||
var confLines = File.ReadAllLines(fp);
|
||||
|
||||
for (int i = 0; i < confLines.Length; i++)
|
||||
{
|
||||
if (confLines[i].Left("=").Trim() == args[0])
|
||||
{
|
||||
confLines[i] = args[0] + "=" + args[1];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
File.WriteAllText(fp, String.Join(Environment.NewLine, confLines));
|
||||
}
|
||||
else
|
||||
{
|
||||
File.WriteAllText(fp,
|
||||
File.ReadAllText(fp) + Environment.NewLine + args[0] + "=" + args[1]);
|
||||
}
|
||||
|
||||
MsgInfo("Please restart mpv.net");
|
||||
}
|
||||
|
||||
public static void show_info(string[] args)
|
||||
{
|
||||
try
|
||||
var fi = new FileInfo(mpv.GetStringProp("path"));
|
||||
|
||||
using (var mi = new MediaInfo(fi.FullName))
|
||||
{
|
||||
var fi = new FileInfo(mpv.GetStringProp("path"));
|
||||
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"));
|
||||
string mibr = mi.GetInfo(StreamKind.Video, "BitRate");
|
||||
|
||||
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 (mibr == "")
|
||||
mibr = "0";
|
||||
|
||||
if (fn.Length > 60)
|
||||
fn = fn.Insert(59, BR);
|
||||
var br = Convert.ToInt32(mibr) / 1000.0 / 1000.0;
|
||||
var vf = mpv.GetStringProp("video-format").ToUpper();
|
||||
var fn = fi.Name;
|
||||
|
||||
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;
|
||||
if (fn.Length > 60)
|
||||
fn = fn.Insert(59, BR);
|
||||
|
||||
mpv.Command("show-text", info, "5000");
|
||||
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;
|
||||
|
||||
string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
mpv.Command("show-text", info, "5000");
|
||||
|
||||
string FormatTime(double value) => ((int)(Math.Floor(value))).ToString("00");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
5
mpvnet/MainForm.Designer.cs
generated
5
mpvnet/MainForm.Designer.cs
generated
@@ -42,8 +42,8 @@
|
||||
// MainForm
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(20F, 48F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.ClientSize = new System.Drawing.Size(1553, 1000);
|
||||
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
@@ -52,6 +52,7 @@
|
||||
this.Name = "MainForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "mpv.net";
|
||||
this.Load += new System.EventHandler(this.MainForm_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -24,28 +24,23 @@ namespace mpvnet
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
try
|
||||
{
|
||||
Application.ThreadException += Application_ThreadException;
|
||||
InitializeComponent();
|
||||
SetFormPosSize();
|
||||
Instance = this;
|
||||
Hwnd = Handle;
|
||||
mpv.Init();
|
||||
mpv.ObserveBoolProp("fullscreen", MpvChangeFullscreen);
|
||||
mpv.AfterShutdown += Mpv_AfterShutdown;
|
||||
mpv.VideoSizeChanged += Mpv_VideoSizeChanged;
|
||||
mpv.PlaybackRestart += mpv_PlaybackRestart;
|
||||
|
||||
ToolStripManager.Renderer = new ToolStripRendererEx(ToolStripRenderModeEx.SystemDefault);
|
||||
ChangeFullscreen((mpv.mpvConv.ContainsKey("fullscreen") && mpv.mpvConv["fullscreen"] == "yes") || (mpv.mpvConv.ContainsKey("fs") && mpv.mpvConv["fs"] == "yes"));
|
||||
CMS = new ContextMenuStripEx(components);
|
||||
CMS.Opened += CMS_Opened;
|
||||
ContextMenuStrip = CMS;
|
||||
BuildMenu();
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleException(e);
|
||||
HandleException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,14 +95,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)
|
||||
@@ -253,7 +253,7 @@ namespace mpvnet
|
||||
var p2 = PointToScreen(e.Location);
|
||||
|
||||
if (Math.Abs(p1.X - p2.X) < 10 && Math.Abs(p1.Y - p2.Y) < 10)
|
||||
Close();
|
||||
mpv.Command("quit");
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
@@ -293,5 +293,14 @@ namespace mpvnet
|
||||
CursorHelp.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs ea)
|
||||
{
|
||||
mpv.Init();
|
||||
mpv.ObserveBoolProp("fullscreen", MpvChangeFullscreen);
|
||||
mpv.AfterShutdown += Mpv_AfterShutdown;
|
||||
mpv.VideoSizeChanged += Mpv_VideoSizeChanged;
|
||||
mpv.PlaybackRestart += mpv_PlaybackRestart;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("mpv.net")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017 stax76")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019 stax76")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -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.2.0")]
|
||||
[assembly: AssemblyFileVersion("0.2.2.0")]
|
||||
[assembly: AssemblyVersion("0.2.6.0")]
|
||||
[assembly: AssemblyFileVersion("0.2.6.0")]
|
||||
|
||||
2
mpvnet/Properties/Resources.Designer.cs
generated
2
mpvnet/Properties/Resources.Designer.cs
generated
@@ -66,7 +66,7 @@ namespace mpvnet.Properties {
|
||||
///
|
||||
///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
|
||||
///
|
||||
///F11 playlist-prev #menu: F11 ; Navigate | Previous
|
||||
|
||||
2
mpvnet/Properties/Settings.Designer.cs
generated
2
mpvnet/Properties/Settings.Designer.cs
generated
@@ -12,7 +12,7 @@ namespace mpvnet.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -1,51 +1,59 @@
|
||||
#this file defines the shortcut keys and the context menu
|
||||
|
||||
#key command key caption menu path/caption
|
||||
#key command key caption menu path/caption
|
||||
|
||||
o script-message mpv.net open-files #menu: O; Open Files
|
||||
o script-message mpv.net open-files #menu: O; Open Files
|
||||
|
||||
Space cycle pause #menu: Space ; Play/Pause
|
||||
s stop #menu: S ; Stop
|
||||
Space cycle pause #menu: Space ; Play/Pause
|
||||
s stop #menu: S ; Stop
|
||||
|
||||
F11 playlist-prev #menu: F11 ; Navigate | Previous
|
||||
F12 playlist-next #menu: F12 ; Navigate | Next
|
||||
F11 playlist-prev #menu: F11 ; Navigate | Previous
|
||||
F12 playlist-next #menu: F12 ; Navigate | Next
|
||||
|
||||
Ctrl++ add video-zoom 0.1 #menu: Ctrl++ ; Pan && Scan | Increase Size
|
||||
Ctrl+- add video-zoom -0.1 #menu: Ctrl+- ; Pan && Scan | Decrease Size
|
||||
Ctrl++ add video-zoom 0.1 #menu: Ctrl++ ; Pan && Scan | Increase Size
|
||||
Ctrl+- add video-zoom -0.1 #menu: Ctrl+- ; Pan && Scan | Decrease Size
|
||||
|
||||
Enter cycle fullscreen #menu: Enter ; Cycle Fullscreen
|
||||
KP7 cycle audio #menu: Numpad 7 ; Cycle Audio
|
||||
KP8 cycle sub #menu: Numpad 8 ; Cycle Subtitle
|
||||
Enter cycle pause #menu: Enter ; Cycle Fullscreen
|
||||
KP7 cycle audio #menu: Numpad 7 ; Cycle Audio
|
||||
KP8 cycle sub #menu: Numpad 8 ; Cycle Subtitle
|
||||
|
||||
+ add volume 5 #menu: + ; Volume | Up
|
||||
- add volume -5 #menu: - ; Volume | Down
|
||||
Axis_Up add volume 5 # wheel up
|
||||
Axis_Down add volume -5 # wheel down
|
||||
_ ignore #menu: _ ; Volume | -
|
||||
m cycle mute #menu: M ; Volume | Mute
|
||||
+ add volume 10 #menu: + ; Volume | Up
|
||||
- add volume -10 #menu: - ; Volume | Down
|
||||
Axis_Up add volume 10 #wheel up
|
||||
Axis_Down add volume -10 #wheel down
|
||||
_ ignore #menu: _ ; Volume | -
|
||||
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
|
||||
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 7 #menu: Right ; Seek | 7 sec forward
|
||||
Left no-osd seek -7 #menu: Left ; Seek | 7 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
|
||||
KP2 script-message rate-file 2 #menu: Numpad 2 ; Addons | Rating | 2stars
|
||||
KP3 script-message rate-file 3 #menu: Numpad 3 ; Addons | Rating | 3stars
|
||||
KP4 script-message rate-file 4 #menu: Numpad 4 ; Addons | Rating | 4stars
|
||||
KP5 script-message rate-file 5 #menu: Numpad 5 ; Addons | Rating | 5stars
|
||||
KP0 script-message rate-file 0 #menu: Numpad 0 ; Addons | Rating | 0stars
|
||||
KP1 script-message rate-file 1 #menu: Numpad 1 ; Addons | Rating | 1stars
|
||||
KP2 script-message rate-file 2 #menu: Numpad 2 ; Addons | Rating | 2stars
|
||||
KP3 script-message rate-file 3 #menu: Numpad 3 ; Addons | Rating | 3stars
|
||||
KP4 script-message rate-file 4 #menu: Numpad 4 ; Addons | Rating | 4stars
|
||||
KP5 script-message rate-file 5 #menu: Numpad 5 ; Addons | Rating | 5stars
|
||||
|
||||
p script-message mpv.net show-prefs #menu: P ; Preferences
|
||||
k script-message mpv.net show-keys #menu: K ; Keys
|
||||
_ script-message mpv.net set-setting hwdec yes #menu: _ ; Settings | Hardware Decoding | Enable Hardware Decoding
|
||||
_ script-message mpv.net set-setting hwdec no #menu: _ ; Settings | Hardware Decoding | Disable Hardware Decoding
|
||||
|
||||
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
|
||||
p script-message mpv.net show-prefs #menu: P ; Settings | Show Preferences
|
||||
k script-message mpv.net show-keys #menu: K ; Settings | Show 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
|
||||
l ab-loop #menu: L ; Tools | AB Loop
|
||||
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: _ ; Tools | mpv Manual
|
||||
_ script-message mpv.net shell-execute https://github.com/mpv-player/mpv/blob/master/etc/input.conf #menu: _ ; Tools | mpv Default Keys
|
||||
Esc quit #menu: Escape ; Exit
|
||||
Q quit-watch-later #menu: Shift+Q; Exit Watch Later
|
||||
@@ -23,7 +23,6 @@ namespace mpvnet
|
||||
public static event Action<string[]> ClientMessage;
|
||||
public static event Action Shutdown;
|
||||
public static event Action AfterShutdown;
|
||||
public static event Action FileLoaded;
|
||||
public static event Action PlaybackRestart;
|
||||
public static event Action VideoSizeChanged;
|
||||
|
||||
@@ -33,8 +32,32 @@ namespace mpvnet
|
||||
public static List<Action<bool>> BoolPropChangeActions = new List<Action<bool>>();
|
||||
public static Size VideoSize = new Size(1920, 1080);
|
||||
public static string InputConfPath = Folder.AppDataRoaming + "mpv\\input.conf";
|
||||
public static string mpvConfPath = Folder.AppDataRoaming + "mpv\\mpv.conf";
|
||||
public static StringPairList BindingList = new StringPairList();
|
||||
|
||||
private static Dictionary<string, string> _mpvConv;
|
||||
|
||||
public static Dictionary<string, string> mpvConv {
|
||||
get {
|
||||
if (_mpvConv == null)
|
||||
{
|
||||
_mpvConv = new Dictionary<string, string>();
|
||||
|
||||
if (File.Exists(mpvConfPath))
|
||||
{
|
||||
foreach (var i in File.ReadAllLines(mpvConfPath))
|
||||
{
|
||||
if (i.Contains("=") && ! i.StartsWith("#"))
|
||||
{
|
||||
_mpvConv[i.Left("=").Trim()] = i.Right("=").Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return _mpvConv;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
LoadLibrary("mpv-1.dll");
|
||||
@@ -42,14 +65,12 @@ namespace mpvnet
|
||||
SetIntProp("input-ar-delay", 500);
|
||||
SetIntProp("input-ar-rate", 20);
|
||||
SetIntProp("volume", 50);
|
||||
SetStringProp("hwdec", "auto");
|
||||
SetStringProp("hwdec", "yes");
|
||||
SetStringProp("vo", "direct3d");
|
||||
SetStringProp("input-default-bindings", "yes");
|
||||
SetStringProp("opengl-backend", "angle");
|
||||
SetStringProp("osd-playing-msg", "'${filename}'");
|
||||
SetStringProp("profile", "opengl-hq");
|
||||
SetStringProp("screenshot-directory", "~~desktop/");
|
||||
SetStringProp("vo", "opengl");
|
||||
SetStringProp("keep-open", "always");
|
||||
SetStringProp("keep-open", "yes");
|
||||
SetStringProp("keep-open-pause", "no");
|
||||
SetStringProp("osc", "yes");
|
||||
SetStringProp("config", "yes");
|
||||
@@ -79,13 +100,14 @@ namespace mpvnet
|
||||
AfterShutdown?.Invoke();
|
||||
return;
|
||||
case mpv_event_id.MPV_EVENT_FILE_LOADED:
|
||||
FileLoaded?.Invoke();
|
||||
LoadFolder();
|
||||
break;
|
||||
case mpv_event_id.MPV_EVENT_PLAYBACK_RESTART:
|
||||
PlaybackRestart?.Invoke();
|
||||
var s = new Size(GetIntProp("dwidth"), GetIntProp("dheight"));
|
||||
|
||||
if (VideoSize != s)
|
||||
Size s = new Size(GetIntProp("dwidth", false), GetIntProp("dheight", false));
|
||||
|
||||
if (VideoSize != s && s != Size.Empty)
|
||||
{
|
||||
VideoSize = s;
|
||||
VideoSizeChanged?.Invoke();
|
||||
@@ -101,7 +123,14 @@ namespace mpvnet
|
||||
if (args != null && args.Length > 1 && args[0] == "mpv.net")
|
||||
foreach (var i in mpvnet.Command.Commands)
|
||||
if (args[1] == i.Name)
|
||||
i.Action(args.Skip(2).ToArray());
|
||||
try
|
||||
{
|
||||
i.Action(args.Skip(2).ToArray());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MsgError(ex.GetType().Name, ex.ToString());
|
||||
}
|
||||
|
||||
ClientMessage?.Invoke(args);
|
||||
}
|
||||
@@ -160,12 +189,13 @@ namespace mpvnet
|
||||
{
|
||||
var lpBuffer = IntPtr.Zero;
|
||||
int err = mpv_get_property(MpvHandle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_STRING, ref lpBuffer);
|
||||
var ret = StringFromNativeUtf8(lpBuffer);
|
||||
mpv_free(lpBuffer);
|
||||
|
||||
if (err < 0)
|
||||
throw new Exception($"{name}: {(mpv_error)err}");
|
||||
|
||||
var ret = StringFromNativeUtf8(lpBuffer);
|
||||
mpv_free(lpBuffer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -231,8 +261,6 @@ namespace mpvnet
|
||||
mpv.SetStringProp(i.Substring(2), "yes");
|
||||
}
|
||||
}
|
||||
|
||||
LoadFolder();
|
||||
}
|
||||
|
||||
public static void LoadFiles(string[] files)
|
||||
@@ -250,8 +278,13 @@ namespace mpvnet
|
||||
mpv.LoadFolder();
|
||||
}
|
||||
|
||||
private static bool WasFolderLoaded;
|
||||
|
||||
public static void LoadFolder()
|
||||
{
|
||||
if (WasFolderLoaded)
|
||||
return;
|
||||
|
||||
if (GetIntProp("playlist-count") == 1)
|
||||
{
|
||||
string[] types = "264 265 3gp aac ac3 avc avi avs bmp divx dts dtshd dtshr dtsma eac3 evo flac flv h264 h265 hevc hvc jpg jpeg m2t m2ts m2v m4a m4v mka mkv mlp mov mp2 mp3 mp4 mpa mpeg mpg mpv mts ogg ogm opus pcm png pva raw rmvb thd thd+ac3 true-hd truehd ts vdr vob vpy w64 wav webm wmv y4m".Split(' ');
|
||||
@@ -268,6 +301,8 @@ namespace mpvnet
|
||||
if (index > 0)
|
||||
Command("playlist-move", "0", (index + 1).ToString());
|
||||
}
|
||||
|
||||
WasFolderLoaded = true;
|
||||
}
|
||||
|
||||
public static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>mpvnet</RootNamespace>
|
||||
<AssemblyName>mpvnet</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using namespace System.Diagnostics
|
||||
$exePath = "D:\Projekte\VS\CS\mpvnet\mpvnet\bin\Debug\mpvnet.exe"
|
||||
$exePath = "C:\Users\frank\C-Daten\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
|
||||
$targetDir = "C:\Users\Frank\Desktop\mpv.net-" + $version
|
||||
Copy-Item C:\Users\frank\C-Daten\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
|
||||
C:\Users\frank\C-Daten\Projekte\VS\VB\util\bin\util.exe -pack $targetDir
|
||||
@@ -254,14 +254,9 @@ Namespace UI
|
||||
MyBase.New(container)
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnOpening(e As CancelEventArgs)
|
||||
MyBase.OnOpening(e)
|
||||
MenuHelp.SetRenderer(Me)
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnHandleCreated(e As EventArgs)
|
||||
MyBase.OnHandleCreated(e)
|
||||
Font = New Font("Segoe UI", 9)
|
||||
MenuHelp.SetRenderer(Me)
|
||||
End Sub
|
||||
|
||||
<DefaultValue(GetType(Form), Nothing)>
|
||||
|
||||
2
vbnet/My Project/Settings.Designer.vb
generated
2
vbnet/My Project/Settings.Designer.vb
generated
@@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AssemblyName>vbnet</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
||||
Reference in New Issue
Block a user