[Alternative] Fix for channel live videos
All checks were successful
Invidious CI / build (push) Successful in 6m30s

Signed-off-by: Fijxu <fijxu@nadeko.net>

refactor

Signed-off-by: Fijxu <fijxu@nadeko.net>
This commit is contained in:
Brahim Hadriche 2024-10-26 12:40:31 -04:00 committed by Fijxu
parent 70dc1a9f11
commit e3da8f408d
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -23,14 +23,31 @@ def produce_channel_content_continuation(ucid, content_type, page = 1, auto_gene
else 15 # Fallback to "videos"
end
sort_by_numerical =
case sort_by
when "newest" then 1_i64
when "popular" then 2_i64
when "oldest" then 4_i64
else 1_i64 # Fallback to "newest"
sort_type_numerical =
case content_type
when "videos" then 3
when "livestreams" then 5
else 3 # Fallback to "videos"
end
if content_type == "livestreams"
sort_by_numerical =
case sort_by
when "newest" then 12_i64
when "popular" then 14_i64
when "oldest" then 13_i64
else 12_i64 # Fallback to "newest"
end
else
sort_by_numerical =
case sort_by
when "newest" then 1_i64
when "popular" then 2_i64
when "oldest" then 4_i64
else 1_i64 # Fallback to "newest"
end
end
object_inner_1 = {
"110:embedded" => {
"3:embedded" => {
@ -41,7 +58,7 @@ def produce_channel_content_continuation(ucid, content_type, page = 1, auto_gene
"2:embedded" => {
"1:string" => "00000000-0000-0000-0000-000000000000",
},
"3:varint" => sort_by_numerical,
"#{sort_type_numerical}:varint" => sort_by_numerical,
},
},
},