Use tuples for "qualities" in API endpoints

This commit is contained in:
Omar Roth 2019-03-25 10:00:18 -05:00
parent 591a6b330a
commit fd84b57ac8

View file

@ -2847,7 +2847,7 @@ get "/api/v1/videos/:id" do |env|
json.field "authorThumbnails" do json.field "authorThumbnails" do
json.array do json.array do
qualities = [32, 48, 76, 100, 176, 512] qualities = {32, 48, 76, 100, 176, 512}
qualities.each do |quality| qualities.each do |quality|
json.object do json.object do
@ -3211,9 +3211,11 @@ get "/api/v1/channels/:ucid" do |env|
json.field "authorBanners" do json.field "authorBanners" do
json.array do json.array do
qualities = [{width: 2560, height: 424}, qualities = {
{width: 2120, height: 351}, {width: 2560, height: 424},
{width: 1060, height: 175}] {width: 2120, height: 351},
{width: 1060, height: 175},
}
qualities.each do |quality| qualities.each do |quality|
json.object do json.object do
json.field "url", banner.gsub("=w1060", "=w#{quality[:width]}") json.field "url", banner.gsub("=w1060", "=w#{quality[:width]}")
@ -3232,7 +3234,7 @@ get "/api/v1/channels/:ucid" do |env|
json.field "authorThumbnails" do json.field "authorThumbnails" do
json.array do json.array do
qualities = [32, 48, 76, 100, 176, 512] qualities = {32, 48, 76, 100, 176, 512}
qualities.each do |quality| qualities.each do |quality|
json.object do json.object do
@ -3302,7 +3304,7 @@ get "/api/v1/channels/:ucid" do |env|
json.field "authorThumbnails" do json.field "authorThumbnails" do
json.array do json.array do
qualities = [32, 48, 76, 100, 176, 512] qualities = {32, 48, 76, 100, 176, 512}
qualities.each do |quality| qualities.each do |quality|
json.object do json.object do
@ -3582,7 +3584,7 @@ get "/api/v1/channels/search/:ucid" do |env|
json.field "authorThumbnails" do json.field "authorThumbnails" do
json.array do json.array do
qualities = [32, 48, 76, 100, 176, 512] qualities = {32, 48, 76, 100, 176, 512}
qualities.each do |quality| qualities.each do |quality|
json.object do json.object do
@ -3707,7 +3709,7 @@ get "/api/v1/search" do |env|
json.field "authorThumbnails" do json.field "authorThumbnails" do
json.array do json.array do
qualities = [32, 48, 76, 100, 176, 512] qualities = {32, 48, 76, 100, 176, 512}
qualities.each do |quality| qualities.each do |quality|
json.object do json.object do
@ -3775,7 +3777,7 @@ get "/api/v1/playlists/:plid" do |env|
json.field "authorThumbnails" do json.field "authorThumbnails" do
json.array do json.array do
qualities = [32, 48, 76, 100, 176, 512] qualities = {32, 48, 76, 100, 176, 512}
qualities.each do |quality| qualities.each do |quality|
json.object do json.object do