Attempting to get stdout from scan

This commit is contained in:
James Barnsley
2020-02-13 16:59:35 +13:00
parent 571c857814
commit 2988f8f4a7
13 changed files with 46 additions and 46 deletions

View File

@ -9,14 +9,14 @@ const spotifyActions = require('../spotify/actions.js');
const lastfmActions = require('../lastfm/actions.js');
const helpers = require('../../helpers.js');
const CoreMiddleware = (function () {
const CoreMiddleware = (function () {
/**
* The actual middleware inteceptor
* */
return (store) => (next) => (action) => {
const { core } = store.getState();
switch (action.type) {
switch (action.type) {
case 'HANDLE_EXCEPTION':
// Construct meaningful message and description
@ -78,7 +78,7 @@ const CoreMiddleware = (function () {
}
if (action.show_notification) {
store.dispatch(uiActions.createNotification({ content: message, type: 'bad', description }));
store.dispatch(uiActions.createNotification({ content: message, level: 'error', description }));
}
console.error(message, description, data);
@ -227,8 +227,8 @@ const CoreMiddleware = (function () {
break;
case 'PLAYLIST_TRACKS_ADDED':
store.dispatch(uiActions.createNotification({ type: 'info', content: `Added ${action.tracks_uris.length} tracks to playlist` }));
switch (helpers.uriSource(action.key)) {
store.dispatch(uiActions.createNotification({ level: 'warning', content: `Added ${action.tracks_uris.length} tracks to playlist` }));
switch (helpers.uriSource(action.key)) {
case 'spotify':
store.dispatch(spotifyActions.getPlaylist(action.key));
break;
@ -603,7 +603,7 @@ const CoreMiddleware = (function () {
var artist = helpers.formatArtist(raw_artist);
// Already have an artist in the index
if (artists_index[artist.uri]) {
if (artists_index[artist.uri]) {
// And we've already got some images, make sure we merge the arrays,
// rather than overwriting
if (artists_index[artist.uri].images && artist.images) {
@ -612,7 +612,7 @@ const CoreMiddleware = (function () {
// loop all extisting images to make sure we're not adding one that
// we already have
for (const existing_image of existing_images) {
for (const existing_image of existing_images) {
// We only need to check one size, the formatter should insist on consistency
// Note that we depend on having a one-item array of images provided per action
if (existing_image.huge == artist.images[0].huge) {
@ -654,11 +654,11 @@ const CoreMiddleware = (function () {
var playlists_loaded = [];
var tracks_loaded = [];
for (var playlist of action.playlists) {
for (var playlist of action.playlists) {
playlist = helpers.formatPlaylist(playlist);
// Detect editability
switch (helpers.uriSource(playlist.uri)) {
switch (helpers.uriSource(playlist.uri)) {
case 'm3u':
playlist.can_edit = true;
break;
@ -797,7 +797,7 @@ const CoreMiddleware = (function () {
default:
return next(action);
}
};
};
}());
export default CoreMiddleware;