run pandora_client server on custom port

This commit is contained in:
j 2015-11-20 18:15:07 +01:00
parent 0c08bc2ca9
commit c8b07794c9
2 changed files with 9 additions and 2 deletions

View file

@ -926,7 +926,7 @@ class Client(object):
def server(self, args): def server(self, args):
import server import server
server.run(self) server.run(self, args)
def client(self, args): def client(self, args):
if not args: if not args:

View file

@ -184,11 +184,18 @@ class Server(Resource):
self.client.sync([]) self.client.sync([])
self.client.update_encodes(True) self.client.update_encodes(True)
def run(client): def run(client, args=None):
if not args: args = []
root = Server(client) root = Server(client)
site = Site(root) site = Site(root)
port = 8789 port = 8789
interface = '0.0.0.0' interface = '0.0.0.0'
if args:
if ':' in args[0]:
interface, port = args[0].split(':')
port = int(port)
else:
port = int(args[0])
reactor.listenTCP(port, site, interface=interface) reactor.listenTCP(port, site, interface=interface)
print 'listening on http://%s:%s' % (interface, port) print 'listening on http://%s:%s' % (interface, port)
client.update_encodes() client.update_encodes()