Extractors: Add support for shorts

Fixes #2708
This commit is contained in:
Samantaz Fox
2021-12-12 20:58:45 +01:00
parent 2ac19eb8fc
commit f54e247eb4
2 changed files with 26 additions and 9 deletions

View File

@@ -21,10 +21,17 @@ def elapsed_text(elapsed)
end
def decode_length_seconds(string)
length_seconds = string.gsub(/[^0-9:]/, "").split(":").map &.to_i
length_seconds = string.gsub(/[^0-9:]/, "")
return 0_i32 if length_seconds.empty?
length_seconds = length_seconds.split(":").map { |x| x.to_i? || 0 }
length_seconds = [0] * (3 - length_seconds.size) + length_seconds
length_seconds = Time::Span.new hours: length_seconds[0], minutes: length_seconds[1], seconds: length_seconds[2]
length_seconds = length_seconds.total_seconds.to_i
length_seconds = Time::Span.new(
hours: length_seconds[0],
minutes: length_seconds[1],
seconds: length_seconds[2]
).total_seconds.to_i32
return length_seconds
end