From b21365248db144a252da9737aaccba6c073508af Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Mon, 15 Jan 2018 20:30:57 -0600 Subject: [PATCH] Add speed control --- src/invidious.cr | 4 +++- src/views/watch.ecr | 32 ++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 74cf8c17..f47ebda7 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -124,6 +124,9 @@ end get "/watch" do |env| id = env.params.query["v"] listen = env.params.query["listen"]? || "false" + speed = env.params.query["speed"]? && env.params.query["speed"].to_f? ? env.params.query["speed"].to_f : 1 + + env.params.query.delete_all("listen") begin video = get_video(id) @@ -172,7 +175,6 @@ end get "/search" do |env| query = env.params.query["q"] page = env.params.query["page"]? && env.params.query["page"].to_i? ? env.params.query["page"].to_i : 1 - speed = env.params.query["speed"]? && env.params.query["speed"].to_i? ? env.params.query["speed"].to_i : 1 client = get_client diff --git a/src/views/watch.ecr b/src/views/watch.ecr index 7a9e2efc..f3763b56 100644 --- a/src/views/watch.ecr +++ b/src/views/watch.ecr @@ -2,7 +2,22 @@ <%= video.info["title"] + " - " %> <% end %> -