Compare commits
2 Commits
4e798818d1
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 586e8746be | |||
| 9bfedfafc5 |
@@ -1,2 +1,9 @@
|
|||||||
1. recursive verify error: `FAILED open or read`
|
1. recursive verify error: `FAILED open or read` RIGHT NOW GENERATES RELATIVE PATH/FILENAME IN CHECKSUMS FILES IN SUBDIRS, SHOULD JUST BE FOR THE FILES IN DAT DIR (for linux compatability)
|
||||||
2. recursive progress set to count total number of files recursively first for progress bar
|
2. recursive progress set to count total number of files recursively first for progress bar.
|
||||||
|
3. paralell processing
|
||||||
|
4. Princess Pi ascii art magenta
|
||||||
|
5. princess pi bubble text ascii art blue
|
||||||
|
6. script for full top-to-bottom testing
|
||||||
|
7. BASH linux version
|
||||||
|
8. more hashing algos?
|
||||||
|
9. multi-algo paralell workin? like multiple -a params?
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
param (
|
||||||
|
[Parameter(Mandatory = $true, Position = 0)]
|
||||||
|
[string]$Ext1,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true, Position = 1)]
|
||||||
|
[string]$Ext2,
|
||||||
|
|
||||||
|
[int]$Jobs = 4 # Number of simultaneous conversions
|
||||||
|
)
|
||||||
|
|
||||||
|
$sourceExt = $Ext1.TrimStart('.')
|
||||||
|
$targetExt = $Ext2.TrimStart('.')
|
||||||
|
$audioExts = @('opus', 'ogg', 'flac', 'wav')
|
||||||
|
|
||||||
|
$files = Get-ChildItem -File -Recurse -Filter "*.$sourceExt"
|
||||||
|
|
||||||
|
if ($files.Count -eq 0) {
|
||||||
|
Write-Host "No files matching *.$sourceExt found." -ForegroundColor Yellow
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Starting conversion using $Jobs parallel jobs..." -ForegroundColor Green
|
||||||
|
|
||||||
|
$files | ForEach-Object -Parallel {
|
||||||
|
$file = $_
|
||||||
|
$targetExt = $using:targetExt
|
||||||
|
$audioExts = $using:audioExts
|
||||||
|
|
||||||
|
$outputPath = Join-Path -Path $file.DirectoryName -ChildPath "$($file.BaseName).$targetExt"
|
||||||
|
$relativePath = Resolve-Path -Path $file.FullName -Relative
|
||||||
|
|
||||||
|
Write-Host "Processing: $relativePath" -ForegroundColor Cyan
|
||||||
|
|
||||||
|
if ($audioExts -contains $targetExt.ToLower()) {
|
||||||
|
ffmpeg -y -i $file.FullName -c:a libopus -b:a 128k -vbr on $outputPath 2>$null
|
||||||
|
} else {
|
||||||
|
# -preset 8 drastically speeds up SVT-AV1 while maintaining high quality
|
||||||
|
ffmpeg -y -i $file.FullName -c:v libsvtav1 -crf 26 -preset 8 -c:a libopus -b:a 128k $outputPath 2>$null
|
||||||
|
}
|
||||||
|
} -ThrottleLimit $Jobs
|
||||||
|
|
||||||
|
Write-Host "Finished processing $($files.Count) file(s)." -ForegroundColor Green
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
# Step 1: Recursively delete all existing .sha256 files
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
Write-Host "Deleting existing .sha256 files recursively..." -ForegroundColor Yellow
|
||||||
|
Get-ChildItem -Path . -Recurse -Filter "*.sha256" -File | Remove-Item -Force
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
# Step 2: Run checksums in current directory and every subdirectory
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
Write-Host "Generating checksums in each subfolder..." -ForegroundColor Cyan
|
||||||
|
|
||||||
|
# Gather current working directory and all child directories
|
||||||
|
$allDirs = @((Get-Item .).FullName) + (Get-ChildItem -Path . -Recurse -Directory | Select-Object -ExpandProperty FullName)
|
||||||
|
|
||||||
|
foreach ($dir in $allDirs) {
|
||||||
|
Push-Location $dir
|
||||||
|
try {
|
||||||
|
Write-Host "Updating checksums in: $dir" -ForegroundColor Gray
|
||||||
|
checksum * -o
|
||||||
|
} finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
# Step 3: Recursively verify checksums in each directory
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
Write-Host "Verifying checksums in each subfolder..." -ForegroundColor Cyan
|
||||||
|
|
||||||
|
foreach ($dir in $allDirs) {
|
||||||
|
Push-Location $dir
|
||||||
|
try {
|
||||||
|
if (Test-Path "checksums.sha256") {
|
||||||
|
Write-Host "Verifying: $dir" -ForegroundColor Gray
|
||||||
|
checksum -c checksums.sha256
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "All conversions, checksum creations, and verifications completed successfully." -ForegroundColor Green
|
||||||
Reference in New Issue
Block a user