This commit is contained in:
James Barnsley
2018-10-06 11:23:56 +13:00
parent 31ed15d907
commit 4c425b9137
2 changed files with 22 additions and 5 deletions

View File

@ -646,6 +646,9 @@ var formatAlbum = exports.formatAlbum = function formatAlbum(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;
}; };
@ -708,6 +711,10 @@ var formatArtist = exports.formatArtist = function formatArtist(data) {
} }
} }
if (artist.provider === undefined && artist.uri !== undefined) {
artist.provider = uriSource(artist.uri);
}
return artist; return artist;
}; };
@ -771,6 +778,10 @@ var formatPlaylist = exports.formatPlaylist = function formatPlaylist(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;
}; };
@ -872,6 +883,9 @@ var formatUser = exports.formatUser = function formatUser(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;
}; };
@ -968,6 +982,10 @@ var formatTrack = exports.formatTrack = function formatTrack(data) {
} }
} }
if (track.provider === undefined && track.uri !== undefined) {
track.provider = uriSource(track.uri);
}
return track; return track;
}; };
@ -55168,9 +55186,8 @@ var 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;
} }
@ -55928,7 +55945,7 @@ var 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 : []
}); });

File diff suppressed because one or more lines are too long