Skip to content

Commit 039e252

Browse files
committed
updated autoEditAPI to have db save function to contain transcription generator so that metadata callback doesn't enter race condition with save
1 parent 31ba810 commit 039e252

File tree

11 files changed

+152
-140
lines changed

11 files changed

+152
-140
lines changed

appdmg.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"title": "autoEdit2_installer",
33
"icon": "nw.icns",
4-
"background-color": "#d3d3d3",
4+
"background": "background.png",
55
"icon-size": 80,
66
"contents": [
7-
{ "x": 448, "y": 220, "type": "link", "path": "/Applications" },
8-
{ "x": 192, "y": 220, "type": "file", "path":"build/autoEdit2/osx64/autoEdit2.app" }
7+
{ "x": 448, "y": 350, "type": "link", "path": "/Applications" },
8+
{ "x": 192, "y": 350, "type": "file", "path":"build/autoEdit2/osx64/autoEdit2.app" }
99
]
1010
}

background.png

14.8 KB
Loading

deploy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var nw = new NwBuilder({
4242
files: ['./frontEnd/**','./interactive_transcription_generator/**','./node_modules/**','./config.js','./package.json' ],
4343
// platforms: ['osx32', 'osx64', 'win32', 'win64', 'linux32', 'linux64']
4444
//for now only osx64 as need to recompile ffmpeg for other versions.
45-
platforms: ['osx64','win64'],
45+
platforms: ['osx64'],
4646
//https://github.com/nwjs/nw-builder#optionsmacicns
4747
macIcns: "./nw.icns",
4848
// MAC ONLY: Pass a string containing the path to your own plist file. If a string isn't passed, a plist file will be generated from your package.json. Pass an object to overwrite or add properties to the generated plist file.

docs/_layouts/landing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ <h3>As featured on</h3>
234234
<div class="col-lg-7 text-center">
235235
<a href="https://www.journalism.co.uk/news/tool-for-journalists-autoedit-to-edit-videos-quicker-using-transcriptions/s2/a684359/" target="_blank">
236236
<img src="{{ site.baseurl }}/img/press/jcu_logo.png">
237-
</a>
237+
</a>
238238
</div>
239239
</div>
240240
</div>

docs/_posts/tutorials/components.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ As well as some apps that were made either along side or before that influenced
1010
- EDL Composer
1111
- Srt Composer
1212
- Date now
13-
- Transcriber (IBM Watson STT)
13+
- Transcriber
14+
- (IBM Watson STT)
15+
- Gentle STT
1416
- Metadata Reader
1517
- HTML5 Webm Video converter
1618

@@ -19,9 +21,10 @@ As well as some apps that were made either along side or before that influenced
1921

2022
- [srt_parser_composer](https://github.com/pietrop/srtParserComposer) [on npm](https://www.npmjs.com/package/srt_parser_composer)
2123
- HTML5 Ogg Video converter
22-
- Captions burner
23-
- Twitter video api export
24-
- Video trimmer
24+
- [Captions burner](https://voxmedia.github.io/captions_burner/)
25+
- [Twitter video api export](https://github.com/pietrop/quickQuoteNode/tree/master/lib/interactive_video_components/export/twitter_video)
26+
- [Video trimmer](https://github.com/pietrop/quickQuoteNode/blob/master/lib/interactive_video_components/export/twitter_video/trim_video.js)
27+
- [CMU sphinx `offline_speech_to_text`](https://github.com/OpenNewsLabs/offline_speech_to_text)
2528

2629

2730
### Related proejcts

frontEnd/autoEdit2API.js

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -62,84 +62,84 @@ autoEdit2API.create = function(model, success, error){
6262
model.set(transcription);
6363
//returning saved transcription callback
6464
success(model);
65-
});
66-
67-
//setting up media folders for media and tmp media on local file system, user libary application support folder
68-
var tmpMediaFolder = window.config.dataPath+"/tmp_media";
69-
var mediaFolder = window.config.dataPath+"/media";
70-
//if media folder does not exists create it
71-
if (!fs.existsSync(tmpMediaFolder)){
72-
console.log("tmpMediaFolder folder not present, creating tmpMediaFolder folder");
73-
fs.mkdirSync(tmpMediaFolder);
74-
}else{
75-
// do nothing, build folder was already there
76-
console.log("tmpMediaFolder folder was already present");
77-
}
78-
//if temp media folder does not exists create it
79-
if (!fs.existsSync(mediaFolder)){
80-
console.log("mediaFolder folder not present, creating mediaFolder folder");
81-
fs.mkdirSync(mediaFolder);
82-
}else{
83-
// do nothing, build folder was already there
84-
console.log("mediaFolder folder was already present");
85-
}
65+
66+
//setting up media folders for media and tmp media on local file system, user libary application support folder
67+
var tmpMediaFolder = window.config.dataPath+"/tmp_media";
68+
var mediaFolder = window.config.dataPath+"/media";
69+
//if media folder does not exists create it
70+
if (!fs.existsSync(tmpMediaFolder)){
71+
console.log("tmpMediaFolder folder not present, creating tmpMediaFolder folder");
72+
fs.mkdirSync(tmpMediaFolder);
73+
}else{
74+
// do nothing, build folder was already there
75+
console.log("tmpMediaFolder folder was already present");
76+
}
77+
//if temp media folder does not exists create it
78+
if (!fs.existsSync(mediaFolder)){
79+
console.log("mediaFolder folder not present, creating mediaFolder folder");
80+
fs.mkdirSync(mediaFolder);
81+
}else{
82+
// do nothing, build folder was already there
83+
console.log("mediaFolder folder was already present");
84+
}
8685

87-
// using interactive_transcription_generator to generate metadata,
88-
// transcription json
89-
// webm video preview
90-
transcription_generate({
91-
id: transcription._id,
92-
videoUrl: newElement.videoUrl,
93-
title: newElement.title,
94-
description: newElement.description,
95-
//TODO: this is hardcoded, and this variable is not used, fix me!
96-
// tmpWorkFolder:"/",
97-
// destFolder:"/media",
98-
tmpWorkFolder: tmpMediaFolder,
99-
destFolder: mediaFolder,
100-
keys: global.keys,
101-
languageModel: newElement.languageModel,
102-
sttEngine: newElement.sttEngine,
103-
cbMetadata:function(respM){
104-
//update current transcription with metadata data
105-
Transcription.findOne({ _id: respM.id }, function (err, trs) {
106-
console.info("got metadata for transcription: "+transcription._id);
107-
trs.metadata = respM;
108-
//saving current transcription
109-
trs.save(function(err) {
86+
// using interactive_transcription_generator to generate metadata,
87+
// transcription json
88+
// webm video preview
89+
transcription_generate({
90+
id: transcription._id,
91+
videoUrl: newElement.videoUrl,
92+
title: newElement.title,
93+
description: newElement.description,
94+
//TODO: this is hardcoded, and this variable is not used, fix me!
95+
// tmpWorkFolder:"/",
96+
// destFolder:"/media",
97+
tmpWorkFolder: tmpMediaFolder,
98+
destFolder: mediaFolder,
99+
keys: global.keys,
100+
languageModel: newElement.languageModel,
101+
sttEngine: newElement.sttEngine,
102+
cbMetadata:function(respM){
103+
//update current transcription with metadata data
104+
Transcription.findOne({ _id: respM.id }, function (err, trs) {
105+
console.info("got metadata for transcription: "+transcription._id);
106+
trs.metadata = respM;
107+
//saving current transcription
108+
trs.save(function(err) {
110109

111-
// app.trigger('updateTranscription:'+trs._id);
110+
// app.trigger('updateTranscription:'+trs._id);
111+
});
112112
});
113-
});
114-
},
115-
cbTranscription: function(resp){
116-
//updating current transcription with transcription json.
117-
Transcription.findOne({ _id: resp.id }, function (err, trs) {
118-
console.info("got transcription json for transcription: "+ trs._id);
119-
//updating transcription attributes with result
120-
trs.audioFile = resp.audioFile;
121-
trs.processedAudio = resp.processedAudio;
122-
trs.text = resp.text;
123-
trs.status = resp.status;
124-
//saving current transcription
125-
trs.save(function(err) {
126-
// app.trigger('updateTranscription:'+trs._id);
113+
},
114+
cbTranscription: function(resp){
115+
//updating current transcription with transcription json.
116+
Transcription.findOne({ _id: resp.id }, function (err, trs) {
117+
console.info("got transcription json for transcription: "+ trs._id);
118+
//updating transcription attributes with result
119+
trs.audioFile = resp.audioFile;
120+
trs.processedAudio = resp.processedAudio;
121+
trs.text = resp.text;
122+
trs.status = resp.status;
123+
//saving current transcription
124+
trs.save(function(err) {
125+
// app.trigger('updateTranscription:'+trs._id);
126+
});
127127
});
128-
});
129-
},
130-
cbVideo: function(resp){
131-
//updating current transcription with webm html5 video preview.
132-
Transcription.findOne({ _id: resp.id}, function (err, trs) {
133-
console.info("got video webm back for transcription: "+ trs._id);
134-
//updating transcription attributes with result
135-
trs.videoOgg = resp.videoOgg;
136-
trs.processedVideo = resp.processedVideo;
137-
//saving current transcription
138-
trs.save(function(err) {
139-
// app.trigger('updateTranscription:'+trs._id);
128+
},
129+
cbVideo: function(resp){
130+
//updating current transcription with webm html5 video preview.
131+
Transcription.findOne({ _id: resp.id}, function (err, trs) {
132+
console.info("got video webm back for transcription: "+ trs._id);
133+
//updating transcription attributes with result
134+
trs.videoOgg = resp.videoOgg;
135+
trs.processedVideo = resp.processedVideo;
136+
//saving current transcription
137+
trs.save(function(err) {
138+
// app.trigger('updateTranscription:'+trs._id);
139+
});
140140
});
141-
});
142-
}
141+
}
142+
});
143143
});
144144
}
145145
}

frontEnd/js/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,6 @@ $(document).ready(function(){
8080
Backbone.history.start();
8181
app.transcriptionRouter = new TranscriptionRouter();
8282
//TODO: not sure if this is the right thing to do
83+
// app.transcriptionRouter.naviate("home",{trigger: true});
8384
window.location = "index.html#transcriptions";
8485
})

frontEnd/js/views/transcription_index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ app.TranscriptionListElement = Backbone.View.extend({
7676
if (r == true) {
7777
this.model.destroy({success: function(model, response) {
7878
// app.transcriptionRouter.transcriptionsList.fetch({reset: true});
79-
// Backbone.history.navigate("transcriptions", {trigger:true});
79+
Backbone.history.navigate("transcriptions", {trigger:true});
8080
}})
8181
} else {
8282
alert("Transcription was not deleted")

interactive_transcription_generator/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ var generate = function(config) {
152152
callback: function(respMetadata){
153153
console.info("---> read metadata: "+videoFile);
154154
//callback for metadata result
155+
console.info("inside interactive_transcription_generator");
156+
console.warn(respMetadata);
155157
if(config.cbMetadata){
156158
config.cbMetadata(respMetadata);
157159
}

interactive_transcription_generator/video_metadata_reader/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@ function readVideoMetadataForEDL(config){
137137
}
138138

139139
//returning metadata EDL info
140-
if(callback){callback(video)}else{ return video };
140+
if(callback){
141+
console.info("inside metada module");
142+
console.warn(video);
143+
callback(video);
144+
}else{
145+
return video
146+
};
141147
});
142148
}
143149

package.json

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
{
2-
"name": "autoEdit2",
3-
"version": "1.0.3",
4-
"description": "Text based video editing app",
5-
"main": "frontEnd/index.html",
6-
"chromium-args": "--mixed-context",
7-
"dom_storage_quota": 5,
8-
"window": {
9-
"show": true,
10-
"frame": true,
11-
"toolbar": true,
12-
"always_on_top": false,
13-
"fullscreen": false,
14-
"show_in_taskbar": true,
15-
"transparent": false,
16-
"icon": "nw.icns",
17-
"width": 800,
18-
"height": 670,
19-
"position": "mouse",
20-
"min_width": 770,
21-
"max_width": 1300,
22-
"min_height": 500
23-
},
24-
"scripts": {
25-
"test": "jasmine",
26-
"start": "nw",
27-
"build": "node deploy.js",
28-
"make_dmg": "appdmg appdmg.json ~/Desktop/autoEdit2_installer.dmg",
29-
"page": "jekyll serve --source ./docs --destination ./docs/_site --watch",
30-
"docco": "docco -o ./docs/docco_docs --title 'autoEdit 2 Documentation' ./*.js ./frontEnd/*.js ./frontEnd/date_now/*.js ./frontEnd/edl_composer/*.js ./frontEnd/srt/*.js ./frontEnd/js/*.js ./frontEnd/js/models/*.js ./frontEnd/js/views/*.js ./frontEnd/js/collections/*.js ./interactive_transcription_generator/*.js ./interactive_transcription_generator/**/*.js",
31-
"jsdoc": "./node_modules/.bin/jsdoc *.js -c ./docs/jdocs_conf/conf.json"
32-
},
33-
"author": "Pietro Passarelli <[email protected]> (http://pietropassarelli.com)",
34-
"license": "ISC",
35-
"dependencies": {
36-
"app-module-path": "^1.1.0",
37-
"appdmg": "^0.4.5",
38-
"backbone": "^1.3.3",
39-
"bingspeech-api-client": "^2.0.1",
40-
"fluent-ffmpeg": "^2.1.0",
41-
"fs-extra": "^0.30.0",
42-
"install": "^0.8.1",
43-
"jquery": "2.1.0",
44-
"jsdoc": "^3.4.1",
45-
"linvodb3": "^3.24.0",
46-
"lodash": "^4.15.0",
47-
"medea": "^1.0.3",
48-
"medeadown": "^1.1.8",
49-
"npm": "^3.10.6",
50-
"nw": "^0.12.3",
51-
"nw-builder": "^2.2.6",
52-
"path": "^0.12.7",
53-
"request": "^2.75.0",
54-
"underscore": "^1.8.3",
55-
"watson-developer-cloud": "^2.4.1"
56-
},
57-
"devDependencies": {}
2+
"name": "autoEdit2",
3+
"version": "1.0.4",
4+
"description": "Text based video editing app",
5+
"main": "frontEnd/index.html",
6+
"chromium-args": "--mixed-context",
7+
"dom_storage_quota": 5,
8+
"window": {
9+
"show": true,
10+
"frame": true,
11+
"toolbar": true,
12+
"always_on_top": false,
13+
"fullscreen": false,
14+
"show_in_taskbar": true,
15+
"transparent": false,
16+
"icon": "nw.icns",
17+
"width": 800,
18+
"height": 670,
19+
"position": "mouse",
20+
"min_width": 770,
21+
"max_width": 1300,
22+
"min_height": 500
23+
},
24+
"scripts": {
25+
"test": "jasmine",
26+
"start": "nw",
27+
"build": "node deploy.js",
28+
"dmg": "appdmg appdmg.json ~/Desktop/autoEdit2_installer.dmg",
29+
"page": "jekyll serve --source ./docs --destination ./docs/_site --watch",
30+
"docco": "docco -o ./docs/docco_docs --title 'autoEdit 2 Documentation' ./*.js ./frontEnd/*.js ./frontEnd/date_now/*.js ./frontEnd/edl_composer/*.js ./frontEnd/srt/*.js ./frontEnd/js/*.js ./frontEnd/js/models/*.js ./frontEnd/js/views/*.js ./frontEnd/js/collections/*.js ./interactive_transcription_generator/*.js ./interactive_transcription_generator/**/*.js",
31+
"jsdoc": "./node_modules/.bin/jsdoc *.js -c ./docs/jdocs_conf/conf.json"
32+
},
33+
"author": "Pietro Passarelli <[email protected]> (http://pietropassarelli.com)",
34+
"license": "ISC",
35+
"dependencies": {
36+
"app-module-path": "^1.1.0",
37+
"appdmg": "^0.4.5",
38+
"backbone": "^1.3.3",
39+
"bingspeech-api-client": "^2.0.1",
40+
"fluent-ffmpeg": "^2.1.0",
41+
"fs-extra": "^0.30.0",
42+
"install": "^0.8.1",
43+
"jquery": "2.1.0",
44+
"jsdoc": "^3.4.1",
45+
"linvodb3": "^3.24.0",
46+
"lodash": "^4.15.0",
47+
"medea": "^1.0.3",
48+
"medeadown": "^1.1.8",
49+
"npm": "^3.10.6",
50+
"nw": "^0.12.3",
51+
"nw-builder": "^2.2.6",
52+
"path": "^0.12.7",
53+
"request": "^2.75.0",
54+
"underscore": "^1.8.3",
55+
"watson-developer-cloud": "^2.4.1"
56+
},
57+
"devDependencies": {}
5858
}

0 commit comments

Comments
 (0)