Skip to content

Commit

Permalink
cleaned up code for subtitles parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Pietro Passarelli - News Labs committed Aug 1, 2019
1 parent 3b7ae7f commit 66174ae
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/export-adapters/subtitles-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@ function countWords(text) {
.split(' ').length;
}

function countList(list) {
return list.length - 1;
}

function addTimecodesToLines(wordsList, lines) {
let startWordCounter = 0;
let endWordCounter = 0;
const results = lines.map((line) => {
endWordCounter += countWords(line);

const jsonLine = { text: line.trim() };
jsonLine.start = wordsList[startWordCounter].start;
jsonLine.end = wordsList[endWordCounter - 1].end;
Expand Down

0 comments on commit 66174ae

Please sign in to comment.