Queue Suno WAV candidates with local retry
This commit is contained in:
@@ -3,6 +3,8 @@ param(
|
||||
[string]$OutputRoot = "\\VaultOfData\AKAMedia\음악\처리됨",
|
||||
[string]$ArtistName = "SUNO",
|
||||
[string]$FfmpegPath = "",
|
||||
[int]$WavRetrySeconds = 300,
|
||||
[int]$WavRetryIntervalSeconds = 8,
|
||||
[switch]$KeepWorkFiles,
|
||||
[switch]$Force
|
||||
)
|
||||
@@ -233,6 +235,37 @@ function Invoke-Download {
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-DownloadWithRetry {
|
||||
param(
|
||||
[string[]]$Urls,
|
||||
[string]$OutFile,
|
||||
[int]$RetrySeconds,
|
||||
[int]$IntervalSeconds
|
||||
)
|
||||
|
||||
$candidates = @($Urls | Where-Object { $_ } | Select-Object -Unique)
|
||||
if (-not $candidates.Count) { return $false }
|
||||
|
||||
$deadline = (Get-Date).AddSeconds([Math]::Max(1, $RetrySeconds))
|
||||
$attempt = 0
|
||||
do {
|
||||
$attempt++
|
||||
foreach ($candidate in $candidates) {
|
||||
Write-Host "WAV 후보 시도 #$attempt`: $candidate"
|
||||
if (Invoke-Download $candidate $OutFile) {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
if ((Get-Date) -lt $deadline) {
|
||||
Write-Host "WAV 아직 준비 안 됨. $IntervalSeconds초 후 재시도..."
|
||||
Start-Sleep -Seconds ([Math]::Max(1, $IntervalSeconds))
|
||||
}
|
||||
} while ((Get-Date) -lt $deadline)
|
||||
|
||||
return $false
|
||||
}
|
||||
|
||||
function Add-MetadataArg {
|
||||
param(
|
||||
[System.Collections.Generic.List[string]]$Args,
|
||||
@@ -392,12 +425,7 @@ foreach ($track in $tracks) {
|
||||
continue
|
||||
}
|
||||
|
||||
$audioOk = $false
|
||||
foreach ($candidate in $wavCandidates) {
|
||||
Write-Host "WAV 후보 시도: $candidate"
|
||||
$audioOk = Invoke-Download $candidate $inputAudio
|
||||
if ($audioOk) { break }
|
||||
}
|
||||
$audioOk = Invoke-DownloadWithRetry $wavCandidates $inputAudio $WavRetrySeconds $WavRetryIntervalSeconds
|
||||
if (-not $audioOk) {
|
||||
Write-Warning "WAV를 받지 못해서 건너뜀: $title"
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user