mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-23 22:39:28 -05:00
Remove empty representations from dash manifests
This commit is contained in:
parent
99b0b4f5b8
commit
aa3c1d930b
@ -4401,8 +4401,13 @@ get "/api/manifest/dash/id/:id" do |env|
|
|||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
{"audio/mp4", "audio/webm"}.each do |mime_type|
|
{"audio/mp4", "audio/webm"}.each do |mime_type|
|
||||||
|
mime_streams = audio_streams.select { |stream| stream["type"].starts_with? mime_type }
|
||||||
|
if mime_streams.empty?
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true) do
|
xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true) do
|
||||||
audio_streams.select { |stream| stream["type"].starts_with? mime_type }.each do |fmt|
|
mime_streams.each do |fmt|
|
||||||
codecs = fmt["type"].split("codecs=")[1].strip('"')
|
codecs = fmt["type"].split("codecs=")[1].strip('"')
|
||||||
bandwidth = fmt["bitrate"].to_i * 1000
|
bandwidth = fmt["bitrate"].to_i * 1000
|
||||||
itag = fmt["itag"]
|
itag = fmt["itag"]
|
||||||
@ -4423,9 +4428,14 @@ get "/api/manifest/dash/id/:id" do |env|
|
|||||||
end
|
end
|
||||||
|
|
||||||
{"video/mp4", "video/webm"}.each do |mime_type|
|
{"video/mp4", "video/webm"}.each do |mime_type|
|
||||||
|
mime_streams = video_streams.select { |stream| stream["type"].starts_with? mime_type }
|
||||||
|
if mime_streams.empty?
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
heights = [] of Int32
|
heights = [] of Int32
|
||||||
xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, scanType: "progressive") do
|
xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, scanType: "progressive") do
|
||||||
video_streams.select { |stream| stream["type"].starts_with? mime_type }.each do |fmt|
|
mime_streams.each do |fmt|
|
||||||
codecs = fmt["type"].split("codecs=")[1].strip('"')
|
codecs = fmt["type"].split("codecs=")[1].strip('"')
|
||||||
bandwidth = fmt["bitrate"]
|
bandwidth = fmt["bitrate"]
|
||||||
itag = fmt["itag"]
|
itag = fmt["itag"]
|
||||||
|
Loading…
Reference in New Issue
Block a user