mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-28 17:07:53 +01:00
Refactor process_video_params
This commit is contained in:
parent
9dcc87c705
commit
68be24ffc6
@ -1276,19 +1276,19 @@ end
|
|||||||
|
|
||||||
def process_video_params(query, preferences)
|
def process_video_params(query, preferences)
|
||||||
annotations = query["iv_load_policy"]?.try &.to_i?
|
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 }
|
comments = query["comments"]?.try &.split(",").map { |a| a.downcase }
|
||||||
continue = query["continue"]?.try &.to_i?
|
continue = query["continue"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||||
continue_autoplay = query["continue_autoplay"]?.try &.to_i?
|
continue_autoplay = query["continue_autoplay"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||||
listen = query["listen"]? && (query["listen"] == "true" || query["listen"] == "1").to_unsafe
|
listen = query["listen"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||||
local = query["local"]? && (query["local"] == "true" || query["local"] == "1").to_unsafe
|
local = query["local"]?.try { |q| (q == "true" || q == "1").to_unsafe }
|
||||||
player_style = query["player_style"]?
|
player_style = query["player_style"]?
|
||||||
preferred_captions = query["subtitles"]?.try &.split(",").map { |a| a.downcase }
|
preferred_captions = query["subtitles"]?.try &.split(",").map { |a| a.downcase }
|
||||||
quality = query["quality"]?
|
quality = query["quality"]?
|
||||||
region = query["region"]?
|
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?
|
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?
|
volume = query["volume"]?.try &.to_i?
|
||||||
|
|
||||||
if preferences
|
if preferences
|
||||||
@ -1341,17 +1341,10 @@ def process_video_params(query, preferences)
|
|||||||
local = false
|
local = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if query["t"]?
|
if start = query["t"]? || query["time_continue"]? || query["start"]?
|
||||||
video_start = decode_time(query["t"])
|
video_start = decode_time(start)
|
||||||
end
|
end
|
||||||
video_start ||= 0
|
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"]?
|
if query["end"]?
|
||||||
video_end = decode_time(query["end"])
|
video_end = decode_time(query["end"])
|
||||||
|
Loading…
Reference in New Issue
Block a user