Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
stax76 committed Jan 4, 2024
1 parent edcd8be commit 304fe58
Show file tree
Hide file tree
Showing 9 changed files with 799 additions and 520 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Download libmpv # In principle, only update this binary file when significant feature changes occur in mpv/mpv.net
shell: msys2 {0}
run: |
wget -nv -O libmpv.7z https://downloads.sourceforge.net/mpv-player-windows/mpv-dev-x86_64-20231203-git-f551a9d.7z
wget -nv -O libmpv.7z https://github.com/zhongfly/mpv-winbuild/releases/download/2024-01-02-ab5b250/mpv-dev-x86_64-20240102-git-ab5b250.7z
7z x -y libmpv.7z -olibmpv
cp -f libmpv/libmpv-2.dll src/MpvNet.Windows/bin/Debug/ || true
- name: Download MediaInfo
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

# v7.0.0.7 Beta (2023-??-??)

- GitHub Auto/Action/Workflow builds use a newer libmpv build.
- German translation updated. Thanks to our translation team!
- New PowerShell script etc/update-mpv-and-libmpv.ps1 to update mpv and libmpv.
- Context menu supports audio device selection (Audio > Audio Device)
- New option `remember-audio-device` to save and restore the audio device chosen in the context menu.
- New zhongfly libmpv build.


# v7.0.0.6 Beta (2023-01-02)
Expand Down
3 changes: 3 additions & 0 deletions docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ mpv.net commands are used when mpv commands don't exist or lack a feature.
### add-to-path
Adds mpv.net to the Path environment variable.

### remove-from-path
Removes mpv.net from the Path environment variable.

### edit-conf-file [mpv.conf|input.conf]
Opens mpv.conf or input.conf in a text editor.

Expand Down
73 changes: 73 additions & 0 deletions etc/update-mpv-and-libmpv.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

<#
This script updates mpv and libmpv using github.com/zhongfly/mpv-winbuild
Two positoninal command line arguments need to be passed into the script:
1. The directory containing libmpv to be updated.
2. The directory containing mpv to be updated.
To skip one of both pass 'no' instead of the path.
Requires 7zip being installed at 'C:\Program Files\7-Zip\7z.exe'
#>

$zip7Path = 'C:\Program Files\7-Zip\7z.exe'
$ScriptArgs = $args

# 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 = $ScriptArgs[0]
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 = $ScriptArgs[1]
if ($targetFolder -eq 'no') { return }
$archiveFile = Get-Item (Download "mpv-x86_64-[0-9]{8}")
$archiveDir = Unpack $archiveFile $env:TEMP
Copy-Item "$archiveDir\mpv\*" $targetFolder -Force -Recurse
Remove-Item $archiveFile.FullName
Remove-Item $archiveDir -Recurse
}

UpdateLibmpv
UpdateMpv

Write-Host 'Script finished successfully' -ForegroundColor Green
Loading

0 comments on commit 304fe58

Please sign in to comment.