35 lines
1.4 KiB
PowerShell
35 lines
1.4 KiB
PowerShell
# Download vosk-android AAR file
|
|
$voskVersion = "0.3.47"
|
|
$voskUrl = "https://repo1.maven.org/maven2/com/alphacephei/vosk-android/$voskVersion/vosk-android-$voskVersion.aar"
|
|
$libsDir = "fronted_uniapp\uni_modules\xwq-speech-to-text\utssdk\app-android\libs"
|
|
|
|
Write-Host "Downloading vosk-android $voskVersion..." -ForegroundColor Cyan
|
|
|
|
if (-not (Test-Path $libsDir)) {
|
|
New-Item -ItemType Directory -Path $libsDir -Force | Out-Null
|
|
}
|
|
|
|
$outputFile = Join-Path $libsDir "vosk-android-$voskVersion.aar"
|
|
|
|
try {
|
|
$aliyunUrl = "https://maven.aliyun.com/repository/public/com/alphacephei/vosk-android/$voskVersion/vosk-android-$voskVersion.aar"
|
|
|
|
Write-Host "Trying Aliyun mirror..." -ForegroundColor Yellow
|
|
Invoke-WebRequest -Uri $aliyunUrl -OutFile $outputFile -ErrorAction Stop
|
|
Write-Host "Success!" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host "Aliyun failed, trying Maven Central..." -ForegroundColor Yellow
|
|
try {
|
|
Invoke-WebRequest -Uri $voskUrl -OutFile $outputFile -ErrorAction Stop
|
|
Write-Host "Success!" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host "Download failed: $_" -ForegroundColor Red
|
|
Write-Host "Please download manually from: $voskUrl" -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
$sizeMB = [math]::Round((Get-Item $outputFile).Length / 1MB, 2)
|
|
Write-Host "File saved to: $outputFile" -ForegroundColor Green
|
|
Write-Host "File size: $sizeMB MB" -ForegroundColor Green
|