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

Commit

Permalink
Add more SRT export options
Browse files Browse the repository at this point in the history
  • Loading branch information
curtgrimes committed Sep 13, 2020
1 parent 866fe77 commit 1ceaed2
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 146 deletions.
4 changes: 2 additions & 2 deletions app/api/routes/storage/dropbox/index.js
Expand Up @@ -94,7 +94,7 @@ dropboxRoute.post('/push', async (req, res) => {
let textUpload = dropboxClient.filesUpload({
path:
'/Transcripts/' +
dateFormat(sessionStartDate, 'YYYY-MM-DD HH.mm.ss') +
dateFormat(new Date(sessionStartDate), 'yyyy-MM-dd HH.mm.ss') +
'.txt',
contents: text,
mode: 'overwrite',
Expand All @@ -105,7 +105,7 @@ dropboxRoute.post('/push', async (req, res) => {
? dropboxClient.filesUpload({
path:
'/Transcripts/' +
dateFormat(sessionStartDate, 'YYYY-MM-DD HH.mm.ss') +
dateFormat(new Date(sessionStartDate), 'yyyy-MM-dd HH.mm.ss') +
'.webcaptioner-timings.json',
contents: JSON.stringify(timings),
mode: 'overwrite',
Expand Down
2 changes: 1 addition & 1 deletion app/components/WhatsNew.vue
Expand Up @@ -57,7 +57,7 @@ export default {
},
methods: {
formatDate: function(date) {
return this.dateFormat(date, 'MMM. D, YYYY');
return this.dateFormat(date, 'MMM. D, yyyy');
},
},
};
Expand Down
10 changes: 5 additions & 5 deletions app/mixins/dateFormat.js
@@ -1,7 +1,7 @@
const dateFormat = require('date-fns/format')
import { format as dateFormat } from 'date-fns';

export default {
methods: {
dateFormat,
},
}
methods: {
dateFormat,
},
};
70 changes: 39 additions & 31 deletions app/mixins/saveToFile.js
@@ -1,32 +1,40 @@
export default {
methods: {
saveToTextFile({transcript, dateFormatter, onDone}) {
transcript = transcript.replace('\n', '\r\n')
var a = document.createElement('a');
a.href = 'data:text/plain;base64,' + btoa(transcript);
a.textContent = 'download';
a.download = 'web-captioner-'+ dateFormatter(new Date(), 'YYYY-MM-DD-HH-mm-ss') +'.txt';
a.click();

onDone();
},
saveToWordFile({transcript, dateFormatter, onDone}) {
var link = document.createElement('a');
link.href = URL.createObjectURL(new Blob(['\ufeff', transcript], {
type: 'application/msword'
}));
link.textContent = 'download';
link.download = 'web-captioner-'+ dateFormatter(new Date(), 'YYYY-MM-DD-HH-mm-ss') +'.doc';
link.click();

onDone();
},
saveToJSONFile({settings, onDone}) {
var a = document.createElement('a');
a.href = 'data:text/plain;base64,' + btoa(settings);
a.textContent = 'download';
a.download = 'web-captioner-settings.json';
a.click();
},
}
} ;
methods: {
saveToTextFile({ transcript, dateFormatter, onDone }) {
transcript = transcript.replace('\n', '\r\n');
var a = document.createElement('a');
a.href = 'data:text/plain;base64,' + btoa(transcript);
a.textContent = 'download';
a.download =
'web-captioner-' +
dateFormatter(new Date(), 'yyyy-MM-dd-HH-mm-ss') +
'.txt';
a.click();

onDone();
},
saveToWordFile({ transcript, dateFormatter, onDone }) {
var link = document.createElement('a');
link.href = URL.createObjectURL(
new Blob(['\ufeff', transcript], {
type: 'application/msword',
})
);
link.textContent = 'download';
link.download =
'web-captioner-' +
dateFormatter(new Date(), 'yyyy-MM-dd-HH-mm-ss') +
'.doc';
link.click();

onDone();
},
saveToJSONFile({ settings, onDone }) {
var a = document.createElement('a');
a.href = 'data:text/plain;base64,' + btoa(settings);
a.textContent = 'download';
a.download = 'web-captioner-settings.json';
a.click();
},
},
};
14 changes: 11 additions & 3 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Expand Up @@ -71,7 +71,7 @@
"bytes": "^3.1.0",
"combokeys": "^3.0.0",
"csv-parse": "^3.1.3",
"date-fns": "^1.29.0",
"date-fns": "^2.16.1",
"eslint": "^4.15.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
Expand Down

0 comments on commit 1ceaed2

Please sign in to comment.