mirror of
https://github.com/iv-org/invidious.git
synced 2026-04-28 01:07:07 -05:00
Merge ea0f99b74156276ef9fc7ddc10b694d47eac6217 into 9eda6e5bc433638ee251e06d05daff3fdd12ca86
This commit is contained in:
commit
dbce005502
@ -31,6 +31,13 @@ Spectator.describe "Helper" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#format_audio_quality_label" do
|
||||||
|
it "formats audio bitrates as readable kilobit labels" do
|
||||||
|
expect(Helpers.format_audio_quality_label(128000)).to eq("128k")
|
||||||
|
expect(Helpers.format_audio_quality_label(50000)).to eq("50k")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#sign_token" do
|
describe "#sign_token" do
|
||||||
it "correctly signs a given hash" do
|
it "correctly signs a given hash" do
|
||||||
token = {
|
token = {
|
||||||
|
|||||||
@ -40,6 +40,10 @@ module Helpers
|
|||||||
return description
|
return description
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def format_audio_quality_label(bitrate : Int) : String
|
||||||
|
"#{(bitrate / 1000).round.to_i}k"
|
||||||
|
end
|
||||||
|
|
||||||
def cache_annotation(id, annotations)
|
def cache_annotation(id, annotations)
|
||||||
if !CONFIG.cache_annotations
|
if !CONFIG.cache_annotations
|
||||||
return
|
return
|
||||||
|
|||||||
@ -28,12 +28,13 @@
|
|||||||
src_url = invidious_companion.public_url.to_s + src_url +
|
src_url = invidious_companion.public_url.to_s + src_url +
|
||||||
"&check=#{invidious_companion_check_id}" if (invidious_companion)
|
"&check=#{invidious_companion_check_id}" if (invidious_companion)
|
||||||
|
|
||||||
bitrate = fmt["bitrate"]
|
bitrate = fmt["bitrate"].as_i
|
||||||
|
quality_label = Helpers.format_audio_quality_label(bitrate)
|
||||||
mimetype = HTML.escape(fmt["mimeType"].as_s)
|
mimetype = HTML.escape(fmt["mimeType"].as_s)
|
||||||
|
|
||||||
selected = (i == best_m4a_stream_index)
|
selected = (i == best_m4a_stream_index)
|
||||||
%>
|
%>
|
||||||
<source src="<%= src_url %>" type='<%= mimetype %>' label="<%= bitrate %>k" selected="<%= selected %>">
|
<source src="<%= src_url %>" type='<%= mimetype %>' label="<%= quality_label %>" selected="<%= selected %>">
|
||||||
<% if !params.local && !CONFIG.disabled?("local") %>
|
<% if !params.local && !CONFIG.disabled?("local") %>
|
||||||
<source src="<%= src_url %>&local=true" type='<%= mimetype %>' hidequalityoption="true">
|
<source src="<%= src_url %>&local=true" type='<%= mimetype %>' hidequalityoption="true">
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user