diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-04-10 21:36:43 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-04-10 21:36:43 -0500 |
| commit | 2a4b643539eeb72ad1ff3ec0191bfcb3efa68d96 (patch) | |
| tree | 7482d44e5378121d7f46c84e01b61bbd65a94b59 /src | |
| parent | 21ef842a2e454915c635bb9edfeac7f7d70b0a5f (diff) | |
| download | invidious-2a4b643539eeb72ad1ff3ec0191bfcb3efa68d96.tar.gz invidious-2a4b643539eeb72ad1ff3ec0191bfcb3efa68d96.tar.bz2 invidious-2a4b643539eeb72ad1ff3ec0191bfcb3efa68d96.zip | |
Add label to fmt_stream
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 3 | ||||
| -rw-r--r-- | src/views/player/video.ecr | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 0be59055..911cf1a8 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -271,7 +271,8 @@ get "/watch" do |env| end end - fmt_stream = fmt_stream.uniq { |s| s["quality"] } + fmt_stream.each { |s| s.add("label", "#{s["quality"]} - #{s["type"].split(";")[0].split("/")[1]}") } + fmt_stream = fmt_stream.uniq { |s| s["label"] } video_streams = adaptive_fmts.compact_map { |s| s["type"].starts_with?("video") ? s : nil } video_streams = video_streams.uniq { |s| s["size"] } diff --git a/src/views/player/video.ecr b/src/views/player/video.ecr index f783b348..23d59c93 100644 --- a/src/views/player/video.ecr +++ b/src/views/player/video.ecr @@ -1,5 +1,5 @@ <video playsinline poster="<%= thumbnail %>" title="<%= HTML.escape(video.title) %>" id="player" class="video-js" data-setup="{}" controls> <% fmt_stream.each_with_index do |fmt, i| %> - <source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["quality"] %>" selected="<%= i == 0 ? true : false %>"> + <source src="<%= fmt["url"] %>" type='<%= fmt["type"] %>' label="<%= fmt["label"] %>" selected="<%= i == 0 ? true : false %>"> <% end %> </video>
\ No newline at end of file |
