Queue Suno WAV candidates with local retry

This commit is contained in:
DESKTOP-KSVGT20\shkim
2026-05-02 00:34:23 +09:00
parent 248f4a21d4
commit 10e25e03a4
2 changed files with 60 additions and 13 deletions
+34 -6
View File
@@ -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