Using mopidy image processor
This commit is contained in:
@ -80,7 +80,6 @@ const CoreMiddleware = (function(){
|
||||
case 'TRACK_LOADED':
|
||||
if (action.data) ReactGA.event({ category: 'Track', action: 'Load', label: action.key });
|
||||
|
||||
// make sure our images use mopidy host:port
|
||||
if (action.track.album && action.track.album.images && action.track.album.images.length > 0){
|
||||
action.track.album.images = helpers.digestMopidyImages(store.getState().mopidy, action.track.album.images);
|
||||
}
|
||||
@ -91,15 +90,8 @@ const CoreMiddleware = (function(){
|
||||
case 'ALBUM_LOADED':
|
||||
if (action.data) ReactGA.event({ category: 'Album', action: 'Load', label: action.key })
|
||||
|
||||
// make sure our images use mopidy host:port
|
||||
if (action.album.images && action.album.images.length > 0){
|
||||
var images = Object.assign([], action.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.album.images = images
|
||||
action.album.images = helpers.digestMopidyImages(store.getState().mopidy, action.album.images);
|
||||
}
|
||||
|
||||
next(action)
|
||||
@ -109,16 +101,8 @@ const CoreMiddleware = (function(){
|
||||
if (action.data) ReactGA.event({ category: 'Albums', action: 'Load', label: action.albums.length+' items' })
|
||||
|
||||
for (var i = 0; i < action.albums.length; i++){
|
||||
|
||||
// make sure our images use mopidy host:port
|
||||
if (action.albums[i].images && action.albums[i].images.length > 0){
|
||||
var images = Object.assign([], action.albums[i].images)
|
||||
for (var j = 0; j < images.length; j++){
|
||||
if (typeof(images[j]) === 'string' && images[j].startsWith('/images/')){
|
||||
images[j] = '//'+store.getState().mopidy.host+':'+store.getState().mopidy.port+images[j]
|
||||
}
|
||||
}
|
||||
action.albums[i].images = images
|
||||
action.albums[i].images = helpers.digestMopidyImages(store.getState().mopidy, action.albums[i].images);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1735,13 +1735,12 @@ const MopidyMiddleware = (function(){
|
||||
instruct(socket, store, 'library.getImages', {uris: action.uris})
|
||||
.then(response => {
|
||||
|
||||
let records = []
|
||||
var records = []
|
||||
for (var uri in response){
|
||||
if (response.hasOwnProperty(uri)){
|
||||
|
||||
let images = response[uri]
|
||||
images = helpers.digestMopidyImages(store.getState().mopidy, images)
|
||||
|
||||
var images = response[uri];
|
||||
images = helpers.digestMopidyImages(store.getState().mopidy, images);
|
||||
records.push({
|
||||
uri: uri,
|
||||
images: images
|
||||
@ -1749,7 +1748,7 @@ const MopidyMiddleware = (function(){
|
||||
}
|
||||
}
|
||||
|
||||
let action_data = {
|
||||
var action_data = {
|
||||
type: (action.context+'_LOADED').toUpperCase()
|
||||
}
|
||||
action_data[action.context] = records
|
||||
|
||||
Reference in New Issue
Block a user