From 2988f8f4a7ce2907e3b56f07f190a0dce1a93ffa Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Thu, 13 Feb 2020 16:59:35 +1300 Subject: [PATCH] Attempting to get stdout from scan --- mopidy_iris/system.sh | 6 +++--- src/js/components/Fields/FollowButton.js | 2 +- .../Fields/GeniusAuthenticationFrame.js | 8 ++++---- .../Fields/LastfmAuthenticationFrame.js | 6 +++--- src/js/components/Fields/LastfmLoveButton.js | 8 ++++---- .../Fields/SpotifyAuthenticationFrame.js | 6 +++--- src/js/components/Notifications.js | 2 +- src/js/components/TrackList.js | 4 ++-- src/js/services/core/middleware.js | 20 +++++++++---------- src/js/services/mopidy/middleware.js | 14 ++++++------- src/js/services/pusher/middleware.js | 10 +++++----- src/js/services/spotify/actions.js | 4 ++-- src/js/views/library/LibraryTracks.js | 2 +- 13 files changed, 46 insertions(+), 46 deletions(-) diff --git a/mopidy_iris/system.sh b/mopidy_iris/system.sh index 91049ab3..f063e61f 100755 --- a/mopidy_iris/system.sh +++ b/mopidy_iris/system.sh @@ -27,9 +27,9 @@ elif [[ $1 = "restart" ]]; then elif [[ $1 = "local_scan" ]]; then if $IS_CONTAINER; then - SCAN="$(mopidy --config /config/mopidy.conf local scan)" + SCAN="$(mopidy --config /config/mopidy.conf local scan 2>&1)" else - SCAN="$(sudo mopidyctl local scan)" + SCAN="$(sudo mopidyctl local scan 2>&1)" fi echo -e "${SCAN}" @@ -37,7 +37,7 @@ elif [[ $1 = "check" ]]; then echo -e "Access permitted" elif [[ $1 = "test" ]]; then - sleep 1 + sleep 3 TEST=$(echo "Hello, this is your bash speaking. I was sleeping for 3 seconds. Is running a container: $IS_CONTAINER") echo -e "${TEST}" diff --git a/src/js/components/Fields/FollowButton.js b/src/js/components/Fields/FollowButton.js index 327a1e99..0d2231c4 100755 --- a/src/js/components/Fields/FollowButton.js +++ b/src/js/components/Fields/FollowButton.js @@ -51,7 +51,7 @@ class FollowButton extends React.Component { diff --git a/src/js/components/Fields/GeniusAuthenticationFrame.js b/src/js/components/Fields/GeniusAuthenticationFrame.js index 84e10098..e37eab45 100755 --- a/src/js/components/Fields/GeniusAuthenticationFrame.js +++ b/src/js/components/Fields/GeniusAuthenticationFrame.js @@ -38,13 +38,13 @@ class GeniusAuthenticationFrame extends React.Component { // Only allow incoming data from our authorized authenticator proxy const authorization_domain = this.props.authorization_url.substring(0, this.props.authorization_url.indexOf('/', 8)); if (event.origin != authorization_domain) { - this.props.uiActions.createNotification({ content: `Authorization failed. ${event.origin} is not the configured authorization_url.`, type: 'bad' }); + this.props.uiActions.createNotification({ content: `Authorization failed. ${event.origin} is not the configured authorization_url.`, level: 'error' }); return false; } // Bounced with an error if (data.error !== undefined) { - this.props.uiActions.createNotification({ content: data.message, type: 'bad' }); + this.props.uiActions.createNotification({ content: data.message, level: 'error' }); // No errors? We're in! } else { @@ -77,7 +77,7 @@ class GeniusAuthenticationFrame extends React.Component { // Popup does not exist, so must have been blocked } else { - self.props.uiActions.createNotification({ content: 'Popup blocked. Please allow popups and try again.', type: 'bad' }); + self.props.uiActions.createNotification({ content: 'Popup blocked. Please allow popups and try again.', level: 'error' }); self.setState({ authorizing: false }); clearInterval(timer); } @@ -86,7 +86,7 @@ class GeniusAuthenticationFrame extends React.Component { render() { const { authorizing } = this.state; - + if (this.props.authorized) { return ( this.props.geniusActions.revokeAuthorization()}>Log out diff --git a/src/js/components/Fields/LastfmAuthenticationFrame.js b/src/js/components/Fields/LastfmAuthenticationFrame.js index 15f07ab2..194acbfa 100755 --- a/src/js/components/Fields/LastfmAuthenticationFrame.js +++ b/src/js/components/Fields/LastfmAuthenticationFrame.js @@ -38,13 +38,13 @@ class LastfmAuthenticationFrame extends React.Component { // Only allow incoming data from our authorized authenticator proxy const authorization_domain = this.props.authorization_url.substring(0, this.props.authorization_url.indexOf('/', 8)); if (event.origin != authorization_domain) { - this.props.uiActions.createNotification({ content: `Authorization failed. ${event.origin} is not the configured authorization_url.`, type: 'bad' }); + this.props.uiActions.createNotification({ content: `Authorization failed. ${event.origin} is not the configured authorization_url.`, level: 'error' }); return false; } // Bounced with an error if (data.error !== undefined) { - this.props.uiActions.createNotification({ content: data.message, type: 'bad' }); + this.props.uiActions.createNotification({ content: data.message, level: 'error' }); // No errors? We're in! } else { @@ -77,7 +77,7 @@ class LastfmAuthenticationFrame extends React.Component { // Popup does not exist, so must have been blocked } else { - self.props.uiActions.createNotification({ content: 'Popup blocked. Please allow popups and try again.', type: 'bad' }); + self.props.uiActions.createNotification({ content: 'Popup blocked. Please allow popups and try again.', level: 'error' }); self.setState({ authorizing: false }); clearInterval(timer); } diff --git a/src/js/components/Fields/LastfmLoveButton.js b/src/js/components/Fields/LastfmLoveButton.js index 09f9e189..94f01987 100755 --- a/src/js/components/Fields/LastfmLoveButton.js +++ b/src/js/components/Fields/LastfmLoveButton.js @@ -8,7 +8,7 @@ import * as helpers from '../../helpers'; import * as uiActions from '../../services/ui/actions'; import * as lastfmActions from '../../services/lastfm/actions'; -class FollowButton extends React.Component { +class FollowButton extends React.Component { constructor(props) { super(props); } @@ -34,11 +34,11 @@ class FollowButton extends React.Component { } if (!this.props.lastfm_authorized) { - return ; + return ; } if (this.props.is_loved && this.props.is_loved !== '0') { return ; } - return ; + return ; } } @@ -52,4 +52,4 @@ const mapDispatchToProps = (dispatch) => ({ lastfmActions: bindActionCreators(lastfmActions, dispatch), }); -export default connect(mapStateToProps, mapDispatchToProps)(FollowButton); +export default connect(mapStateToProps, mapDispatchToProps)(FollowButton); diff --git a/src/js/components/Fields/SpotifyAuthenticationFrame.js b/src/js/components/Fields/SpotifyAuthenticationFrame.js index 93b2bdd7..463a1063 100755 --- a/src/js/components/Fields/SpotifyAuthenticationFrame.js +++ b/src/js/components/Fields/SpotifyAuthenticationFrame.js @@ -38,13 +38,13 @@ class SpotifyAuthenticationFrame extends React.Component { // Only allow incoming data from our authorized authenticator proxy const authorization_domain = this.props.authorization_url.substring(0, this.props.authorization_url.indexOf('/', 8)); if (event.origin != authorization_domain) { - this.props.uiActions.createNotification({ content: `Authorization failed. ${event.origin} is not the configured authorization_url.`, type: 'bad' }); + this.props.uiActions.createNotification({ content: `Authorization failed. ${event.origin} is not the configured authorization_url.`, level: 'error' }); return false; } // Spotify bounced with an error if (data.error !== undefined) { - this.props.uiActions.createNotification({ content: data.error, type: 'bad' }); + this.props.uiActions.createNotification({ content: data.error, level: 'error' }); // No errors? We're in! } else { @@ -92,7 +92,7 @@ class SpotifyAuthenticationFrame extends React.Component { // Popup does not exist, so must have been blocked } else { - self.props.uiActions.createNotification({ content: 'Popup blocked. Please allow popups and try again.', type: 'bad' }); + self.props.uiActions.createNotification({ content: 'Popup blocked. Please allow popups and try again.', level: 'error' }); self.setState({ authorizing: false }); clearInterval(timer); } diff --git a/src/js/components/Notifications.js b/src/js/components/Notifications.js index 50b589b9..b64c0691 100755 --- a/src/js/components/Notifications.js +++ b/src/js/components/Notifications.js @@ -40,7 +40,7 @@ class Notifications extends React.Component { } this.props.uiActions.removeNotification(notification_key, true); - this.props.uiActions.createNotification({ type: 'info', content: 'Import successful' }); + this.props.uiActions.createNotification({ level: 'warning', content: 'Import successful' }); } renderNotifications() { diff --git a/src/js/components/TrackList.js b/src/js/components/TrackList.js index cd6af6d4..aab5806f 100755 --- a/src/js/components/TrackList.js +++ b/src/js/components/TrackList.js @@ -290,7 +290,7 @@ class TrackList extends React.Component { const selected_tracks_indexes = helpers.arrayOf('index', selected_tracks); if (selected_tracks.length <= 0) { - return this.props.uiActions.createNotification({ content: 'No tracks selected', type: 'bad' }); + return this.props.uiActions.createNotification({ content: 'No tracks selected', level: 'error' }); } // Our parent handles playing @@ -313,7 +313,7 @@ class TrackList extends React.Component { // No handler? We can't really do anything then, so notify user } - this.props.uiActions.createNotification({ content: `Cannot delete ${selected_tracks.length > 1 ? 'these tracks' : 'this track'}`, type: 'bad' }); + this.props.uiActions.createNotification({ content: `Cannot delete ${selected_tracks.length > 1 ? 'these tracks' : 'this track'}`, level: 'error' }); } diff --git a/src/js/services/core/middleware.js b/src/js/services/core/middleware.js index d91dca13..a6d590d0 100755 --- a/src/js/services/core/middleware.js +++ b/src/js/services/core/middleware.js @@ -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; diff --git a/src/js/services/mopidy/middleware.js b/src/js/services/mopidy/middleware.js index 14c59bfd..a6a772fe 100755 --- a/src/js/services/mopidy/middleware.js +++ b/src/js/services/mopidy/middleware.js @@ -639,7 +639,7 @@ const MopidyMiddleware = (function () { .then( (response) => { if (!response || response.tracks === undefined || !response.tracks) { - store.dispatch(uiActions.createNotification({ content: 'Failed to load playlist tracks', type: 'bad' })); + store.dispatch(uiActions.createNotification({ content: 'Failed to load playlist tracks', level: 'error' })); } else { let tracks_uris = helpers.arrayOf('uri', response.tracks); if (action.shuffle) { @@ -691,7 +691,7 @@ const MopidyMiddleware = (function () { .then( (response) => { if (response.tracks === undefined) { - store.dispatch(uiActions.createNotification({ content: 'Failed to load playlist tracks', type: 'bad' })); + store.dispatch(uiActions.createNotification({ content: 'Failed to load playlist tracks', level: 'error' })); } else { let tracks_uris = helpers.arrayOf('uri', response.tracks); if (action.shuffle) { @@ -712,7 +712,7 @@ const MopidyMiddleware = (function () { case 'MOPIDY_ENQUEUE_URIS': if (!action.uris || action.uris.length <= 0) { - this.props.uiActions.createNotification({ content: 'No URIs to enqueue', type: 'warning' }); + this.props.uiActions.createNotification({ content: 'No URIs to enqueue', level: 'warning' }); break; } @@ -855,7 +855,7 @@ const MopidyMiddleware = (function () { let urisToPlay = Object.assign([], action.uris); if (!urisToPlay || !urisToPlay.length) { - this.props.uiActions.createNotification({ content: 'No URIs to play', type: 'warning' }); + this.props.uiActions.createNotification({ content: 'No URIs to play', level: 'warning' }); break; } @@ -983,7 +983,7 @@ const MopidyMiddleware = (function () { var uri_scheme = uri_schemes.shift(); if (uri_schemes_total <= 0) { - store.dispatch(uiActions.createNotification({ content: 'No sources selected', type: 'warning' })); + store.dispatch(uiActions.createNotification({ content: 'No sources selected', level: 'warning' })); } else { store.dispatch(uiActions.startProcess( 'MOPIDY_GET_SEARCH_RESULTS_PROCESSOR', @@ -1745,7 +1745,7 @@ const MopidyMiddleware = (function () { store.dispatch(coreActions.playlistLoaded(playlist)); - store.dispatch(uiActions.createNotification({ type: 'info', content: 'Playlist saved' })); + store.dispatch(uiActions.createNotification({ level: 'warning', content: 'Playlist saved' })); }); }); break; @@ -1793,7 +1793,7 @@ const MopidyMiddleware = (function () { case 'MOPIDY_CREATE_PLAYLIST': request(socket, store, 'playlists.create', { name: action.name, uri_scheme: action.scheme }) .then((response) => { - store.dispatch(uiActions.createNotification({ type: 'info', content: 'Created playlist' })); + store.dispatch(uiActions.createNotification({ level: 'warning', content: 'Created playlist' })); store.dispatch(coreActions.playlistLoaded(response)); store.dispatch({ type: 'MOPIDY_LIBRARY_PLAYLIST_CREATED', diff --git a/src/js/services/pusher/middleware.js b/src/js/services/pusher/middleware.js index 74010817..39564138 100755 --- a/src/js/services/pusher/middleware.js +++ b/src/js/services/pusher/middleware.js @@ -342,7 +342,7 @@ const PusherMiddleware = (function () { request(store, 'send_message', action.data) .then( (response) => { - store.dispatch(uiActions.createNotification({ type: 'info', content: 'Message delivered' })); + store.dispatch(uiActions.createNotification({ level: 'warning', content: 'Message delivered' })); }, (error) => { store.dispatch(coreActions.handleException( @@ -550,7 +550,7 @@ const PusherMiddleware = (function () { console.log('Command response', response); store.dispatch(uiActions.removeProcess(notification_key)); if (action.notify) { - store.dispatch(uiActions.createNotification({ key: notification_key, type: 'info', content: 'Command sent' })); + store.dispatch(uiActions.createNotification({ key: notification_key, level: 'warning', content: 'Command sent' })); } }, (error) => { @@ -629,7 +629,7 @@ const PusherMiddleware = (function () { 'notification', { notification: { - type: 'info', + level: 'warning', content: `${pusher.username} is starting radio mode`, }, }, @@ -641,7 +641,7 @@ const PusherMiddleware = (function () { (response) => { store.dispatch(uiActions.processFinished('PUSHER_RADIO_PROCESS')); if (response.status == 0) { - store.dispatch(uiActions.createNotification({ content: response.message, type: 'bad' })); + store.dispatch(uiActions.createNotification({ content: response.message, level: 'error' })); } store.dispatch(pusherActions.radioChanged(response.radio)); }, @@ -666,7 +666,7 @@ const PusherMiddleware = (function () { 'notification', { notification: { - type: 'info', + level: 'warning', content: `${pusher.username} stopped radio mode`, }, }, diff --git a/src/js/services/spotify/actions.js b/src/js/services/spotify/actions.js index 4e54c2d5..785fd406 100755 --- a/src/js/services/spotify/actions.js +++ b/src/js/services/spotify/actions.js @@ -1387,7 +1387,7 @@ export function createPlaylist(name, description, is_public, is_collaborative) { uris: [response.uri], }); - dispatch(uiActions.createNotification({ type: 'info', content: 'Created playlist' })); + dispatch(uiActions.createNotification({ level: 'warning', content: 'Created playlist' })); }, (error) => { dispatch(coreActions.handleException( @@ -1414,7 +1414,7 @@ export function savePlaylist(uri, name, description, is_public, is_collaborative ) .then( (response) => { - dispatch(uiActions.createNotification({ type: 'info', content: 'Playlist saved' })); + dispatch(uiActions.createNotification({ level: 'warning', content: 'Playlist saved' })); // Save the image if (image) { diff --git a/src/js/views/library/LibraryTracks.js b/src/js/views/library/LibraryTracks.js index a6b024ba..56f906f6 100755 --- a/src/js/views/library/LibraryTracks.js +++ b/src/js/views/library/LibraryTracks.js @@ -24,7 +24,7 @@ class LibraryTracks extends React.Component { this.props.uiActions.setWindowTitle('Tracks'); if (!this.props.spotify_me) { - this.props.uiActions.createNotification({ type: 'warning', content: 'Enable Spotify to browse tracks' }); + this.props.uiActions.createNotification({ level: 'warning', content: 'Enable Spotify to browse tracks' }); } else if (this.props.library_tracks === undefined) { this.props.spotifyActions.getLibraryTracks(); }