summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFéry Mathieu (Mathius) <ferymathieuy@gmail.com>2022-02-22 08:17:50 +0100
committerFéry Mathieu (Mathius) <ferymathieuy@gmail.com>2022-02-22 08:17:50 +0100
commit555bb711c9bb16f8a78a8b71146367438b81918e (patch)
treed19d433e9b8879f11895253874c9a6c2305add62 /src
parentafa3eff313428ad5cb9783a12ce4884d207c11c7 (diff)
downloadinvidious-555bb711c9bb16f8a78a8b71146367438b81918e.tar.gz
invidious-555bb711c9bb16f8a78a8b71146367438b81918e.tar.bz2
invidious-555bb711c9bb16f8a78a8b71146367438b81918e.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/invidious/helpers/utils.cr30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr
index 53f64f4e..c1dc17db 100644
--- a/src/invidious/helpers/utils.cr
+++ b/src/invidious/helpers/utils.cr
@@ -18,25 +18,23 @@ def elapsed_text(elapsed)
"#{(millis * 1000).round(2)}µs"
end
-def decode_time_span(string : String) : Time::Span
- time_span = string.gsub(/[^0-9:]/, "")
- return Time::Span.new(seconds: 0) if time_span.empty?
-
- time_span = time_span.split(":").map { |x| x.to_i? || 0 }
- time_span = [0] * (3 - time_span.size) + time_span
-
- return Time::Span.new(
- hours: time_span[0],
- minutes: time_span[1],
- seconds: time_span[2]
- )
-end
+def decode_length_seconds(string)
+ 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]
+ ).total_seconds.to_i32
-def decode_length_seconds(string : String) : Int32
- return decode_time_span(string).total_seconds.to_i32
+ return length_seconds
end
-def recode_length_seconds(time : Int32) : String
+def recode_length_seconds(time)
if time <= 0
return ""
else