Я пытаюсь отправить голос за кадром, который был записан с помощью Applescript. После завершения записи и сохранения в виде файла этот файл следует отправить в корзину AWS S3.
Я попытался использовать команду curl и отправить файл в корзину S3, но это не сработало. Полученная ошибка не может преобразовать тип файла в текст Unicode. Ошибка, которую я получаю, находится по адресу:
установите theBigCommand в «-X PUT -T» и в кавычки в форме fileName & ¬
activate application "Google Chrome"
tell application "Finder"
set savePath to (the path to the desktop folder as text) & "record.m4a"
tell application "QuickTime Player"
activate
set doku to new audio recording
start doku
delay 4
tell application "VoiceOver" to activate
tell application "Google Chrome" to open location "https://www.google.com"
delay 10
repeat 9 times
tell application "System Events"
delay 13
keystroke tab
end tell
end repeat
stop
close
tell application "VoiceOver" to quit
stop doku
set newDoc to last item of (documents whose name contains "Untitled")
export newDoc in file savePath using settings preset "Audio Only"
set dateFormatted to do shell script "date -R"
set s3Bucket to "auditoolsvoice"
set fileName to newDoc
set relativePath to (" " & s3Bucket & "/Google")
set contentType to "application/octet-stream"
set stringToSign to "PUT " & contentType & " " & dateFormatted & relativePath & " "
set OPTURL to "https://" & s3Bucket & ".s3-us-east-2.amazonaws.com/"
set signatureCommand to "echo -en " & stringToSign & ¬
" | openssl sha1 -hmac -binary | base64"
set signature to do shell script signatureCommand
set theBigCommand to "-X PUT -T " & quoted form of fileName & ¬
" -H 'Host: " & s3Bucket & ".s3-us-east-2.amazonaws.com'" & ¬
" -H 'Date: " & dateFormatted & "'" & ¬
" -H 'Content-Type: " & contentType & "'" & ¬
" --url " & quoted form of OPTURL
display dialog ("curl " & theBigCommand & "")
do shell script ("curl " & theBigCommand & "")
end tell
end tell
Ожидаемый результат: аудиофайл M4A загружен в корзину S3.
Фактический результат: ошибка преобразования имени файла в текст в кодировке Unicode.
Ошибка в этой строке кода:
установите theBigCommand в «-X PUT -T» и в кавычки в форме fileName & ¬
Любая помощь будет с благодарностью!