]> Arthur Taft Gitweb - yt-dlp-wrapper.git/commitdiff
Add windows auto updating and update gitignore
authorArthur Taft <[email protected]>
Tue, 27 May 2025 20:51:25 +0000 (14:51 -0600)
committerArthur Taft <[email protected]>
Tue, 27 May 2025 20:51:25 +0000 (14:51 -0600)
.gitignore [new file with mode: 0644]
windows/bin/ffmpeg.exe
windows/bin/yt-dlp.exe
windows/sig/SHA2-512SUMS [new file with mode: 0644]
windows/sig/checksums.sha256 [new file with mode: 0644]
windows/yt-dlp-wrapper.ps1

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..175161d
--- /dev/null
@@ -0,0 +1,6 @@
+windows/audio/
+windows/video/
+windows/work/
+
+linux/audio/
+linux/video/
\ No newline at end of file
index 35dd63d1c111190fa639dca9b0c0d83dd32630ec..8c61b92276a557160ec177ac19efd20c2757073f 100644 (file)
Binary files a/windows/bin/ffmpeg.exe and b/windows/bin/ffmpeg.exe differ
index b4c81379a75f1220606dcad7489a792eda97ce58..94b1bb75d8dac916f8cc02ebf473163aa95174a8 100644 (file)
Binary files a/windows/bin/yt-dlp.exe and b/windows/bin/yt-dlp.exe differ
diff --git a/windows/sig/SHA2-512SUMS b/windows/sig/SHA2-512SUMS
new file mode 100644 (file)
index 0000000..f51cd87
--- /dev/null
@@ -0,0 +1 @@
+0fa23037b01c04990c8cdf97f0121424dc5ae8525be908f8299a7b8558d26047cc41c52c83cc7ba5a0151b53fe8cbff1edbb1fdcdf683800ab56fde4e2d671c7
\ No newline at end of file
diff --git a/windows/sig/checksums.sha256 b/windows/sig/checksums.sha256
new file mode 100644 (file)
index 0000000..1548054
--- /dev/null
@@ -0,0 +1 @@
+2aed280d0175c55292bfedb54680cf00e8f36875cd9399c46607116924413f58
\ No newline at end of file
index e0a96fcc6ebb52d675a0b6dd787ce8667c3c01e3..515f4fc02b48ff16e867d5d4de06f89866b2d600 100644 (file)
@@ -1,27 +1,89 @@
 # Set Variables
 $current_dir = Get-Location
 $exe_location = Join-Path -Path $current_dir -ChildPath '\bin\yt-dlp.exe'
 # Set Variables
 $current_dir = Get-Location
 $exe_location = Join-Path -Path $current_dir -ChildPath '\bin\yt-dlp.exe'
+$ffmpeg_location = Join-Path -Path $current_dir -ChildPath '\bin\ffmpeg.exe'
 $audio_dir = Join-Path -Path $current_dir -ChildPath '\audio'
 $video_dir = Join-Path -Path $current_dir -ChildPath '\video'
 $audio_dir = Join-Path -Path $current_dir -ChildPath '\audio'
 $video_dir = Join-Path -Path $current_dir -ChildPath '\video'
+$work_dir = Join-Path -Path $current_dir -ChildPath '\work'
+$ffmpeg_zip_work_location = Join-Path -Path $work_dir -ChildPath 'ffmpeg.zip'
+$ffmpeg_work_location = Join-Path -Path $work_dir -ChildPath '\ffmpeg-master-latest-win64-gpl-shared\bin\ffmpeg.exe'
 $test_audio_dir = Test-Path -Path $audio_dir
 $test_video_dir = Test-Path -Path $video_dir
 $val = 0
 $url = ""
 $test_audio_dir = Test-Path -Path $audio_dir
 $test_video_dir = Test-Path -Path $video_dir
 $val = 0
 $url = ""
+$yt_sig_location = Join-Path -Path $current_dir -ChildPath '\sig\SHA2-512SUMS'
+$yt_current_sig = certutil.exe -hashfile $exe_location SHA512
+$ffmpeg_sig_location = Join-Path -Path $current_dir -ChildPath '\sig\checksums.sha256'
+$ffmpeg_current_sig = certutil.exe -hashfile $ffmpeg_location SHA256
+$yt_sig_eq_check = Select-String -Path $yt_sig_location -Pattern $yt_current_sig -SimpleMatch -Quiet
+$ffmpeg_sig_eq_check = Select-String -Path $ffmpeg_sig_location -Pattern $ffmpeg_current_sig -SimpleMatch -Quiet
 
 
-# Remove old executable
-Remove-Item $exe_location
+# Remove old ffmpeg signature
+Remove-Item $ffmpeg_sig_location
 
 
-# Download new executable
-Invoke-WebRequest https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe -OutFile $exe_location
+# Remove old yt-dlp signature 
+Remove-Item $yt_sig_location
+
+Write-Output "Updating ffmpeg signature..."
+# Download new ffmpeg signature
+Invoke-WebRequest https://github.com/arthur-taft/ffmpeg-latest-signatures/releases/latest/download/checksums.sha256 -OutFile $ffmpeg_sig_location
+Write-Output "Done!"
+
+Write-Output "Updating yt-dlp signature..."
+# Download new yt-dlp signature
+Invoke-WebRequest https://github.com/arthur-taft/yt-dlp-signatures/releases/latest/download/SHA2-512SUMS -OutFile $yt_sig_location
+Write-Output "Done!"
+
+if($yt_sig_eq_check -ne $true) {
+    Write-Output "Old version of yt-dlp found, updating now..."
+
+    # Remove old executable
+    Remove-Item $exe_location
+
+    # Download new executable
+    Invoke-WebRequest https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe -OutFile $exe_location
+
+    Write-Output "Done!"
+}
+
+if($ffmpeg_sig_eq_check -ne $true) {
+    Write-Output "Old version ffmpeg found, updating now..."
+
+    # Remove old executable
+    Remove-Item $ffmpeg_location
+
+    # Create work directory to extract archive with new executable
+    New-Item -Path $current_dir -Name "work" -ItemType "directory"
+
+    # Download new archive
+    Invoke-WebRequest https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip -OutFile $ffmpeg_zip_work_location
+
+    # Extract archive to work directory
+    Expand-Archive -Path $ffmpeg_zip_work_location -DestinationPath $work_dir
+
+    # Move new executable to correct location
+    Move-Item -Path $ffmpeg_work_location -Destination $ffmpeg_location
+
+    # Remove work directory
+    Remove-Item -Recurse -Force $work_dir
+
+    Write-Output "Done!"
+}
 
 # Check if audio output directory exists, if not, create it
 if($test_audio_dir -eq $false) {
 
 # Check if audio output directory exists, if not, create it
 if($test_audio_dir -eq $false) {
+    Write-Output "Audio directory not found!"
+    Write-Output "Creating now..."
     New-Item -Path $current_dir -Name "audio" -ItemType "directory"
     New-Item -Path $current_dir -Name "audio" -ItemType "directory"
+    Write-Output "Done!"
 }
 
 # Check if video output directory exists, if not, create it
 if($test_video_dir -eq $false) {
 }
 
 # Check if video output directory exists, if not, create it
 if($test_video_dir -eq $false) {
+    Write-Output "Video directory not found!"
+    Write-Output "Creating now..."
     New-Item -Path $current_dir -Name "video" -ItemType "directory"
     New-Item -Path $current_dir -Name "video" -ItemType "directory"
+    Write-Output "Done!"
 }
 
 
 }