Skip to content

Commit 555bb71

Browse files
committed
Removal of changes to methods now unrelated to the issue
Unrelated to the issue since the change in management of channel_refresh_interval Cf this remark : #2915 (comment)
1 parent afa3eff commit 555bb71

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/invidious/helpers/utils.cr

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,23 @@ def elapsed_text(elapsed)
1818
"#{(millis * 1000).round(2)}µs"
1919
end
2020

21-
def decode_time_span(string : String) : Time::Span
22-
time_span = string.gsub(/[^0-9:]/, "")
23-
return Time::Span.new(seconds: 0) if time_span.empty?
24-
25-
time_span = time_span.split(":").map { |x| x.to_i? || 0 }
26-
time_span = [0] * (3 - time_span.size) + time_span
27-
28-
return Time::Span.new(
29-
hours: time_span[0],
30-
minutes: time_span[1],
31-
seconds: time_span[2]
32-
)
33-
end
21+
def decode_length_seconds(string)
22+
length_seconds = string.gsub(/[^0-9:]/, "")
23+
return 0_i32 if length_seconds.empty?
24+
25+
length_seconds = length_seconds.split(":").map { |x| x.to_i? || 0 }
26+
length_seconds = [0] * (3 - length_seconds.size) + length_seconds
27+
28+
length_seconds = Time::Span.new(
29+
hours: length_seconds[0],
30+
minutes: length_seconds[1],
31+
seconds: length_seconds[2]
32+
).total_seconds.to_i32
3433

35-
def decode_length_seconds(string : String) : Int32
36-
return decode_time_span(string).total_seconds.to_i32
34+
return length_seconds
3735
end
3836

39-
def recode_length_seconds(time : Int32) : String
37+
def recode_length_seconds(time)
4038
if time <= 0
4139
return ""
4240
else

0 commit comments

Comments
 (0)