Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Commit 1ceaed2

Browse files
committed
Add more SRT export options
1 parent 866fe77 commit 1ceaed2

File tree

7 files changed

+298
-146
lines changed

7 files changed

+298
-146
lines changed

app/api/routes/storage/dropbox/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ dropboxRoute.post('/push', async (req, res) => {
9494
let textUpload = dropboxClient.filesUpload({
9595
path:
9696
'/Transcripts/' +
97-
dateFormat(sessionStartDate, 'YYYY-MM-DD HH.mm.ss') +
97+
dateFormat(new Date(sessionStartDate), 'yyyy-MM-dd HH.mm.ss') +
9898
'.txt',
9999
contents: text,
100100
mode: 'overwrite',
@@ -105,7 +105,7 @@ dropboxRoute.post('/push', async (req, res) => {
105105
? dropboxClient.filesUpload({
106106
path:
107107
'/Transcripts/' +
108-
dateFormat(sessionStartDate, 'YYYY-MM-DD HH.mm.ss') +
108+
dateFormat(new Date(sessionStartDate), 'yyyy-MM-dd HH.mm.ss') +
109109
'.webcaptioner-timings.json',
110110
contents: JSON.stringify(timings),
111111
mode: 'overwrite',

app/components/WhatsNew.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default {
5757
},
5858
methods: {
5959
formatDate: function(date) {
60-
return this.dateFormat(date, 'MMM. D, YYYY');
60+
return this.dateFormat(date, 'MMM. D, yyyy');
6161
},
6262
},
6363
};

app/mixins/dateFormat.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const dateFormat = require('date-fns/format')
1+
import { format as dateFormat } from 'date-fns';
22

33
export default {
4-
methods: {
5-
dateFormat,
6-
},
7-
}
4+
methods: {
5+
dateFormat,
6+
},
7+
};

app/mixins/saveToFile.js

+39-31
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
export default {
2-
methods: {
3-
saveToTextFile({transcript, dateFormatter, onDone}) {
4-
transcript = transcript.replace('\n', '\r\n')
5-
var a = document.createElement('a');
6-
a.href = 'data:text/plain;base64,' + btoa(transcript);
7-
a.textContent = 'download';
8-
a.download = 'web-captioner-'+ dateFormatter(new Date(), 'YYYY-MM-DD-HH-mm-ss') +'.txt';
9-
a.click();
10-
11-
onDone();
12-
},
13-
saveToWordFile({transcript, dateFormatter, onDone}) {
14-
var link = document.createElement('a');
15-
link.href = URL.createObjectURL(new Blob(['\ufeff', transcript], {
16-
type: 'application/msword'
17-
}));
18-
link.textContent = 'download';
19-
link.download = 'web-captioner-'+ dateFormatter(new Date(), 'YYYY-MM-DD-HH-mm-ss') +'.doc';
20-
link.click();
21-
22-
onDone();
23-
},
24-
saveToJSONFile({settings, onDone}) {
25-
var a = document.createElement('a');
26-
a.href = 'data:text/plain;base64,' + btoa(settings);
27-
a.textContent = 'download';
28-
a.download = 'web-captioner-settings.json';
29-
a.click();
30-
},
31-
}
32-
} ;
2+
methods: {
3+
saveToTextFile({ transcript, dateFormatter, onDone }) {
4+
transcript = transcript.replace('\n', '\r\n');
5+
var a = document.createElement('a');
6+
a.href = 'data:text/plain;base64,' + btoa(transcript);
7+
a.textContent = 'download';
8+
a.download =
9+
'web-captioner-' +
10+
dateFormatter(new Date(), 'yyyy-MM-dd-HH-mm-ss') +
11+
'.txt';
12+
a.click();
13+
14+
onDone();
15+
},
16+
saveToWordFile({ transcript, dateFormatter, onDone }) {
17+
var link = document.createElement('a');
18+
link.href = URL.createObjectURL(
19+
new Blob(['\ufeff', transcript], {
20+
type: 'application/msword',
21+
})
22+
);
23+
link.textContent = 'download';
24+
link.download =
25+
'web-captioner-' +
26+
dateFormatter(new Date(), 'yyyy-MM-dd-HH-mm-ss') +
27+
'.doc';
28+
link.click();
29+
30+
onDone();
31+
},
32+
saveToJSONFile({ settings, onDone }) {
33+
var a = document.createElement('a');
34+
a.href = 'data:text/plain;base64,' + btoa(settings);
35+
a.textContent = 'download';
36+
a.download = 'web-captioner-settings.json';
37+
a.click();
38+
},
39+
},
40+
};

app/package-lock.json

+11-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"bytes": "^3.1.0",
7272
"combokeys": "^3.0.0",
7373
"csv-parse": "^3.1.3",
74-
"date-fns": "^1.29.0",
74+
"date-fns": "^2.16.1",
7575
"eslint": "^4.15.0",
7676
"eslint-friendly-formatter": "^3.0.0",
7777
"eslint-loader": "^1.7.1",

0 commit comments

Comments
 (0)