LastFM for supporting imagery; Album wiki from LastFM; fixes #369

This commit is contained in:
James Barnsley
2019-02-20 21:08:48 +13:00
parent 602c9d1fa1
commit 4d62e33109
13 changed files with 4182 additions and 3406 deletions

View File

@ -272,20 +272,24 @@ export function getAlbum(uri, artist, album, mbid = false){
.then(
response => {
if (response.album){
var existing_album = getState().core.albums[uri];
var album = {
uri: uri,
images: response.album.image,
listeners: response.album.listeners,
play_count: response.album.playcount,
mbid: response.album.mbid
mbid: response.album.mbid,
wiki: (response.album.wiki ? response.album.wiki.content : null),
wiki_publish_date: (response.album.wiki ? response.album.wiki.published : null),
};
if (response.album.wiki){
album.wiki = response.album.wiki.content;
if (response.album.wiki.published){
album.wiki_publish_date = response.album.wiki.published;
}
// If we've already got some of this album and it has images aready, don't use our ones.
// In *most* cases this existing image will be perfectly suffice. This prevents an ugly
// flicker when the existing image is replaced by the LastFM one
if (existing_album && existing_album.images){
delete album.images;
}
dispatch(coreActions.albumLoaded(album));