forked from midou/invidious
Fix warnings in latest version of Crystal
This commit is contained in:
@@ -173,6 +173,8 @@ struct Config
|
||||
yaml.scalar "ipv4"
|
||||
when Socket::Family::INET6
|
||||
yaml.scalar "ipv6"
|
||||
when Socket::Family::UNIX
|
||||
raise "Invalid socket family #{value}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -223,6 +225,8 @@ struct Config
|
||||
else
|
||||
return false
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -520,9 +524,7 @@ def extract_shelf_items(nodeset, ucid = nil, author_name = nil)
|
||||
|
||||
shelf.xpath_nodes(%q(.//ul[contains(@class, "yt-uix-shelfslider-list") or contains(@class, "expanded-shelf-content-list")]/li)).each do |child_node|
|
||||
type = child_node.xpath_node(%q(./div))
|
||||
if !type
|
||||
next
|
||||
end
|
||||
next if !type
|
||||
|
||||
case type["class"]
|
||||
when .includes? "yt-lockup-video"
|
||||
@@ -599,6 +601,8 @@ def extract_shelf_items(nodeset, ucid = nil, author_name = nil)
|
||||
videos: videos,
|
||||
thumbnail: playlist_thumbnail
|
||||
)
|
||||
else
|
||||
next # Skip
|
||||
end
|
||||
end
|
||||
|
||||
@@ -763,7 +767,7 @@ def create_notification_stream(env, config, kemal_config, decrypt_function, topi
|
||||
loop do
|
||||
time_span = [0, 0, 0, 0]
|
||||
time_span[rand(4)] = rand(30) + 5
|
||||
published = Time.utc - Time::Span.new(time_span[0], time_span[1], time_span[2], time_span[3])
|
||||
published = Time.utc - Time::Span.new(days: time_span[0], hours: time_span[1], minutes: time_span[2], seconds: time_span[3])
|
||||
video_id = TEST_IDS[rand(TEST_IDS.size)]
|
||||
|
||||
video = get_video(video_id, PG_DB)
|
||||
|
@@ -24,6 +24,8 @@ def translate(locale : Hash(String, JSON::Any) | Nil, translation : String, text
|
||||
if !locale[translation].as_s.empty?
|
||||
translation = locale[translation].as_s
|
||||
end
|
||||
else
|
||||
raise "Invalid translation #{translation}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -43,15 +43,10 @@ def sign_token(key, hash)
|
||||
string_to_sign = [] of String
|
||||
|
||||
hash.each do |key, value|
|
||||
if key == "signature"
|
||||
next
|
||||
end
|
||||
next if key == "signature"
|
||||
|
||||
if value.is_a?(JSON::Any)
|
||||
case value
|
||||
when .as_a?
|
||||
value = value.as_a.map { |item| item.as_s }
|
||||
end
|
||||
if value.is_a?(JSON::Any) && value.as_a?
|
||||
value = value.as_a.map { |i| i.as_s }
|
||||
end
|
||||
|
||||
case value
|
||||
|
@@ -100,7 +100,7 @@ end
|
||||
def decode_length_seconds(string)
|
||||
length_seconds = string.gsub(/[^0-9:]/, "").split(":").map &.to_i
|
||||
length_seconds = [0] * (3 - length_seconds.size) + length_seconds
|
||||
length_seconds = Time::Span.new(length_seconds[0], length_seconds[1], length_seconds[2])
|
||||
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
|
||||
|
||||
return length_seconds
|
||||
@@ -162,6 +162,7 @@ def decode_date(string : String)
|
||||
return Time.utc
|
||||
when "yesterday"
|
||||
return Time.utc - 1.day
|
||||
else nil # Continue
|
||||
end
|
||||
|
||||
# String matches format "20 hours ago", "4 months ago"...
|
||||
|
Reference in New Issue
Block a user