Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/gillesdemey/Cumulus
Browse files Browse the repository at this point in the history
  • Loading branch information
gillesdemey committed Mar 2, 2016
2 parents 05d7f99 + 29e9c38 commit c09f579
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/js/actions/actionCreators.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,18 @@ actions = McFly.createActions({
fetchPlaylists: function() {
return SoundCloud.fetchPlaylists()
.then(function(playlists) {
return {
'actionType' : 'LOADED_PLAYLISTS',
'playlists' : playlists
}
return SoundCloud.fetchPlaylistLikes()
.then(function(likes) {
return {
'actionType' : 'LOADED_PLAYLISTS',
'playlists' : playlists.concat(likes)
}
})
})
.catch(function(ex) {
console.error(ex)
})
},

})

module.exports = actions
16 changes: 16 additions & 0 deletions app/js/utils/soundcloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,22 @@ SoundCloud.prototype.fetchPlaylists = function() {
})
}

SoundCloud.prototype.fetchPlaylistLikes = function() {
return this.makeRequest('e1/me/playlist_likes')
.then()
.bind(this)
.map(function(resp) {
return resp.playlist
})
.map(this._mapTrack)
.map(function(playlist) {
playlist.tracks = _.map(playlist.tracks, function(track) {
return this._mapTrack(track)
}.bind(this))
return playlist
})
}

SoundCloud.prototype.expandPlaylist = function(playlist) {
if (!playlist.hasOwnProperty('tracks_uri') || playlist.kind !== 'playlist')
return
Expand Down

0 comments on commit c09f579

Please sign in to comment.