Getting object inheritance right...
This commit is contained in:
@ -48,6 +48,7 @@ class Extension( ext.Extension ):
|
|||||||
def factory(config, core):
|
def factory(config, core):
|
||||||
|
|
||||||
path = os.path.join( os.path.dirname(__file__), 'static')
|
path = os.path.join( os.path.dirname(__file__), 'static')
|
||||||
|
frontend = IrisFrontend(config, core)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
(r"/images/(.*)", tornado.web.StaticFileHandler, {
|
(r"/images/(.*)", tornado.web.StaticFileHandler, {
|
||||||
@ -55,12 +56,12 @@ def factory(config, core):
|
|||||||
}),
|
}),
|
||||||
(r'/http/([^/]*)', HttpHandler, {
|
(r'/http/([^/]*)', HttpHandler, {
|
||||||
'core': core,
|
'core': core,
|
||||||
'frontend': IrisFrontend,
|
'frontend': frontend,
|
||||||
'config': config
|
'config': config
|
||||||
}),
|
}),
|
||||||
(r'/ws/?', WebsocketHandler, {
|
(r'/ws/?', WebsocketHandler, {
|
||||||
'core': core,
|
'core': core,
|
||||||
'frontend': IrisFrontend
|
'frontend': frontend
|
||||||
}),
|
}),
|
||||||
(r'/(.*)', tornado.web.StaticFileHandler, {
|
(r'/(.*)', tornado.web.StaticFileHandler, {
|
||||||
"path": path,
|
"path": path,
|
||||||
|
|||||||
@ -9,9 +9,35 @@ from mopidy.core import CoreListener
|
|||||||
from pkg_resources import parse_version
|
from pkg_resources import parse_version
|
||||||
from spotipy import Spotify
|
from spotipy import Spotify
|
||||||
from websocket import WebsocketHandler
|
from websocket import WebsocketHandler
|
||||||
|
from http import HttpHandler
|
||||||
|
|
||||||
# import logger
|
# import logger
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
def make_iris_factory(apps, statics):
|
||||||
|
def mopidy_app_factory(config, core):
|
||||||
|
|
||||||
|
path = os.path.join( os.path.dirname(__file__), 'static')
|
||||||
|
frontend = IrisFrontend(config, core)
|
||||||
|
|
||||||
|
return [
|
||||||
|
(r"/images/(.*)", tornado.web.StaticFileHandler, {
|
||||||
|
"path": config['local-images']['image_dir']
|
||||||
|
}),
|
||||||
|
(r'/http/([^/]*)', HttpHandler, {
|
||||||
|
'core': core,
|
||||||
|
'frontend': frontend,
|
||||||
|
'config': config
|
||||||
|
}),
|
||||||
|
(r'/ws/?', WebsocketHandler, {
|
||||||
|
'core': core,
|
||||||
|
'frontend': frontend
|
||||||
|
}),
|
||||||
|
(r'/(.*)', tornado.web.StaticFileHandler, {
|
||||||
|
"path": path,
|
||||||
|
"default_filename": "index.html"
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
|
||||||
###
|
###
|
||||||
# Spotmop supporting frontend
|
# Spotmop supporting frontend
|
||||||
@ -21,7 +47,6 @@ logger = logging.getLogger(__name__)
|
|||||||
class IrisFrontend(pykka.ThreadingActor, CoreListener):
|
class IrisFrontend(pykka.ThreadingActor, CoreListener):
|
||||||
|
|
||||||
def __init__(self, config, core):
|
def __init__(self, config, core):
|
||||||
global spotmop
|
|
||||||
super(IrisFrontend, self).__init__()
|
super(IrisFrontend, self).__init__()
|
||||||
self.config = config
|
self.config = config
|
||||||
self.core = core
|
self.core = core
|
||||||
@ -121,7 +146,7 @@ class IrisFrontend(pykka.ThreadingActor, CoreListener):
|
|||||||
|
|
||||||
self.core.tracklist.add( uris = uris )
|
self.core.tracklist.add( uris = uris )
|
||||||
except:
|
except:
|
||||||
pusher.broadcast('error', {'source': 'load_more_tracks', 'message': 'Failed to fetch Spotify recommendations'})
|
WebsocketHandler.broadcast('error', {'source': 'load_more_tracks', 'message': 'Failed to fetch Spotify recommendations'})
|
||||||
logger.error('IrisFrontend: Failed to fetch Spotify recommendations')
|
logger.error('IrisFrontend: Failed to fetch Spotify recommendations')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ class Settings extends React.Component{
|
|||||||
mopidy_host: this.props.mopidy.host,
|
mopidy_host: this.props.mopidy.host,
|
||||||
mopidy_port: this.props.mopidy.port,
|
mopidy_port: this.props.mopidy.port,
|
||||||
pusher_username: this.props.pusher.username,
|
pusher_username: this.props.pusher.username,
|
||||||
pusher_port: this.props.pusher.port,
|
|
||||||
spotify_country: this.props.spotify.country,
|
spotify_country: this.props.spotify.country,
|
||||||
spotify_locale: this.props.spotify.locale
|
spotify_locale: this.props.spotify.locale
|
||||||
};
|
};
|
||||||
@ -147,6 +146,16 @@ class Settings extends React.Component{
|
|||||||
{ this.renderConnectionStatus('mopidy') }
|
{ this.renderConnectionStatus('mopidy') }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="field">
|
||||||
|
<div className="name">Username</div>
|
||||||
|
<div className="input">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
onChange={ e => this.setState({ pusher_username: e.target.value }) }
|
||||||
|
onBlur={ e => this.props.pusherActions.setUsername(this.state.pusher_username) }
|
||||||
|
value={ this.state.pusher_username } />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className="field">
|
<div className="field">
|
||||||
<div className="name">Host</div>
|
<div className="name">Host</div>
|
||||||
<div className="input">
|
<div className="input">
|
||||||
@ -173,36 +182,6 @@ class Settings extends React.Component{
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h4 className="underline">Pusher</h4>
|
|
||||||
<form>
|
|
||||||
<div className="field">
|
|
||||||
<div className="name">Status</div>
|
|
||||||
<div className="input">
|
|
||||||
{ this.renderConnectionStatus('pusher') }
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="field">
|
|
||||||
<div className="name">Username</div>
|
|
||||||
<div className="input">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
onChange={ e => this.setState({ pusher_username: e.target.value }) }
|
|
||||||
onBlur={ e => this.props.pusherActions.setUsername(this.state.pusher_username) }
|
|
||||||
value={ this.state.pusher_username } />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="field">
|
|
||||||
<div className="name">Port</div>
|
|
||||||
<div className="input">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
onChange={ e => this.setState({ pusher_port: e.target.value })}
|
|
||||||
onBlur={ e => this.props.pusherActions.setPort(this.state.pusher_port) }
|
|
||||||
value={ this.state.pusher_port } />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<h4 className="underline">Spotify</h4>
|
<h4 className="underline">Spotify</h4>
|
||||||
<div className="field">
|
<div className="field">
|
||||||
<div className="name">Status</div>
|
<div className="name">Status</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user