diff --git a/mopidy_iris/__init__.py b/mopidy_iris/__init__.py index 26b280aa..e54741b9 100755 --- a/mopidy_iris/__init__.py +++ b/mopidy_iris/__init__.py @@ -15,7 +15,7 @@ __version__ = '2.11.3' # # Loads config and gets the party started. Initiates any additional frontends, etc. ## -class IrisExtension( ext.Extension ): +class Extension( ext.Extension ): dist_name = 'Mopidy-Iris' ext_name = 'iris' @@ -26,9 +26,11 @@ class IrisExtension( ext.Extension ): return config.read(conf_file) def get_config_schema(self): - schema = super(IrisExtension, self).get_config_schema() - schema['debug'] = config.Boolean() + schema = config.ConfigSchema(self.ext_name) + schema['enabled'] = config.Boolean() schema['pusherport'] = config.String() + schema['country'] = config.String() + schema['locale'] = config.String() return schema def setup(self, registry): diff --git a/mopidy_iris/ext.conf b/mopidy_iris/ext.conf index 71f06613..8cd62fcf 100755 --- a/mopidy_iris/ext.conf +++ b/mopidy_iris/ext.conf @@ -1,4 +1,5 @@ [iris] enabled = true -debug = false -pusherport = 6681 \ No newline at end of file +pusherport = 6681 +country = NZ +locale = en_NZ \ No newline at end of file diff --git a/mopidy_iris/frontend.py b/mopidy_iris/frontend.py index da07748b..d08491be 100755 --- a/mopidy_iris/frontend.py +++ b/mopidy_iris/frontend.py @@ -189,6 +189,17 @@ class IrisFrontend(pykka.ThreadingActor, CoreListener): def get_spotify_token( self ): return self.spotify_token + + # get our config values + def get_config( self ): + all_config = self.config + config = { + "spotify_username": all_config['spotify']['username'], + "country": all_config['iris']['country'], + "locale": all_config['iris']['locale'] + } + return config + ## # Get Spotmop version, and check for updates diff --git a/mopidy_iris/pusher.py b/mopidy_iris/pusher.py index 8adb767f..13047a14 100755 --- a/mopidy_iris/pusher.py +++ b/mopidy_iris/pusher.py @@ -188,6 +188,15 @@ class PusherWebsocketHandler(tornado.websocket.WebSocketHandler): { 'error': 'Could not send to that connection, does not exist' } ) + # fetch our pusher connections + elif messageJson['action'] == 'get_config': + send_message( + self.connectionid, + 'response', + messageJson['request_id'], + { 'config': self.frontend.get_config() } + ) + # fetch our pusher connections elif messageJson['action'] == 'get_connections': @@ -266,7 +275,7 @@ class PusherWebsocketHandler(tornado.websocket.WebSocketHandler): { 'version': version } ) - # get system version and check for upgrade + # perform upgrade elif messageJson['action'] == 'upgrade': version = self.frontend.get_version() upgrade_successful = self.frontend.perform_upgrade() @@ -290,7 +299,7 @@ class PusherWebsocketHandler(tornado.websocket.WebSocketHandler): { 'error': 'Unhandled action' } ) - logger.debug( 'Pusher: Message received from '+ self.connectionid ) + logger.debug( 'Pusher: Unhandled message received from '+ self.connectionid ) # connection closed def on_close(self): diff --git a/setup.py b/setup.py index 446656a7..3df0588c 100755 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ setup( ], entry_points={ 'mopidy.ext': [ - 'iris = mopidy_iris:IrisExtension', + 'iris = mopidy_iris:Extension', ], }, ) diff --git a/src/js/bootstrap.js b/src/js/bootstrap.js index 477c24f1..b174b7df 100755 --- a/src/js/bootstrap.js +++ b/src/js/bootstrap.js @@ -49,8 +49,6 @@ var initialState = { }, spotify: { connected: false, - country: 'NZ', - locale: 'en_NZ', me: false }, ui: { diff --git a/src/js/components/Modal/CreatePlaylistModal.js b/src/js/components/Modal/CreatePlaylistModal.js index 7033218c..bf009fe0 100755 --- a/src/js/components/Modal/CreatePlaylistModal.js +++ b/src/js/components/Modal/CreatePlaylistModal.js @@ -74,7 +74,9 @@ export default class CreatePlaylistModal extends React.Component{ Public - +