Skip to content

Commit

Permalink
Show number of songs in a playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeop committed Feb 9, 2017
1 parent 87c1a29 commit c89cfe5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/api/Youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,21 @@ function youtubePlaylistSearch(terms, searchResults, songListChangeCallback) {
length: "N/A",
}
};
searchResults.push(newYoutubePlaylistItem);

Axios.get(prepareUrl("https://www.googleapis.com/youtube/v3/playlists?part=id,contentDetails,snippet&id="+el.id.playlistId))
.then((response) => {
newYoutubePlaylistItem.data.length = response.data.items[0].contentDetails.itemCount;

searchResults.push(newYoutubePlaylistItem);

songListChangeCallback.bind(_this)(searchResults);
_this.setState({songList: searchResults});
});


});

songListChangeCallback.bind(_this)(searchResults);
_this.setState({songList: searchResults});

});
}

Expand All @@ -132,6 +142,7 @@ function youtubeGetSongsFromPlaylist(playlistId, callback) {
Axios.get(prepareUrl("https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,contentDetails&maxResults=50&playlistId="+playlistId))
.then((response) => {
response.data.items.map((el, i) => {

if (el.snippet.description==='This video is unavailable.') {
return;
}
Expand Down

0 comments on commit c89cfe5

Please sign in to comment.