Current track artwork force mopidy host:port like we do for albums

This commit is contained in:
James Barnsley
2017-05-06 23:14:57 +12:00
parent 3b85647341
commit 8b451c3e03
4 changed files with 29 additions and 15 deletions

View File

@ -1,6 +1,7 @@
var uiActions = require('../../services/ui/actions.js')
var helpers = require('../../helpers.js')
var uiActions = require('../../services/ui/actions')
var lastfmActions = require('../../services/lastfm/actions')
var helpers = require('../../helpers')
/**
* Send an ajax request to the Spotify API
@ -648,7 +649,14 @@ export function getArtist( uri ){
Object.assign(artist, { related_artists_uris: helpers.asURIs(response.artists) });
})
).then( () => {
).then(() => {
if (artist.musicbrainz_id){
dispatch(lastfmActions.getArtist(artist.uri, false, artist.musicbrainz_id))
} else {
dispatch(lastfmActions.getArtist(artist.uri, artist.name.replace('&','and')))
}
dispatch({
type: 'ARTIST_LOADED',
key: artist.uri,

View File

@ -1,7 +1,7 @@
var helpers = require('./../../helpers.js')
var spotifyActions = require('./actions.js')
var uiActions = require('../ui/actions.js')
var helpers = require('./../../helpers')
var spotifyActions = require('./actions')
var uiActions = require('../ui/actions')
const SpotifyMiddleware = (function(){

View File

@ -363,7 +363,21 @@ const UIMiddleware = (function(){
break
case 'MOPIDY_CURRENTTLTRACK':
if( action.data && action.data.track ) helpers.setWindowTitle(action.data.track, store.getState().mopidy.play_state)
if (action.data && action.data.track ){
helpers.setWindowTitle(action.data.track, store.getState().mopidy.play_state)
// make sure our images use mopidy host:port
if (action.data.track.album && action.data.track.album.images && action.data.track.album.images.length > 0){
var images = Object.assign([], action.data.track.album.images)
for (var i = 0; i < images.length; i++){
if (typeof(images[i]) === 'string' && images[i].startsWith('/images/')){
images[i] = '//'+store.getState().mopidy.host+':'+store.getState().mopidy.port+images[i]
}
}
action.data.track.album.images = images
}
}
next(action)
break

View File

@ -44,14 +44,6 @@ class Artist extends React.Component{
}
}
componentWillUpdate( nextProps, nextState ){
if (nextProps.params.sub_view != this.props.params.sub_view && nextProps.params.sub_view == 'about'){
if (this.props.artist && !this.props.artist.bio){
this.props.lastfmActions.getArtist( this.props.params.uri, this.props.artist.name.replace('&','and') )
}
}
}
handleContextMenu(e){
var data = {
e: e,