Skip to content

Commit

Permalink
Merge pull request #113 from jaedb/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jaedb authored Jul 22, 2016
2 parents 49c437e + 0885333 commit ef01ee4
Show file tree
Hide file tree
Showing 22 changed files with 215 additions and 323 deletions.
13 changes: 8 additions & 5 deletions mopidy_spotmop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
from services.upgrade import upgrade
from services.pusher import pusher
from services.auth import auth
from services.queuer import queuer
from mopidy import config, ext

__version__ = '2.7.3'
__version__ = '2.7.4'
__ext_name__ = 'spotmop'
__verbosemode__ = False

Expand Down Expand Up @@ -73,13 +74,15 @@ def spotmop_client_factory(config, core):
}),
(r'/pusher/([^/]+)', pusher.PusherRequestHandler, {
'core': core,
'config': config,
'version': __version__
'config': config
}),
(r'/auth', auth.AuthRequestHandler, {
'core': core,
'config': config,
'version': __version__
'config': config
}),
(r'/queuer/([^/]*)', queuer.QueuerRequestHandler, {
'core': core,
'config': config
}),
(r"/images/(.*)", tornado.web.StaticFileHandler, {
"path": artworklocation
Expand Down
4 changes: 1 addition & 3 deletions mopidy_spotmop/services/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ class AuthRequestHandler(tornado.web.RequestHandler):
def set_default_headers(self):
self.set_header("Access-Control-Allow-Origin", "*")

def initialize(self, core, config, version):
def initialize(self, core, config):
self.core = core
self.config = config
self.version = version

# check if we're able to upgrade, and what our current version is
def get(self):

url = 'https://accounts.spotify.com/api/token'
Expand Down
3 changes: 1 addition & 2 deletions mopidy_spotmop/services/pusher/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ class IdentifyRequestHandler(tornado.web.RequestHandler):
def set_default_headers(self):
self.set_header("Access-Control-Allow-Origin", "*")

def initialize(self, core, config, version):
def initialize(self, core, config):
self.core = core
self.config = config
self.version = version

def get(self):
ip = self.request.remote_ip
Expand Down
86 changes: 0 additions & 86 deletions mopidy_spotmop/services/pusher/index.html

This file was deleted.

8 changes: 3 additions & 5 deletions mopidy_spotmop/services/pusher/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ def set_default_headers(self):
self.set_header("Access-Control-Allow-Headers", "X-Requested-With")
self.set_header("Content-Type", "application/json")

def initialize(self, core, config, version):
def initialize(self, core, config):
self.core = core
self.config = config
self.version = version

# get method
def get(self, action):
Expand All @@ -72,12 +71,11 @@ def get(self, action):
clientDetailsList.append(client['details'])
self.write(json_encode(clientDetailsList))

def spotmop_pusher_factory(config, core, version):
def spotmop_pusher_factory(config, core):
return [
('/', PusherRequestHandler, {
'core': core,
'config': config,
'version': version
'config': config
})
]

Expand Down
Empty file.
36 changes: 36 additions & 0 deletions mopidy_spotmop/services/queuer/queuer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
import tornado.web
import base64
import urllib, urllib2, json
from tornado.escape import json_encode, json_decode

from tornado.escape import json_encode
import subprocess

state = {
'mode': 'normal'
}

class QueuerRequestHandler(tornado.web.RequestHandler):

def set_default_headers(self):
self.set_header("Access-Control-Allow-Origin", "*")

def initialize(self, core, config):
self.core = core
self.config = config

## get the current state
def get(self, action):
self.write(json_encode(state))

## post to update the state
def post(self, mode):
state['mode'] = 'radio'
self.write(json_encode(state))


def spotmop_queuer_factory(config, core):
return [
('/', QueuerRequestHandler, {'core': core, 'config': config})
]
Loading

0 comments on commit ef01ee4

Please sign in to comment.