diff --git a/docs/changelog.md b/docs/changelog.md index be3d9e13..718157a7 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,14 +1,17 @@ -# v7.1.1.1 Beta (????-??-??) +# v7.1.1.1 Beta (2024-07-20) - Korean, Russian and Turkish translation added, Japanese translation fixed. Thanks to the translation team! - Action/Workflow/Auto build fix and update. - New default bindings and menu items for select.lua which is a new simple mpv built-in command palette script. In the context menu select.lua features can be found under `View > On Screen Menu`. https://github.com/mpv-player/mpv/blob/master/player/lua/select.lua -- The helper script 'Tools\update-mpv-and-libmpv.ps1' no longer uses command line arguments, - it uses now the Path environment variable to find mpv and mpv.net. -- Fix loading of DVD ISO files. +- New PowerShell script 'Tools\release-mpv.net.ps1' used to releases mpv.net on GitHub. +- Fix DVD ISO file support. +- MediaInfo updated to version v24.6. +- New ARM64 support. +- New zhongfly libmpv x64 build. +- New Andarwinux libmpv ARM64 build. # v7.1.1.0 (2024-02-03) diff --git a/src/MpvNet.Windows/MpvNet.Windows.csproj b/src/MpvNet.Windows/MpvNet.Windows.csproj index b8ddcf36..c9f50538 100644 --- a/src/MpvNet.Windows/MpvNet.Windows.csproj +++ b/src/MpvNet.Windows/MpvNet.Windows.csproj @@ -11,9 +11,9 @@ true mpv-icon.ico mpv.net - 7.1.1.0 - 7.1.1.0 - 7.1.1.0 + 7.1.1.1 + 7.1.1.1 + 7.1.1.1 enable diff --git a/src/MpvNet/App.cs b/src/MpvNet/App.cs index 1343d33d..9d8cc061 100644 --- a/src/MpvNet/App.cs +++ b/src/MpvNet/App.cs @@ -78,19 +78,13 @@ public void Init() } public static string About => "Copyright (C) 2000-2024 mpv.net/mpv/mplayer\n" + - $"{AppInfo.Product} {AppInfo.Version}" + GetLastWriteTime(Environment.ProcessPath!) + "\n" + + $"{AppInfo.Product} v{AppInfo.Version}" + GetLastWriteTime(Environment.ProcessPath!) + "\n" + $"{Player.GetPropertyString("mpv-version")}" + GetLastWriteTime(Folder.Startup + "libmpv-2.dll") + "\n" + - $"ffmpeg {Player.GetPropertyString("ffmpeg-version")}\n" + "GPL v2 License"; + $"ffmpeg {Player.GetPropertyString("ffmpeg-version")}\n" + + $"MediaInfo v{FileVersionInfo.GetVersionInfo(Folder.Startup + "MediaInfo.dll").FileVersion}" + + $"{GetLastWriteTime(Folder.Startup + "MediaInfo.dll")}" + "\n" + "GPL v2 License"; - static string GetLastWriteTime(string path) - { - if (IsStoreVersion) - return ""; - - return $" ({File.GetLastWriteTime(path).ToShortDateString()})"; - } - - static bool IsStoreVersion => Folder.Startup.Contains("FrankSkare.mpvnet"); + static string GetLastWriteTime(string path) => $" ({File.GetLastWriteTime(path).ToShortDateString()})"; void Player_Initialized() { diff --git a/src/Setup/Inno/inno-setup.iss b/src/Setup/Inno/inno-setup.iss index 2d5eadb8..e0403098 100644 --- a/src/Setup/Inno/inno-setup.iss +++ b/src/Setup/Inno/inno-setup.iss @@ -12,7 +12,7 @@ AppPublisher=Frank Skare (stax76) ArchitecturesInstallIn64BitMode=x64 Compression=lzma2 DefaultDirName={autopf}\{#MyAppName} -OutputBaseFilename=mpv.net-v{#MyAppVersion}-setup +OutputBaseFilename=mpv.net-v{#MyAppVersion}-setup-x64 OutputDir=E:\Desktop DefaultGroupName={#MyAppName} SetupIconFile=..\..\MpvNet.Windows\mpv-icon.ico @@ -25,4 +25,4 @@ Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" [Files] Source: "{#MyAppSourceDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion -Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Excludes: "win-x64"; Flags: ignoreversion recursesubdirs createallsubdirs; +Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Excludes: "win-x64,win-arm64"; Flags: ignoreversion recursesubdirs createallsubdirs; diff --git a/src/Tools/release-mpv.net.ps1 b/src/Tools/release-mpv.net.ps1 new file mode 100644 index 00000000..b1bc1075 --- /dev/null +++ b/src/Tools/release-mpv.net.ps1 @@ -0,0 +1,114 @@ + +<# + +Script that releases mpv.net on GitHub. + +Needs 2 positional CLI arguments: + 1. Directory where the mpv.net source code is located. + 2. Directory of the output files, for instance the desktop dir. + +Dependencies: + 7zip installation found at: 'C:\Program Files\7-Zip\7z.exe'. + Inno Setup compiler installation found at: 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe'. + GitHub CLI https://cli.github.com + +#> + +# Stop when the first error occurs +$ErrorActionPreference = 'Stop' + +function DeleteDir($path) { + if (Test-Path $path) { + Remove-Item $path -Recurse + } +} + +# Throw error if the file/dir don't exist +function Test($path) { + if (-not (Test-Path $path)) { + throw $path + } + return $path +} + +# Variables +$SourceDir = Test $args[0] +$OutputRootDir = Test $args[1] + +Test (Join-Path $SourceDir 'MpvNet.sln') + +$7zFile = Test 'C:\Program Files\7-Zip\7z.exe' +$InnoSetupCompiler = Test 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' + +$ReleaseNotes = "- [.NET Desktop Runtime 6.0](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)`n- [Changelog](https://github.com/mpvnet-player/mpv.net/blob/main/docs/changelog.md)" +$Repo = 'github.com/mpvnet-player/mpv.net' + +# Dotnet Publish +$PublishDir64 = Join-Path $SourceDir 'MpvNet.Windows\bin\Debug\win-x64\publish\' +$PublishDirARM64 = Join-Path $SourceDir 'MpvNet.Windows\bin\Debug\win-arm64\publish\' +$ProjectFile = Test (Join-Path $SourceDir 'MpvNet.Windows\MpvNet.Windows.csproj') +dotnet publish $ProjectFile --self-contained false --configuration Debug --runtime win-x64 +dotnet publish $ProjectFile --self-contained false --configuration Debug --runtime win-arm64 +$PublishedExeFile64 = Test ($PublishDir64 + 'mpvnet.exe') + +# Create OutputName +$VersionInfo = [Diagnostics.FileVersionInfo]::GetVersionInfo($PublishedExeFile64) +$IsBeta = $VersionInfo.FilePrivatePart -ne 0 +$BetaString = if ($IsBeta) { '-beta' } else { '' } +$VersionName = $VersionInfo.FileVersion +$OutputName64 = 'mpv.net-v' + $VersionName + $BetaString + '-portable-x64' +$OutputNameARM64 = 'mpv.net-v' + $VersionName + $BetaString + '-portable-ARM64' + +# Create OutputFolder +$OutputDir64 = Join-Path $OutputRootDir ($OutputName64 + '\') +$OutputDirARM64 = Join-Path $OutputRootDir ($OutputNameARM64 + '\') +DeleteDir $OutputDir64 +DeleteDir $OutputDirARM64 +mkdir $OutputDir64 +mkdir $OutputDirARM64 + +# Copy Files +Copy-Item ($PublishDir64 + '*') $OutputDir64 +Copy-Item ($PublishDirARM64 + '*') $OutputDirARM64 +$BinDirX64 = Test (Join-Path $SourceDir 'MpvNet.Windows\bin\Debug\') +$BinDirARM64 = Test (Join-Path $SourceDir 'MpvNet.Windows\bin\Debug\win-arm64\') +$ExtraFiles = 'mpvnet.com', 'libmpv-2.dll', 'MediaInfo.dll' +$ExtraFiles | ForEach-Object { Copy-Item ($BinDirX64 + $_) ($OutputDir64 + $_) } +$ExtraFiles | ForEach-Object { Copy-Item ($BinDirARM64 + $_) ($OutputDirARM64 + $_) } +$LocaleDir = Test (Join-Path $SourceDir 'MpvNet.Windows\bin\Debug\Locale\') +Copy-Item $LocaleDir ($OutputDir64 + 'Locale') -Recurse +Copy-Item $LocaleDir ($OutputDirARM64 + 'Locale') -Recurse + +# Pack +$ZipOutputFile64 = Join-Path $OutputRootDir ($OutputName64 + '.zip') +$ZipOutputFileARM64 = Join-Path $OutputRootDir ($OutputNameARM64 + '.zip') +& $7zFile a -tzip -mx9 $ZipOutputFile64 -r ($OutputDir64 + '*') +if ($LastExitCode) { throw $LastExitCode } +& $7zFile a -tzip -mx9 $ZipOutputFileARM64 -r ($OutputDirARM64 + '*') +if ($LastExitCode) { throw $LastExitCode } +Test $ZipOutputFile64 +Test $ZipOutputFileARM64 + +# Inno Setup +''; '' +$InnoSetupScript = Test (Join-Path $SourceDir 'Setup\Inno\inno-setup.iss') +& $InnoSetupCompiler $InnoSetupScript +if ($LastExitCode) { throw $LastExitCode } +$SetupFile = Test (Join-Path $OutputRootDir "mpv.net-v$VersionName-setup-x64.exe") + +if ($IsBeta) { + $NewSetupFile = Join-Path $OutputRootDir "mpv.net-v$VersionName-beta-setup-x64.exe" + Move-Item $SetupFile $NewSetupFile + $SetupFile = $NewSetupFile +} + +# Release +$Title = 'v' + $VersionName + $BetaString + +if ($BetaString) { + gh release create $Title -t $Title -n $ReleaseNotes --repo $Repo --prerelease $ZipOutputFile64 $ZipOutputFileARM64 $SetupFile +} else { + gh release create $Title -t $Title -n $ReleaseNotes --repo $Repo $ZipOutputFile64 $ZipOutputFileARM64 $SetupFile +} + +if ($LastExitCode) { throw $LastExitCode } diff --git a/src/Tools/update-mpv-and-libmpv.ps1 b/src/Tools/update-mpv-and-libmpv.ps1 deleted file mode 100644 index ce733832..00000000 --- a/src/Tools/update-mpv-and-libmpv.ps1 +++ /dev/null @@ -1,91 +0,0 @@ - -<# - -Updates mpv and libmpv used by mpv.net. -It uses the Path environment variable to find mpv and mpv.net. -Files are downloaded from github.com/zhongfly/mpv-winbuild. -Requires 7zip being installed at 'C:\Program Files\7-Zip\7z.exe'. - -#> - -$Zip7Path = 'C:\Program Files\7-Zip\7z.exe' - -# Stop when the first error occurs -$ErrorActionPreference = 'Stop' - -# Throw exception if file or folder does not exist -function Test($path) { - if (-not (Test-Path $path)) { - throw $path - } - return $path -} - -# Download file to temp dir and return file path -function Download($pattern) { - $api = "https://api.github.com/repos/zhongfly/mpv-winbuild/releases/latest" - $json = Invoke-WebRequest $api -MaximumRedirection 0 -ErrorAction Ignore -UseBasicParsing | ConvertFrom-Json - $filename = ($json.assets | Where-Object { $_.name -Match $pattern }).name - $path = Join-Path $env:TEMP $filename - $link = ($json.assets | Where-Object { $_.name -Match $pattern }).browser_download_url - Invoke-WebRequest -Uri $link -UserAgent "mpv-win-updater" -OutFile $path - return Test $path -} - -function Unpack($archieveFile, $outputRootDir) { - $outputDir = Join-Path $outputRootDir $archieveFile.BaseName - if (Test-Path $outputDir) { Remove-Item $outputDir -Recurse } - $process = Start-Process (Test $Zip7Path) @('x', $archieveFile.FullName, "-o$outputDir") -NoNewWindow -Wait - if ($process.ExitCode) { throw $process.ExitCode } - return Test $outputDir -} - -function UpdateLibmpv($targetFolder) { - if ($targetFolder -eq 'no') { return } - $archiveFile = Get-Item (Download "mpv-dev-x86_64-[0-9]{8}") - $archiveDir = Unpack $archiveFile $env:TEMP - Copy-Item $archiveDir\libmpv-2.dll (Test $targetFolder) -Force - Remove-Item $archiveFile.FullName - Remove-Item $archiveDir -Recurse -} - -function UpdateMpv($targetFolder) { - if ($targetFolder -eq 'no') { return } - $archiveFile = Get-Item (Download "mpv-x86_64-[0-9]{8}") - $archiveDir = Unpack $archiveFile $env:TEMP - Copy-Item "$archiveDir\*" $targetFolder -Force -Recurse - Remove-Item $archiveFile.FullName - Remove-Item $archiveDir -Recurse -} - -# Update mpv - -$MpvLocations = @() + (cmd /c where mpv.exe) - -if ($MpvLocations.Length -gt 0) { - $mpvDir = Split-Path ($MpvLocations[0]) - ''; 'mpv found at:'; $mpvDir - $result = Read-Host 'Update mpv? [y/n]' - - if ($result -eq 'y') { - UpdateMpv $mpvDir - } -} else { - 'mpv location not found.' -} - -# Update libmpv used by mpv.net - -$MpvNetLocations = @() + (cmd /c where mpvnet.exe) - -if ($MpvNetLocations.Length -gt 0) { - $mpvNetDir = Split-Path ($MpvNetLocations[0]) - ''; 'mpv.net found at:'; $mpvNetDir - $result = Read-Host 'Update libmpv? [y/n]' - - if ($result -eq 'y') { - UpdateLibmpv $mpvNetDir - } -} else { - 'mpv.net location not found.' -} diff --git a/src/Tools/update-mpv.ps1 b/src/Tools/update-mpv.ps1 new file mode 100644 index 00000000..9ab70576 --- /dev/null +++ b/src/Tools/update-mpv.ps1 @@ -0,0 +1,104 @@ + +<# + +Updates mpv (x64) and libmpv (x64 , ARM64). + +Files are downloaded from: + x64: github.com/zhongfly/mpv-winbuild + ARM64: github.com/Andarwinux/mpv-winbuild + +Requires 7zip being installed at 'C:\Program Files\7-Zip\7z.exe'. + +Needs 3 positional CLI arguments: + 1. Directory where mpv x64 is located. To skip pass '-'. + 2. Directory where libmpv x64 is located. To skip pass '-'. + 3. Directory where libmpv ARM64 is located. To skip pass '-'. +#> + +$7ZipPath = 'C:\Program Files\7-Zip\7z.exe' + +$MpvDirX64 = $args[0] +$LibmpvDirX64 = $args[1] +$LibmpvDirARM64 = $args[2] + +# Stop when the first error occurs +$ErrorActionPreference = 'Stop' + +# Throw exception if file or folder does not exist +function Test($path) { + if (-not (Test-Path $path)) { + throw $path + } + return $path +} + +# Download file to temp dir and return file path +function Download($apiURL, $pattern) { + $json = Invoke-WebRequest $apiURL -MaximumRedirection 0 -ErrorAction Ignore -UseBasicParsing | ConvertFrom-Json + $filename = ($json.assets | Where-Object { $_.name -Match $pattern }).name + $path = Join-Path $env:TEMP $filename + $link = ($json.assets | Where-Object { $_.name -Match $pattern }).browser_download_url + Invoke-WebRequest -Uri $link -UserAgent "mpv-win-updater" -OutFile $path + return Test $path +} + +# Unpack archive +function Unpack($archieveFile, $outputRootDir) { + $outputDir = Join-Path $outputRootDir $archieveFile.BaseName + if (Test-Path $outputDir) { Remove-Item $outputDir -Recurse } + $process = Start-Process (Test $7ZipPath) @('x', $archieveFile.FullName, "-o$outputDir") -NoNewWindow -Wait + if ($process.ExitCode) { throw $process.ExitCode } + return Test $outputDir +} + +# Update mpv x64 + +if (Test-Path (Join-Path $MpvDirX64 'mpv.exe')) { + $apiURL = "https://api.github.com/repos/zhongfly/mpv-winbuild/releases/latest" + $archiveFile = Get-Item (Download $apiURL "mpv-x86_64-[0-9]{8}") + $archiveDir = Unpack $archiveFile $env:TEMP + Remove-Item "$MpvDirX64\*" -Force -Recurse + Copy-Item "$archiveDir\*" $MpvDirX64 -Force -Recurse + Remove-Item $archiveFile.FullName + Remove-Item $archiveDir -Recurse +} else { + "mpv x64 location not found:`n$MpvDirX64" +} + +# Update libmpv x64 + +if (Test-Path (Join-Path $LibmpvDirX64 'libmpv-2.dll')) { + $apiURL = "https://api.github.com/repos/zhongfly/mpv-winbuild/releases/latest" + $archiveFile = Get-Item (Download $apiURL "mpv-dev-x86_64-[0-9]{8}") + $archiveDir = Unpack $archiveFile $env:TEMP + Copy-Item $archiveDir\libmpv-2.dll $LibmpvDirX64 -Force + Remove-Item $archiveFile.FullName + Remove-Item $archiveDir -Recurse +} else { + "libmpv x64 location not found:`n$LibmpvDirX64" +} + +# Update libmpv ARM64 + +if (Test-Path (Join-Path $LibmpvDirARM64 'libmpv-2.dll')) { + $apiURL = "https://api.github.com/repos/Andarwinux/mpv-winbuild/releases/latest" + $archiveFile = Get-Item (Download $apiURL "mpv-dev-aarch64-[0-9]{8}") + $archiveDir = Unpack $archiveFile $env:TEMP + Copy-Item $archiveDir\libmpv-2.dll $LibmpvDirARM64 -Force + Remove-Item $archiveFile.FullName + Remove-Item $archiveDir -Recurse +} else { + "libmpv ARM64 location not found:`n$LibmpvDirARM64" +} + +if (Test-Path (Join-Path $MpvDirX64 'mpv.exe')) { + Get-Item (Join-Path $MpvDirX64 'mpv.exe') +} + +if (Test-Path (Join-Path $LibmpvDirX64 'libmpv-2.dll')) { + Get-Item (Join-Path $LibmpvDirX64 'libmpv-2.dll') +} + +if (Test-Path (Join-Path $LibmpvDirARM64 'libmpv-2.dll')) { + Get-Item (Join-Path $LibmpvDirARM64 'libmpv-2.dll') +}