mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
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 : https://github.com/iv-org/invidious/pull/2915#discussion_r811373503
This commit is contained in:
parent
afa3eff313
commit
555bb711c9
1 changed files with 13 additions and 15 deletions
|
@ -18,25 +18,23 @@ def elapsed_text(elapsed)
|
||||||
"#{(millis * 1000).round(2)}µs"
|
"#{(millis * 1000).round(2)}µs"
|
||||||
end
|
end
|
||||||
|
|
||||||
def decode_time_span(string : String) : Time::Span
|
def decode_length_seconds(string)
|
||||||
time_span = string.gsub(/[^0-9:]/, "")
|
length_seconds = string.gsub(/[^0-9:]/, "")
|
||||||
return Time::Span.new(seconds: 0) if time_span.empty?
|
return 0_i32 if length_seconds.empty?
|
||||||
|
|
||||||
time_span = time_span.split(":").map { |x| x.to_i? || 0 }
|
length_seconds = length_seconds.split(":").map { |x| x.to_i? || 0 }
|
||||||
time_span = [0] * (3 - time_span.size) + time_span
|
length_seconds = [0] * (3 - length_seconds.size) + length_seconds
|
||||||
|
|
||||||
return Time::Span.new(
|
length_seconds = Time::Span.new(
|
||||||
hours: time_span[0],
|
hours: length_seconds[0],
|
||||||
minutes: time_span[1],
|
minutes: length_seconds[1],
|
||||||
seconds: time_span[2]
|
seconds: length_seconds[2]
|
||||||
)
|
).total_seconds.to_i32
|
||||||
|
|
||||||
|
return length_seconds
|
||||||
end
|
end
|
||||||
|
|
||||||
def decode_length_seconds(string : String) : Int32
|
def recode_length_seconds(time)
|
||||||
return decode_time_span(string).total_seconds.to_i32
|
|
||||||
end
|
|
||||||
|
|
||||||
def recode_length_seconds(time : Int32) : String
|
|
||||||
if time <= 0
|
if time <= 0
|
||||||
return ""
|
return ""
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue