in source/lambda/transcribeaudio/transcribeaudio.js [57:104]
async function computeParameters(event) {
var inputKey = decodeURIComponent(
event.Records[0].s3.object.key.replace(/\+/g, " ")
);
var audioFile = path.basename(inputKey);
var videoId = audioFile.substring(
audioFile.lastIndexOf("_") + 1,
audioFile.length - 4
);
console.log("[INFO] videoId: " + videoId);
var inputBucket = event.Records[0].s3.bucket.name;
var mediaFileUrl =
"https://s3-" +
process.env.REGION +
".amazonaws.com/" +
inputBucket +
"/" +
inputKey;
var videoInfo = await getVideo(videoId);
var params = {
inputKey: inputKey,
audioFile: audioFile,
videoId: videoId,
inputBucket: inputBucket,
outputBucket: process.env.TRANSCRIBE_BUCKET,
mediaFileUrl: mediaFileUrl,
region: process.env.REGION,
transcribeLanguage: videoInfo.language,
vocabularyName: process.env.VOCABULARY_NAME,
vocabularyExists: false,
dynamoVideoTable: process.env.DYNAMO_VIDEO_TABLE,
status: "PROCESSING",
statusText: "Transcribing audio",
};
var vocabularies = await getVocabularies(null);
if (vocabularies.length > 0) {
params.vocabularyExists = true;
}
console.log("[INFO] computed initial parameters: %j", params);
return params;
}