Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error accessing to event info #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions functions/extractAudio.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const storageUtils = require('../utils/storage-utils');
const ffmpegUtils = require('../utils/ffmpeg-utils');
module.exports = (event) => {
console.log(`event.data ${JSON.stringify(event)}`);
return Promise.resolve()
.then(() => {
const videoFile = storageUtils.videoBucket.file(event.data.name);
const videoFile = storageUtils.videoBucket.file(event.name);
console.log('downloading video file 2...');
return storageUtils.downloadFile(videoFile, event.data.name);
return storageUtils.downloadFile(videoFile, event.name);
}).then((fileinfo) => {
//extract audio and transcode to FLAC
return ffmpegUtils.extractAudio(fileinfo);
Expand Down
9 changes: 5 additions & 4 deletions functions/transcribeAudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ const path = require('path');
const storageUtils = require('../utils/storage-utils');
const speechUtils = require('../utils/speech-utils');
module.exports = (event) => {
console.log(`event.data ${JSON.stringify(event.data)}`);
console.log(`event.data ${JSON.stringify(event)}`);
let audioFileNameWithoutExtension;
return Promise.resolve()
.then(() => {
console.log(`event.data.name: ${JSON.stringify(event.data.name)}`);
const audioFile = storageUtils.flacBucket.file(event.data.name);
console.log(`event.data.name: ${JSON.stringify(event.name)}`);
const audioFile = storageUtils.flacBucket.file(event.name);
const audioFilePath = storageUtils.getFilePathFromFile(audioFile);
console.log(`audioFilePath: ${JSON.stringify(audioFilePath)}`);
audioFileNameWithoutExtension = path.parse(audioFilePath).name;
const request = {
"config": {
"enableWordTimeOffsets": true,
"languageCode": "en-US",
"encoding": "FLAC"
"encoding": "FLAC",
"audioChannelCount": 1
},
"audio": {
"uri": audioFilePath
Expand Down