mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-25 23:13:37 +00:00
Run Crystal formatting tool
This commit is contained in:
parent
205c5493db
commit
93ac7cdeb4
@ -263,7 +263,7 @@ def create_compilation(title, privacy, user)
|
|||||||
index: [] of Int64,
|
index: [] of Int64,
|
||||||
first_video_id: "",
|
first_video_id: "",
|
||||||
first_video_starting_timestamp_seconds: 0,
|
first_video_starting_timestamp_seconds: 0,
|
||||||
first_video_ending_timestamp_seconds: 0
|
first_video_ending_timestamp_seconds: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
Invidious::Database::Compilations.insert(compilation)
|
Invidious::Database::Compilations.insert(compilation)
|
||||||
@ -284,7 +284,7 @@ def subscribe_compilation(user, compilation)
|
|||||||
index: [] of Int64,
|
index: [] of Int64,
|
||||||
first_video_id: "",
|
first_video_id: "",
|
||||||
first_video_starting_timestamp_seconds: 0,
|
first_video_starting_timestamp_seconds: 0,
|
||||||
first_video_ending_timestamp_seconds: 0
|
first_video_ending_timestamp_seconds: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
Invidious::Database::Compilations.insert(compilation)
|
Invidious::Database::Compilations.insert(compilation)
|
||||||
@ -441,7 +441,7 @@ def extract_compilation_videos(initial_data : Hash(String, JSON::Any))
|
|||||||
published: Time.utc,
|
published: Time.utc,
|
||||||
compid: compid,
|
compid: compid,
|
||||||
index: index,
|
index: index,
|
||||||
order_index: order_index
|
order_index: order_index,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -101,6 +101,7 @@ module Invidious::Database::Compilations
|
|||||||
|
|
||||||
PG_DB.exec(request, id, first_video_id, starting_timestamp_seconds, ending_timestamp_seconds)
|
PG_DB.exec(request, id, first_video_id, starting_timestamp_seconds, ending_timestamp_seconds)
|
||||||
end
|
end
|
||||||
|
|
||||||
# -------------------
|
# -------------------
|
||||||
# Select
|
# Select
|
||||||
# -------------------
|
# -------------------
|
||||||
@ -261,7 +262,6 @@ module Invidious::Database::CompilationVideos
|
|||||||
end
|
end
|
||||||
|
|
||||||
def select_timestamps(compid : String, vid : String)
|
def select_timestamps(compid : String, vid : String)
|
||||||
|
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT starting_timestamp_seconds,ending_timestamp_seconds FROM compilation_videos
|
SELECT starting_timestamp_seconds,ending_timestamp_seconds FROM compilation_videos
|
||||||
WHERE compid = $1 AND id = $2
|
WHERE compid = $1 AND id = $2
|
||||||
@ -269,7 +269,6 @@ module Invidious::Database::CompilationVideos
|
|||||||
SQL
|
SQL
|
||||||
|
|
||||||
return PG_DB.query_one?(request, compid, vid, as: {Int32, Int32})
|
return PG_DB.query_one?(request, compid, vid, as: {Int32, Int32})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_id_from_order_index(order_index : Int32)
|
def select_id_from_order_index(order_index : Int32)
|
||||||
|
@ -76,7 +76,6 @@ module Invidious::Routes::API::V1::Misc
|
|||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# APIv1 currently uses the same logic for both
|
# APIv1 currently uses the same logic for both
|
||||||
# user playlists and Invidious playlists. This means that we can't
|
# user playlists and Invidious playlists. This means that we can't
|
||||||
# reasonably split them yet. This should be addressed in APIv2
|
# reasonably split them yet. This should be addressed in APIv2
|
||||||
|
@ -218,7 +218,6 @@ module Invidious::Routes::Compilations
|
|||||||
return error_template(400, ex)
|
return error_template(400, ex)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if !compid || compid.empty?
|
if !compid || compid.empty?
|
||||||
return error_json(400, "A compilation ID is required")
|
return error_json(400, "A compilation ID is required")
|
||||||
end
|
end
|
||||||
@ -261,7 +260,6 @@ module Invidious::Routes::Compilations
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
update_first_video_params(compid)
|
update_first_video_params(compid)
|
||||||
@ -269,7 +267,6 @@ module Invidious::Routes::Compilations
|
|||||||
env.redirect "/compilation?list=#{compid}"
|
env.redirect "/compilation?list=#{compid}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.add_compilation_items_page(env)
|
def self.add_compilation_items_page(env)
|
||||||
prefs = env.get("preferences").as(Preferences)
|
prefs = env.get("preferences").as(Preferences)
|
||||||
locale = prefs.locale
|
locale = prefs.locale
|
||||||
@ -422,7 +419,7 @@ module Invidious::Routes::Compilations
|
|||||||
compid: compilation_id,
|
compid: compilation_id,
|
||||||
live_now: video.live_now,
|
live_now: video.live_now,
|
||||||
index: Random::Secure.rand(0_i64..Int64::MAX),
|
index: Random::Secure.rand(0_i64..Int64::MAX),
|
||||||
order_index: compilation.index.size
|
order_index: compilation.index.size,
|
||||||
})
|
})
|
||||||
|
|
||||||
Invidious::Database::CompilationVideos.insert(compilation_video)
|
Invidious::Database::CompilationVideos.insert(compilation_video)
|
||||||
@ -473,7 +470,11 @@ module Invidious::Routes::Compilations
|
|||||||
compilation_index_array_position = compilation_index_array.index(compilation_video[0].index)
|
compilation_index_array_position = compilation_index_array.index(compilation_video[0].index)
|
||||||
if !compilation_index_array_position.nil?
|
if !compilation_index_array_position.nil?
|
||||||
compilation_index_array.delete_at(compilation_index_array_position)
|
compilation_index_array.delete_at(compilation_index_array_position)
|
||||||
|
if (compilation_index_array_position == compilation_index_array.size)
|
||||||
|
compilation_index_array.insert(compilation_index_array_position, compilation_video[0].index)
|
||||||
|
else
|
||||||
compilation_index_array.insert(compilation_index_array_position + 1, compilation_video[0].index)
|
compilation_index_array.insert(compilation_index_array_position + 1, compilation_video[0].index)
|
||||||
|
end
|
||||||
Invidious::Database::Compilations.move_video_position(compilation_id, compilation_index_array)
|
Invidious::Database::Compilations.move_video_position(compilation_id, compilation_index_array)
|
||||||
end
|
end
|
||||||
update_first_video_params(compilation_id)
|
update_first_video_params(compilation_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user