Provider field in all assets, fixes #332
This commit is contained in:
@ -413,6 +413,9 @@ export let formatAlbum = function(data){
|
||||
if (data.album_type){
|
||||
album.type = data.album_type;
|
||||
}
|
||||
if (album.provider === undefined && album.uri !== undefined){
|
||||
album.provider = uriSource(album.uri);
|
||||
}
|
||||
|
||||
return album;
|
||||
}
|
||||
@ -475,6 +478,10 @@ export let formatArtist = function(data){
|
||||
}
|
||||
}
|
||||
|
||||
if (artist.provider === undefined && artist.uri !== undefined){
|
||||
artist.provider = uriSource(artist.uri);
|
||||
}
|
||||
|
||||
return artist;
|
||||
}
|
||||
|
||||
@ -534,6 +541,10 @@ export let formatPlaylist = function(data){
|
||||
playlist.uri = playlist.uri.replace(/spotify:user:([^:]*?):/i, "spotify:");
|
||||
}
|
||||
|
||||
if (playlist.provider === undefined && playlist.uri !== undefined){
|
||||
playlist.provider = uriSource(playlist.uri);
|
||||
}
|
||||
|
||||
return playlist;
|
||||
}
|
||||
|
||||
@ -604,6 +615,9 @@ export let formatUser = function(data){
|
||||
if (data.id && !user.name){
|
||||
user.name = data.id;
|
||||
}
|
||||
if (user.provider === undefined && user.uri !== undefined){
|
||||
user.provider = uriSource(user.uri);
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
@ -698,6 +712,10 @@ export let formatTrack = function(data){
|
||||
}
|
||||
}
|
||||
|
||||
if (track.provider === undefined && track.uri !== undefined){
|
||||
track.provider = uriSource(track.uri);
|
||||
}
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
|
||||
@ -571,9 +571,8 @@ const MopidyMiddleware = (function(){
|
||||
// playlist already in index
|
||||
if (store.getState().core.playlists.hasOwnProperty(action.uri)){
|
||||
|
||||
// make sure we didn't get this playlist from Mopidy-Spotify
|
||||
// if we did, we'd have a cached version on server so no need to fetch
|
||||
if (!store.getState().core.playlists[action.uri].is_mopidy){
|
||||
// Spotify-provied playlists need to be handled by the Spotify service
|
||||
if (store.getState().core.playlists[action.uri].provider == 'spotify'){
|
||||
store.dispatch(spotifyActions.getPlaylistTracksAndPlay(action.uri, action.shuffle))
|
||||
break
|
||||
}
|
||||
@ -1502,7 +1501,7 @@ const MopidyMiddleware = (function(){
|
||||
uri: response.uri,
|
||||
type: 'playlist',
|
||||
is_completely_loaded: true,
|
||||
is_mopidy: true,
|
||||
provider: 'mopidy',
|
||||
tracks: (response.tracks ? response.tracks : []),
|
||||
tracks_total: (response.tracks ? response.tracks.length : [])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user