Skip to content

Commit

Permalink
CSV file conversion - handle bracket things such as [Music], [Noise] …
Browse files Browse the repository at this point in the history
…and so on
  • Loading branch information
Arnar Freyr authored and judyfong committed Sep 15, 2020
1 parent 246b258 commit e382a77
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/geckoModule/textFormats/csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ export const convert = (app, fileIndex) => {
var csvline = `${title},${speaker_id},${speaker_name}`

if(speaker_id[0] == '[' && speaker_id[speaker_id.length - 1] == ']'){
console.log("TRUE")
continue;
}
console.log(speaker_id)

if (speaker_id != '' && speaker_name != '' && !isNaN(speaker_id) && speakerId.length == 2
&& !speaker_ids.includes(speaker_id) || speaker_id[0] == '[' && speaker_id[speaker_id.length - 1] == ']' ) {
&& !speaker_ids.includes(speaker_id)) {
if(!data.includes(csvline) ) {
speaker_ids.push(speaker_id)
data.push(csvline)
}
}

else {
throw "Can't save the CSV file - check your labels. Each label should be on the form: speaker id,speaker name"
}
Expand Down

0 comments on commit e382a77

Please sign in to comment.