Skip to content

Commit c09f579

Browse files
committed
Merge branch 'master' of https://github.com/gillesdemey/Cumulus
2 parents 05d7f99 + 29e9c38 commit c09f579

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

app/js/actions/actionCreators.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,18 @@ actions = McFly.createActions({
183183
fetchPlaylists: function() {
184184
return SoundCloud.fetchPlaylists()
185185
.then(function(playlists) {
186-
return {
187-
'actionType' : 'LOADED_PLAYLISTS',
188-
'playlists' : playlists
189-
}
186+
return SoundCloud.fetchPlaylistLikes()
187+
.then(function(likes) {
188+
return {
189+
'actionType' : 'LOADED_PLAYLISTS',
190+
'playlists' : playlists.concat(likes)
191+
}
192+
})
190193
})
191194
.catch(function(ex) {
192195
console.error(ex)
193196
})
194197
},
195-
196198
})
197199

198200
module.exports = actions

app/js/utils/soundcloud.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,22 @@ SoundCloud.prototype.fetchPlaylists = function() {
158158
})
159159
}
160160

161+
SoundCloud.prototype.fetchPlaylistLikes = function() {
162+
return this.makeRequest('e1/me/playlist_likes')
163+
.then()
164+
.bind(this)
165+
.map(function(resp) {
166+
return resp.playlist
167+
})
168+
.map(this._mapTrack)
169+
.map(function(playlist) {
170+
playlist.tracks = _.map(playlist.tracks, function(track) {
171+
return this._mapTrack(track)
172+
}.bind(this))
173+
return playlist
174+
})
175+
}
176+
161177
SoundCloud.prototype.expandPlaylist = function(playlist) {
162178
if (!playlist.hasOwnProperty('tracks_uri') || playlist.kind !== 'playlist')
163179
return

0 commit comments

Comments
 (0)