From 95e8ca8c3158baedce72400928cd5338c309b5e6 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sat, 14 Aug 2021 14:41:58 -0700 Subject: [PATCH] Unextract VideoPreferences struct --- .../invidious/video_preferences.cr | 29 ---------- src/invidious/videos.cr | 56 ++++++++++++++++++- 2 files changed, 55 insertions(+), 30 deletions(-) delete mode 100644 src/invidious/data_structs/invidious/video_preferences.cr diff --git a/src/invidious/data_structs/invidious/video_preferences.cr b/src/invidious/data_structs/invidious/video_preferences.cr deleted file mode 100644 index ceee4ce2..00000000 --- a/src/invidious/data_structs/invidious/video_preferences.cr +++ /dev/null @@ -1,29 +0,0 @@ -module InvidiousStructs - # Struct containing all values for video preferences - struct VideoPreferences - include JSON::Serializable - - property annotations : Bool - property autoplay : Bool - property comments : Array(String) - property continue : Bool - property continue_autoplay : Bool - property controls : Bool - property listen : Bool - property local : Bool - property preferred_captions : Array(String) - property player_style : String - property quality : String - property quality_dash : String - property raw : Bool - property region : String? - property related_videos : Bool - property speed : Float32 | Float64 - property video_end : Float64 | Int32 - property video_loop : Bool - property extend_desc : Bool - property video_start : Float64 | Int32 - property volume : Int32 - property vr_mode : Bool - end -end diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index faafd91e..0e68913b 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -221,6 +221,60 @@ VIDEO_FORMATS = { "397" => {"ext" => "mp4", "height" => 480, "vcodec" => "av01.0.05M.08"}, } +struct VideoPreferences + include JSON::Serializable + + property annotations : Bool + property autoplay : Bool + property comments : Array(String) + property continue : Bool + property continue_autoplay : Bool + property controls : Bool + property listen : Bool + property local : Bool + property preferred_captions : Array(String) + property player_style : String + property quality : String + property quality_dash : String + property raw : Bool + property region : String? + property related_videos : Bool + property speed : Float32 | Float64 + property video_end : Float64 | Int32 + property video_loop : Bool + property extend_desc : Bool + property video_start : Float64 | Int32 + property volume : Int32 + property vr_mode : Bool +end + +struct VideoPreferences + include JSON::Serializable + + property annotations : Bool + property autoplay : Bool + property comments : Array(String) + property continue : Bool + property continue_autoplay : Bool + property controls : Bool + property listen : Bool + property local : Bool + property preferred_captions : Array(String) + property player_style : String + property quality : String + property quality_dash : String + property raw : Bool + property region : String? + property related_videos : Bool + property speed : Float32 | Float64 + property video_end : Float64 | Int32 + property video_loop : Bool + property extend_desc : Bool + property video_start : Float64 | Int32 + property volume : Int32 + property vr_mode : Bool +end + class VideoRedirect < Exception property video_id : String @@ -541,7 +595,7 @@ def process_video_params(query, preferences) controls ||= 1 controls = controls >= 1 - params = InvidiousStructs::VideoPreferences.new({ + params = VideoPreferences.new({ annotations: annotations, autoplay: autoplay, comments: comments,