From 56e35def8a6d0c37de5900a5ca79a418fa4ed70a Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Fri, 20 Jul 2018 15:14:15 -0500 Subject: [PATCH] Add 'autoplay' and 'loop' query params to watch page --- src/invidious.cr | 14 ++++++++++++++ src/invidious/views/watch.ecr | 6 ++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index de86fe17..4b8f67ba 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -274,6 +274,20 @@ get "/watch" do |env| next env.redirect "/" end + autoplay = env.params.query["autoplay"]?.try &.to_i + video_loop = env.params.query["video_loop"]?.try &.to_i + + if preferences + autoplay ||= preferences.autoplay.to_unsafe + video_loop ||= preferences.video_loop.to_unsafe + end + + autoplay ||= 0 + video_loop ||= 0 + + autoplay = autoplay == 1 + video_loop = video_loop == 1 + if env.params.query["start"]? video_start = decode_time(env.params.query["start"]) end diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 7eb6c003..82087c53 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -12,10 +12,8 @@