Some fixes
This commit is contained in:
parent
e1debf99fd
commit
f4386b1785
@ -1,10 +1,8 @@
|
||||
# Output to a flat directory as I am going to use picard to rename the files after the fact
|
||||
|
||||
# Read each line in the file
|
||||
$filePaths = Get-Content -Path $args[0]
|
||||
$files = @()
|
||||
foreach ($filePath in $filePaths) {
|
||||
$files += Get-Item -Path $filePath
|
||||
$files += Get-Item -Path "$($filePath)" -Force
|
||||
}
|
||||
|
||||
# Save to output folder "Output"
|
||||
@ -20,7 +18,21 @@ foreach ($file in $files) {
|
||||
ffmpeg -i $file.FullName -c:a flac -sample_fmt s16 -ar 44100 $destinationPath
|
||||
}
|
||||
#>
|
||||
|
||||
$prefix = "Z:\Music-HQ\"
|
||||
$files | ForEach-Object -Parallel {
|
||||
$destinationPath = $destination + "\" + $_.Name
|
||||
ffmpeg -i $_.FullName -c:a flac -sample_fmt s16 -ar 44100 $destinationPath
|
||||
$oldLocation = $_.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))
|
||||
|
||||
# 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 + $_.Name
|
||||
Write-Host $destinationPath
|
||||
# ffmpeg -i $_.FullName -c:a flac -sample_fmt s16 -ar 44100 $destinationPath
|
||||
}
|
@ -3,12 +3,10 @@
|
||||
# Get all files with the .flac extension
|
||||
$files = Get-ChildItem -Path . -Filter *.flac -Recurse
|
||||
|
||||
Write-Host "Found" $files.Count "files"
|
||||
# Write-Host "Found" $files.Count "files"
|
||||
|
||||
# For each file, run ffprobe with json ouptut, and include it in a new list if it has a sample rate above 44100, and a bit depth above 16
|
||||
|
||||
$hq = @()
|
||||
|
||||
<# This is the old way, use the new way below using -Parallel
|
||||
foreach ($file in $files) {
|
||||
$ffprobe = ffprobe -v quiet -print_format json -show_format -show_streams $file.FullName
|
||||
@ -21,6 +19,8 @@ foreach ($file in $files) {
|
||||
}
|
||||
}
|
||||
#>
|
||||
|
||||
$hq = @()
|
||||
$files | ForEach-Object -Parallel {
|
||||
$ffprobe = ffprobe -v quiet -print_format json -show_format -show_streams $_.FullName
|
||||
$ffprobe = $ffprobe | ConvertFrom-Json
|
||||
@ -32,7 +32,9 @@ $files | ForEach-Object -Parallel {
|
||||
}
|
||||
}
|
||||
|
||||
# Doesn't work, so use input redirection instead "script.ps1 *> input.txt" because of read host, or "(pwsh -c script.ps1) > hq.txt"
|
||||
# Save each file in hq to a text file with its full path
|
||||
foreach ($file in $hq) {
|
||||
$file.FullName | Out-File -FilePath hq.txt -Append
|
||||
}
|
||||
# New-Item -Path . -Name hq.txt -ItemType File -Quiet
|
||||
# foreach ($file in $hq) {
|
||||
# $file.FullName | Out-File -FilePath hq.txt -Append
|
||||
# }
|
Loading…
Reference in New Issue
Block a user