diff --git a/mopidy_iris/frontend.py b/mopidy_iris/frontend.py index 09ca4e90..c68c99b0 100755 --- a/mopidy_iris/frontend.py +++ b/mopidy_iris/frontend.py @@ -98,7 +98,7 @@ class IrisFrontend(pykka.ThreadingActor, CoreListener): self.load_more_tracks() except RuntimeError: - logger.warning('RadioHandler: Could not fetch tracklist length') + logger.warning('IrisFrontend: Could not fetch tracklist length') pass @@ -156,7 +156,7 @@ class IrisFrontend(pykka.ThreadingActor, CoreListener): self.core.playback.play() # notify clients - pusher.broadcast( 'radio_started', { 'radio': self.radio }) + pusher.broadcast( 'radio', { 'radio': self.radio }) # return new radio state to initial call return self.radio @@ -178,7 +178,7 @@ class IrisFrontend(pykka.ThreadingActor, CoreListener): self.core.playback.stop() # notify clients - pusher.broadcast( 'radio_stopped', { 'radio': self.radio }) + pusher.broadcast( 'radio', { 'radio': self.radio }) # return new radio state to initial call return self.radio diff --git a/mopidy_iris/pusher.py b/mopidy_iris/pusher.py index 1ebffe33..e741053e 100755 --- a/mopidy_iris/pusher.py +++ b/mopidy_iris/pusher.py @@ -194,7 +194,7 @@ class PusherWebsocketHandler(tornado.websocket.WebSocketHandler): send_message( self.connectionid, 'response', - 'radio_started', + 'radio', messageJson['message_id'], { 'radio': radio } ) @@ -205,7 +205,7 @@ class PusherWebsocketHandler(tornado.websocket.WebSocketHandler): send_message( self.connectionid, 'response', - messageJson['action'], + 'radio', messageJson['message_id'], { 'radio': self.frontend.radio } ) @@ -215,7 +215,7 @@ class PusherWebsocketHandler(tornado.websocket.WebSocketHandler): send_message( self.connectionid, 'response', - messageJson['action'], + 'radio', messageJson['message_id'], { 'radio': self.frontend.radio } ) diff --git a/src/js/services/pusher/actions.js b/src/js/services/pusher/actions.js index 7a6abb62..42c8ed28 100755 --- a/src/js/services/pusher/actions.js +++ b/src/js/services/pusher/actions.js @@ -50,7 +50,7 @@ export function startRadio( uris ){ } } -export function stopRadio( uris ){ +export function stopRadio(){ return { type: 'PUSHER_STOP_RADIO' } diff --git a/src/js/services/pusher/middleware.js b/src/js/services/pusher/middleware.js index b0f2b165..1be34f16 100755 --- a/src/js/services/pusher/middleware.js +++ b/src/js/services/pusher/middleware.js @@ -189,6 +189,16 @@ const PusherMiddleware = (function(){ makeRequest( data ) break + case 'PUSHER_STOP_RADIO': + var data = { + action: 'stop_radio', + seed_artists: [], + seed_genres: [], + seed_tracks: [] + } + makeRequest( data ) + break + // This action is irrelevant to us, pass it on to the next middleware default: return next(action); diff --git a/src/js/services/ui/reducer.js b/src/js/services/ui/reducer.js index 9c6f73e0..a1daa1bc 100755 --- a/src/js/services/ui/reducer.js +++ b/src/js/services/ui/reducer.js @@ -119,7 +119,7 @@ export default function reducer(ui = {}, action){ case 'PUSHER_RADIO': case 'PUSHER_START_RADIO': - return Object.assign({}, ui, { radio: action.data }) + return Object.assign({}, ui, { radio: action.data.radio }) diff --git a/src/js/views/Queue.js b/src/js/views/Queue.js index 95b11e21..0bee23bf 100755 --- a/src/js/views/Queue.js +++ b/src/js/views/Queue.js @@ -12,6 +12,7 @@ import ArtistSentence from '../components/ArtistSentence' import Header from '../components/Header' import * as uiActions from '../services/ui/actions' +import * as pusherActions from '../services/pusher/actions' import * as spotifyActions from '../services/spotify/actions' import * as mopidyActions from '../services/mopidy/actions' @@ -42,12 +43,12 @@ class Queue extends React.Component{ } renderRadio(){ - if (!this.props.radio) return null + if (!this.props.radio || !this.props.radio.enabled) return null return (