This commit is contained in:
Isaac Shoebottom 2023-11-21 05:33:03 -04:00
parent f4386b1785
commit 4dfbef6470
2 changed files with 26 additions and 10 deletions

4
hq2cd-ps1/TODO.txt Normal file
View File

@ -0,0 +1,4 @@
Need to normalize file names on server, no stupid "" and "'" shenanigans
https://apps.timwhitlock.info/unicode/inspect?s=%E2%80%99%27
either that or get child item to not print out something different than what is actually there

View File

@ -1,9 +1,10 @@
# Delete output folder if it exists
if (Test-Path -Path "Output") {
Remove-Item -Path "Output" -Recurse -Force
}
# Read each line in the file
$filePaths = Get-Content -Path $args[0]
$files = @()
foreach ($filePath in $filePaths) {
$files += Get-Item -Path "$($filePath)" -Force
}
# Save to output folder "Output"
$destination = "Output"
@ -19,20 +20,31 @@ foreach ($file in $files) {
}
#>
$filePaths | ForEach-Object -Parallel {
# Stupid apostrophe in the file name
# Intentional, as this is how Picard names files with apostrophes
$path = $_.Replace("'", "")
$file = Get-Item -LiteralPath $path
$destination = "Output"
$prefix = "Z:\Music-HQ\"
$files | ForEach-Object -Parallel {
$oldLocation = $_.FullName
$oldLocation = $file.FullName
# Remove the prefix
$newLocation = $oldLocation.Substring($prefix.Length)
# Remove the name of the file for folder creation
$newLocation = $newLocation.Substring(0, $newLocation.IndexOf($_.Name))
$newLocation = $newLocation.Substring(0, $newLocation.IndexOf($file.Name))
# Create the folder if it doesn't exist
if (-not (Test-Path -Path $destination\$newLocation)) {
New-Item -Path $destination\$newLocation -ItemType Directory
}
$destinationPath = $destination + "\" + $newLocation + $file.Name
$destinationPath = $destination + "\" + $newLocation + $_.Name
Write-Host $destinationPath
# ffmpeg -i $_.FullName -c:a flac -sample_fmt s16 -ar 44100 $destinationPath
ffmpeg -i $_.FullName -c:a flac -sample_fmt s16 -ar 44100 $destinationPath
}