Merge pull request #2674 from lissyx/fix-metadata-time

Fix word detection for time computation
This commit is contained in:
lissyx 2020-01-14 17:39:52 +01:00 committed by GitHub
commit c9385d4c11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -302,8 +302,11 @@ WordsFromMetadata(Metadata* metadata)
MetadataItem item = metadata->items[i];
// Append character to word if it's not a space
if (strcmp(item.character, " ") != 0
&& strcmp(item.character, u8" ") != 0) {
if (strcmp(item.character, u8" ") != 0) {
// Log the start time of the new word
if (word.length() == 0) {
word_start_time = item.start_time;
}
word.append(item.character);
}
@ -328,10 +331,6 @@ WordsFromMetadata(Metadata* metadata)
// Reset
word = "";
word_start_time = 0;
} else {
if (word.length() == 1) {
word_start_time = item.start_time; // Log the start time of the new word
}
}
}

View File

@ -42,6 +42,10 @@ def words_from_metadata(metadata):
item = metadata.items[i]
# Append character to word if it's not a space
if item.character != " ":
if len(word) == 0:
# Log the start time of the new word
word_start_time = item.start_time
word = word + item.character
# Word boundary is either a space or the last character in the array
if item.character == " " or i == metadata.num_items - 1:
@ -59,10 +63,6 @@ def words_from_metadata(metadata):
# Reset
word = ""
word_start_time = 0
else:
if len(word) == 1:
# Log the start time of the new word
word_start_time = item.start_time
return word_list