baksatibi

Untitled

Jun 22nd, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $OUT_DIR=".\flac2txt"
  2. $RATE=44100
  3.  
  4. if(!(Test-Path -Path $OUT_DIR))
  5. {
  6.     New-Item -Path $OUT_DIR -ItemType "directory"|Out-Null
  7. }
  8. elseif(!(Test-Path -Path $OUT_DIR -PathType Container))
  9. {
  10.     throw "$OUT_DIR is not a directory"
  11. }
  12.  
  13. foreach($file in Get-ChildItem -Path "wav2flac" -Filter "*flac")
  14. {
  15.     $TEXTFILE="$($file.BaseName).txt"
  16.     Write-Output " Calling for $($file.Name) Google..."
  17.     Invoke-WebRequest -Body ($file|Get-Content) -OutFile (Join-Path -Path $OUT_DIR -ChildPath $TEXTFILE) -ContentType "audio/x-flac; rate=$RATE" -Method Post -Uri "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=hu-HU"
  18. }
Advertisement
Add Comment
Please, Sign In to add comment