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