Code quality fixes

pull/4111/head
syeopite 2024-01-21 23:44:05 -08:00
rodzic 503ace90f5
commit 93a6464bbe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A73C186DA3955A1A
6 zmienionych plików z 9 dodań i 19 usunięć

Wyświetl plik

@ -191,8 +191,6 @@ module Invidious::Routes::Embed
thumbnail = "/vi/#{video.id}/maxres.jpg"
chapters = video.chapters
if params.raw
url = fmt_stream[0]["url"].as_s

Wyświetl plik

@ -160,14 +160,10 @@ module Invidious::Routes::Images
id = env.params.url["id"]
name = env.params.url["name"]
# Sometimes required to fetch image. IE for chapter thumbnails
# Some thumbnails such as the ones for chapters requires some additional queries.
query_params = HTTP::Params.new
if sqp = env.params.query["sqp"]?
query_params["sqp"] = sqp
end
if rs = env.params.query["rs"]?
query_params["rs"] = rs
{"sqp", "rs"}.each do |name|
query_params[name] = env.params.query[name] if env.params.query[name]?
end
headers = HTTP::Headers.new

Wyświetl plik

@ -158,8 +158,6 @@ module Invidious::Routes::Watch
thumbnail = "/vi/#{video.id}/maxres.jpg"
chapters = video.chapters
if params.raw
if params.listen
url = audio_streams[0]["url"].as_s

Wyświetl plik

@ -10,8 +10,8 @@ module Invidious::Videos
# Constructs a chapters object from InnerTube's JSON object for chapters
#
# Requires the length of the video the chapters are associated to in order to construct correct ending time
def Chapters.from_raw_chapters(raw_chapters : Array(JSON::Any), video_length_seconds : Int32, is_auto_generated : Bool = false)
video_length_milliseconds = video_length_seconds.seconds.total_milliseconds
def Chapters.from_raw_chapters(raw_chapters : Array(JSON::Any), video_length : Int32, is_auto_generated : Bool = false)
video_length_milliseconds = video_length.seconds.total_milliseconds
parsed_chapters = [] of Chapter
@ -21,10 +21,8 @@ module Invidious::Videos
title = chapter["title"]["simpleText"].as_s
raw_thumbnails = chapter["thumbnail"]["thumbnails"].as_a
thumbnails = [] of Hash(String, Int32 | String)
raw_thumbnails.each do |thumbnail|
thumbnails << {
thumbnails = raw_thumbnails.map do |thumbnail|
{
"url" => thumbnail["url"].as_s,
"width" => thumbnail["width"].as_i,
"height" => thumbnail["height"].as_i,

Wyświetl plik

@ -1,4 +1,4 @@
<% if !chapters.nil? %>
<% if chapters = video.chapters %>
<div class="description-chapters-section">
<hr class="description-content-separator"/>
<h4><%=HTML.escape(translate(locale, "video_chapters_label"))%></h4>

Wyświetl plik

@ -64,7 +64,7 @@
<track kind="captions" src="/api/v1/captions/<%= video.id %>?label=<%= caption.name %>" label="<%= caption.name %>">
<% end %>
<% if !chapters.nil? %>
<% if !video.chapters.nil? %>
<track kind="chapters" src="/api/v1/chapters/<%= video.id %>">
<% end %>
<% end %>