Run 'crystal tool format'

This commit is contained in:
Omar Roth 2018-01-21 11:07:32 -06:00
parent e192b55ffa
commit 5c1bd5fae6

View file

@ -46,7 +46,7 @@ spawn do
loop do loop do
if rand(600) < 1 if rand(600) < 1
client = get_client client = get_client
client = HTTP::Client.new(URL, CONTEXT) client = HTTP::Client.new(URL, CONTEXT)
client.connect_timeout = Time::Span.new(0, 0, 0, 5) client.connect_timeout = Time::Span.new(0, 0, 0, 5)
POOL << client POOL << client
@ -63,21 +63,21 @@ spawn do
next next
end end
rvs = [] of Hash(String, String) rvs = [] of Hash(String, String)
if video.info.has_key?("rvs") if video.info.has_key?("rvs")
video.info["rvs"].split(",").each do |rv| video.info["rvs"].split(",").each do |rv|
rvs << HTTP::Params.parse(rv).to_h rvs << HTTP::Params.parse(rv).to_h
end end
end end
rvs.each do |rv| rvs.each do |rv|
if rv.has_key?("id") if rv.has_key?("id")
if !PG_DB.query_one?("SELECT EXISTS (SELECT true FROM videos WHERE id = $1)", rv["id"], as: Bool) if !PG_DB.query_one?("SELECT EXISTS (SELECT true FROM videos WHERE id = $1)", rv["id"], as: Bool)
id << rv["id"] id << rv["id"]
if id.size == 50 if id.size == 50
id.shift id.shift
end end
end end
end end
end end
@ -146,7 +146,6 @@ get "/watch" do |env|
next templated "error" next templated "error"
end end
fmt_stream = [] of HTTP::Params fmt_stream = [] of HTTP::Params
video.info["url_encoded_fmt_stream_map"].split(",") do |string| video.info["url_encoded_fmt_stream_map"].split(",") do |string|
fmt_stream << HTTP::Params.parse(string) fmt_stream << HTTP::Params.parse(string)
@ -160,7 +159,6 @@ get "/watch" do |env|
adaptive_fmts << HTTP::Params.parse(string) adaptive_fmts << HTTP::Params.parse(string)
end end
end end
rvs = [] of Hash(String, String) rvs = [] of Hash(String, String)
if video.info.has_key?("rvs") if video.info.has_key?("rvs")
video.info["rvs"].split(",").each do |rv| video.info["rvs"].split(",").each do |rv|