mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-23 05:33:07 +05:30
Refactor process_video_params
This commit is contained in:
parent
9dcc87c705
commit
68be24ffc6
@ -1276,19 +1276,19 @@ end
|
||||
|
||||
def process_video_params(query, preferences)
|
||||
annotations = query["iv_load_policy"]?.try &.to_i?
|
||||
autoplay = query["autoplay"]?.try &.to_i?
|
||||
autoplay = query["autoplay"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||
comments = query["comments"]?.try &.split(",").map { |a| a.downcase }
|
||||
continue = query["continue"]?.try &.to_i?
|
||||
continue_autoplay = query["continue_autoplay"]?.try &.to_i?
|
||||
listen = query["listen"]? && (query["listen"] == "true" || query["listen"] == "1").to_unsafe
|
||||
local = query["local"]? && (query["local"] == "true" || query["local"] == "1").to_unsafe
|
||||
continue = query["continue"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||
continue_autoplay = query["continue_autoplay"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||
listen = query["listen"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||
local = query["local"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||
player_style = query["player_style"]?
|
||||
preferred_captions = query["subtitles"]?.try &.split(",").map { |a| a.downcase }
|
||||
quality = query["quality"]?
|
||||
region = query["region"]?
|
||||
related_videos = query["related_videos"]? && (query["related_videos"] == "true" || query["related_videos"] == "1").to_unsafe
|
||||
related_videos = query["related_videos"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||
speed = query["speed"]?.try &.rchop("x").to_f?
|
||||
video_loop = query["loop"]?.try &.to_i?
|
||||
video_loop = query["loop"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||
volume = query["volume"]?.try &.to_i?
|
||||
|
||||
if preferences
|
||||
@ -1341,17 +1341,10 @@ def process_video_params(query, preferences)
|
||||
local = false
|
||||
end
|
||||
|
||||
if query["t"]?
|
||||
video_start = decode_time(query["t"])
|
||||
if start = query["t"]? || query["time_continue"]? || query["start"]?
|
||||
video_start = decode_time(start)
|
||||
end
|
||||
video_start ||= 0
|
||||
if query["time_continue"]?
|
||||
video_start = decode_time(query["time_continue"])
|
||||
end
|
||||
video_start ||= 0
|
||||
if query["start"]?
|
||||
video_start = decode_time(query["start"])
|
||||
end
|
||||
|
||||
if query["end"]?
|
||||
video_end = decode_time(query["end"])
|
||||
|
Loading…
Reference in New Issue
Block a user