This commit is contained in:
Frank Skare
2019-03-18 22:00:08 +01:00
parent 3fd1285ad8
commit c508761c36
10 changed files with 147 additions and 107 deletions

View File

@@ -84,6 +84,10 @@ mp.register_event("seek", seek) # or use: mp.Seek += seek
### Changes ### Changes
### 1.2
- a thread synchonisation bug which caused the shutdown to be delayed or frozen was fixed, it also caused the Shutdown event not to fire which caused the rating plugin not to work
### 1.1 ### 1.1
- added support for Python scripting via IronPython - added support for Python scripting via IronPython

View File

@@ -31,10 +31,6 @@ namespace mpvnet
Instance = this; Instance = this;
Hwnd = Handle; Hwnd = Handle;
ChangeFullscreen((mp.mpvConv.ContainsKey("fullscreen") && mp.mpvConv["fullscreen"] == "yes") || (mp.mpvConv.ContainsKey("fs") && mp.mpvConv["fs"] == "yes")); ChangeFullscreen((mp.mpvConv.ContainsKey("fullscreen") && mp.mpvConv["fullscreen"] == "yes") || (mp.mpvConv.ContainsKey("fs") && mp.mpvConv["fs"] == "yes"));
CMS = new ContextMenuStripEx(components);
CMS.Opened += CMS_Opened;
ContextMenuStrip = CMS;
BuildMenu();
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -44,14 +40,6 @@ namespace mpvnet
public void BuildMenu() public void BuildMenu()
{ {
if (!File.Exists(mp.InputConfPath))
{
if (!Directory.Exists(mp.mpvConfFolderPath))
Directory.CreateDirectory(mp.mpvConfFolderPath);
File.WriteAllText(mp.InputConfPath, Properties.Resources.input_conf);
}
foreach (var i in File.ReadAllText(mp.InputConfPath).SplitLinesNoEmpty()) foreach (var i in File.ReadAllText(mp.InputConfPath).SplitLinesNoEmpty())
{ {
if (!i.Contains("#menu:")) if (!i.Contains("#menu:"))
@@ -129,7 +117,7 @@ namespace mpvnet
private void mp_Shutdown() private void mp_Shutdown()
{ {
if (!IsClosed) if (!IsClosed)
Invoke(new Action(() => Close())); BeginInvoke(new Action(() => Close()));
} }
public bool IsFullscreen public bool IsFullscreen
@@ -293,6 +281,15 @@ namespace mpvnet
mp.PlaybackRestart += mp_PlaybackRestart; mp.PlaybackRestart += mp_PlaybackRestart;
} }
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
CMS = new ContextMenuStripEx(components);
CMS.Opened += CMS_Opened;
ContextMenuStrip = CMS;
BuildMenu();
}
protected override void OnFormClosed(FormClosedEventArgs e) protected override void OnFormClosed(FormClosedEventArgs e)
{ {
base.OnFormClosed(e); base.OnFormClosed(e);
@@ -302,7 +299,7 @@ namespace mpvnet
for (int i = 0; i < 99; i++) for (int i = 0; i < 99; i++)
{ {
if (mp.IsShutdownComplete) break; if (mp.IsShutdownComplete) break;
Thread.Sleep(50); Thread.Sleep(100);
} }
} }
} }

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 // 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("1.1.0.0")] [assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.2.0.0")]

View File

@@ -1,71 +1,97 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.42000 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace mpvnet.Properties { namespace mpvnet.Properties {
using System; using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder // This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() { internal Resources() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("mpvnet.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("mpvnet.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
set { set {
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary> /// <summary>
/// </summary> /// Looks up a localized string similar to # mpv.net key bindings, mouse bindings and context menu configuration
internal static string input_conf { ///
get { /// o script-message mpv.net open-files #menu: O ; Open Files...
return ResourceManager.GetString("input_conf", resourceCulture); /// _ ignore #menu: _ ; -
} /// Space cycle pause #menu: Space, Enter ; Play/Pause
} /// Enter cycle pause
} /// s stop #menu: S ; Stop
} /// _ ignore #menu: _ ; -
/// f cycle fullscreen #menu: F ; Toggle Fullscreen /// [rest of string was truncated]&quot;;.
/// </summary>
internal static string input_conf {
get {
return ResourceManager.GetString("input_conf", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to input-ar-delay = 500
///input-ar-rate = 20
///volume = 50
///hwdec = yes
///vo = direct3d
///keep-open = yes
///keep-open-pause = no
///osd-playing-msg = &apos;${filename}&apos;
///screenshot-directory = ~~desktop/.
/// </summary>
internal static string mpv_conf {
get {
return ResourceManager.GetString("mpv_conf", resourceCulture);
}
}
}
}

View File

@@ -119,6 +119,9 @@
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="input_conf" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="input_conf" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\input_conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> <value>..\Resources\input.conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="mpv_conf" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mpv.conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data> </data>
</root> </root>

View File

@@ -38,7 +38,7 @@
w add panscan -0.1 #menu: W ; Pan && Scan > Decrease Height w add panscan -0.1 #menu: W ; Pan && Scan > Decrease Height
W add panscan +0.1 #menu: Shift+W ; Pan && Scan > Increase Height W add panscan +0.1 #menu: Shift+W ; Pan && Scan > Increase Height
_ ignore #menu: _ ; Pan && Scan > - _ ignore #menu: _ ; Pan && Scan > -
Shift+BS set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0 #menu: Alt+Backspace ; Pan && Scan > Reset Shift+BS set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0 #menu: Shift+Backspace ; Pan && Scan > Reset
Ctrl+1 add contrast -1 #menu: Ctrl+1 ; Video > Decrease Contrast Ctrl+1 add contrast -1 #menu: Ctrl+1 ; Video > Decrease Contrast
Ctrl+2 add contrast 1 #menu: Ctrl+2 ; Video > Increase Contrast Ctrl+2 add contrast 1 #menu: Ctrl+2 ; Video > Increase Contrast
@@ -74,7 +74,6 @@
_ ignore #menu: _ ; Subtitle > - _ ignore #menu: _ ; Subtitle > -
_ add sub-scale -0.1 #menu: _ ; Subtitle > Decrease Subtitle Font Size _ add sub-scale -0.1 #menu: _ ; Subtitle > Decrease Subtitle Font Size
_ add sub-scale +0.1 #menu: _ ; Subtitle > Increase Subtitle Font Size _ add sub-scale +0.1 #menu: _ ; Subtitle > Increase Subtitle Font Size
_ ignore #menu: _ ; Subtitle > -
+ add volume 10 #menu: + ; Volume > Up + add volume 10 #menu: + ; Volume > Up
- add volume -10 #menu: - ; Volume > Down - add volume -10 #menu: - ; Volume > Down

View File

@@ -0,0 +1,11 @@
# https://mpv.io/manual/master/
input-ar-delay = 500
input-ar-rate = 20
volume = 50
hwdec = yes
vo = direct3d
keep-open = yes
keep-open-pause = no
osd-playing-msg = ${filename}
screenshot-directory = ~~desktop/

View File

@@ -88,18 +88,18 @@ namespace mpvnet
public static void Init() public static void Init()
{ {
if (!Directory.Exists(mp.mpvConfFolderPath))
Directory.CreateDirectory(mp.mpvConfFolderPath);
if (!File.Exists(mp.mpvConfPath))
File.WriteAllText(mp.mpvConfPath, Properties.Resources.mpv_conf);
if (!File.Exists(mp.InputConfPath))
File.WriteAllText(mp.InputConfPath, Properties.Resources.input_conf);
LoadLibrary("mpv-1.dll"); LoadLibrary("mpv-1.dll");
MpvHandle = mpv_create(); MpvHandle = mpv_create();
SetIntProp("input-ar-delay", 500);
SetIntProp("input-ar-rate", 20);
SetIntProp("volume", 50);
SetStringProp("hwdec", "yes");
SetStringProp("vo", "direct3d");
SetStringProp("input-default-bindings", "yes"); SetStringProp("input-default-bindings", "yes");
SetStringProp("osd-playing-msg", "'${filename}'");
SetStringProp("screenshot-directory", "~~desktop/");
SetStringProp("keep-open", "yes");
SetStringProp("keep-open-pause", "no");
SetStringProp("osc", "yes"); SetStringProp("osc", "yes");
SetStringProp("config", "yes"); SetStringProp("config", "yes");
SetStringProp("wid", MainForm.Hwnd.ToString()); SetStringProp("wid", MainForm.Hwnd.ToString());

View File

@@ -132,6 +132,11 @@
<Compile Include="Menu.cs"> <Compile Include="Menu.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="PyScript.cs" /> <Compile Include="PyScript.cs" />
<Compile Include="StringExtensions.cs" /> <Compile Include="StringExtensions.cs" />
<Compile Include="libmpv.cs" /> <Compile Include="libmpv.cs" />
@@ -155,14 +160,9 @@
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType> <SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.manifest" /> <None Include="app.manifest" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
@@ -173,6 +173,7 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Content Include="Resources\mpv.conf.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
@@ -180,7 +181,7 @@
<ItemGroup> <ItemGroup>
<Content Include="mpv.ico" /> <Content Include="mpv.ico" />
<Content Include="screenshot.jpg" /> <Content Include="screenshot.jpg" />
<None Include="Resources\input_conf.txt" /> <Content Include="Resources\input.conf.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@@ -4,7 +4,6 @@ $version = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath).FileVersion
$desktopDir = [Environment]::GetFolderPath("Desktop") $desktopDir = [Environment]::GetFolderPath("Desktop")
$targetDir = $desktopDir + "\mpv.net-" + $version $targetDir = $desktopDir + "\mpv.net-" + $version
Copy-Item $scriptDir\mpv.net\bin\Debug $targetDir -recurse Copy-Item $scriptDir\mpv.net\bin\Debug $targetDir -recurse
$addonDir = $targetDir + "\Addons"
$7zPath = "C:\Program Files\7-Zip\7z.exe" $7zPath = "C:\Program Files\7-Zip\7z.exe"
$args = "a -t7z -mx9 $targetDir.7z -r $targetDir\*" $args = "a -t7z -mx9 $targetDir.7z -r $targetDir\*"
Start-Process -FilePath $7zPath -ArgumentList $args Start-Process -FilePath $7zPath -ArgumentList $args