Updated channel json with number of videos
This commit is contained in:
parent
f8c7e8f17a
commit
839743779b
|
@ -61,9 +61,12 @@ class Panel::Video::BackEnd::ChannelVideosController < OrbitBackendController
|
||||||
@data = Array.new
|
@data = Array.new
|
||||||
|
|
||||||
@channels.each do |channel|
|
@channels.each do |channel|
|
||||||
|
client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
|
||||||
|
@client_videos = client.videos_by(:user => channel.channel_name)
|
||||||
|
number_of_videos = @client_videos.videos.length
|
||||||
name = channel.channel_name
|
name = channel.channel_name
|
||||||
channel_id = channel.id.to_s
|
channel_id = channel.id.to_s
|
||||||
@data << { channel_name: name, channel_link: "http://ntue.tp.rulingcom.com/panel/video/back_end/channel_videos/get_channel_videos?channel_id=#{channel_id}"}
|
@data << { channel_name: name, channel_link: "http://ntue.tp.rulingcom.com/panel/video/back_end/channel_videos/get_channel_videos?channel_id=#{channel_id}", number_of_videos: number_of_videos }
|
||||||
end
|
end
|
||||||
|
|
||||||
render :json => JSON.pretty_generate(@data)
|
render :json => JSON.pretty_generate(@data)
|
||||||
|
|
Loading…
Reference in New Issue