Instance created within mem; Now semi-operational
This commit is contained in:
@ -55,7 +55,7 @@ COPY docker/pulse-client.conf /etc/pulse/client.conf
|
||||
ADD VERSION /
|
||||
|
||||
# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID.
|
||||
ENV HOME=/var/lib/mopidy
|
||||
#ENV HOME=/var/lib/mopidy
|
||||
|
||||
EXPOSE 6600 6680
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ class IrisCore(pykka.ThreadingActor):
|
||||
}
|
||||
|
||||
|
||||
def __init__(self, config, core):
|
||||
def setup(self, config, core):
|
||||
self.config = config
|
||||
self.core = core
|
||||
|
||||
@ -261,7 +261,7 @@ class IrisCore(pykka.ThreadingActor):
|
||||
callback = kwargs.get('callback', None)
|
||||
|
||||
connections = []
|
||||
for connection in self.connections.itervalues():
|
||||
for connection in self.connections.values():
|
||||
connections.append(connection['client'])
|
||||
|
||||
response = {
|
||||
@ -276,6 +276,9 @@ class IrisCore(pykka.ThreadingActor):
|
||||
connection = kwargs.get('connection', None)
|
||||
client = kwargs.get('client', None)
|
||||
|
||||
logger.debug("Connection added")
|
||||
logger.debug(connection)
|
||||
|
||||
self.connections[client['connection_id']] = {
|
||||
'client': client,
|
||||
'connection_id': client['connection_id'],
|
||||
@ -409,20 +412,20 @@ class IrisCore(pykka.ThreadingActor):
|
||||
|
||||
|
||||
def get_version(self, *args, **kwargs):
|
||||
|
||||
callback = kwargs.get('callback', False)
|
||||
url = 'https://pypi.python.org/pypi/Mopidy-Iris/json'
|
||||
req = urllib.request(url)
|
||||
|
||||
try:
|
||||
response = urllib.urlopen(req, timeout=30).read()
|
||||
response = urllib.request.urlopen(url, timeout=30).read()
|
||||
response = json.loads(response)
|
||||
latest_version = response['info']['version']
|
||||
|
||||
# compare our versions, and convert result to boolean
|
||||
upgrade_available = cmp( parse_version( latest_version ), parse_version( self.version ) )
|
||||
upgrade_available = parse_version( latest_version ) > parse_version( self.version )
|
||||
upgrade_available = ( upgrade_available == 1 )
|
||||
|
||||
except (urllib.HTTPError, urllib.URLError) as e:
|
||||
except (urllib.request.HTTPError, urllib.request.URLError) as e:
|
||||
latest_version = '0.0.0'
|
||||
upgrade_available = False
|
||||
|
||||
|
||||
@ -15,13 +15,11 @@ class IrisFrontend(pykka.ThreadingActor, CoreListener):
|
||||
def __init__(self, config, core):
|
||||
super(IrisFrontend, self).__init__()
|
||||
|
||||
|
||||
# create our core instance
|
||||
iris = IrisCore(config, core)
|
||||
print(iris)
|
||||
# Pass our Mopidy config and core to the IrisCore instance
|
||||
iris.config = config
|
||||
iris.core = core
|
||||
|
||||
def on_start(self):
|
||||
print(iris)
|
||||
iris.start()
|
||||
|
||||
def on_stop(self):
|
||||
|
||||
@ -26,10 +26,6 @@ class WebsocketHandler(tornado.websocket.WebSocketHandler):
|
||||
if (ip == '127.0.0.1' and hasattr(self.request.headers,'X-Forwarded-For')):
|
||||
ip = self.request.headers['X-Forwarded-For']
|
||||
|
||||
print("---------------------")
|
||||
print("WebsocketHandler.open")
|
||||
print(iris)
|
||||
|
||||
# Construct our initial client object, and add to our list of connections
|
||||
client = {
|
||||
'connection_id': iris.generateGuid(),
|
||||
|
||||
@ -1 +1,3 @@
|
||||
iris = None
|
||||
from .core import IrisCore
|
||||
|
||||
iris = IrisCore()
|
||||
Reference in New Issue
Block a user