Beispiel #1
0
    def __init__(self, debug=False):
        self.debug = debug

        mm = ModuleManager(settings.MODULES)
        sm = StaticManager(settings.STATICS)
        bm = BackgroundManager(settings.BACKGROUNDS)

        self.q = MZQueue(mm, sm, bm)
        self.qm = MZQueueManager(self.q)
        self.qm.start()

        Webserver.__init__(self, HOST_NAME, PORT_NUMBER)
Beispiel #2
0
class MZServer(Webserver):
	def __init__(self,debug=False):
		self.debug=debug

		mm=ModuleManager(settings.MODULES)
		sm=StaticManager(settings.STATICS)
		bm=BackgroundManager(settings.BACKGROUNDS)

		self.q = MZQueue(mm,sm,bm)
		self.qm = MZQueueManager(self.q)
		self.qm.start()

		Webserver.__init__(self,HOST_NAME, PORT_NUMBER)

	def get(self,form_data,path):
		if self.debug:
			p=path.path
			if p=='/' or p=='':
				p='/index.html'
			try:
				fn=os.path.join(os.path.dirname(os.path.realpath(__file__)),'../www',p[1:])
				return open(fn)
			except Exception:
				raise HTTPException(404,'File not found')
		else:
			raise NotImplementedError

	def json_transaction(self,json_data):
        	return self.q.doMultipleCommandsAsync(json_data)
Beispiel #3
0
class MZServer(Webserver):
    def __init__(self, debug=False):
        self.debug = debug

        mm = ModuleManager(settings.MODULES)
        sm = StaticManager(settings.STATICS)
        bm = BackgroundManager(settings.BACKGROUNDS)

        self.q = MZQueue(mm, sm, bm)
        self.qm = MZQueueManager(self.q)
        self.qm.start()

        Webserver.__init__(self, HOST_NAME, PORT_NUMBER)

    def get(self, form_data, path):
        if self.debug:
            p = path.path
            if p == '/' or p == '':
                p = '/index.html'
            try:
                fn = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                  '../www', p[1:])
                return open(fn)
            except Exception:
                raise HTTPException(404, 'File not found')
        else:
            raise NotImplementedError

    def json_transaction(self, json_data):
        return self.q.doMultipleCommandsAsync(json_data)
Beispiel #4
0
	def __init__(self,debug=False):
		self.debug=debug

		mm=ModuleManager(settings.MODULES)
		sm=StaticManager(settings.STATICS)
		bm=BackgroundManager(settings.BACKGROUNDS)

		self.q = MZQueue(mm,sm,bm)
		self.qm = MZQueueManager(self.q)
		self.qm.start()

		Webserver.__init__(self,HOST_NAME, PORT_NUMBER)
Beispiel #5
0
from BaseHTTPServer import HTTPServer
from SocketServer import ThreadingMixIn

from musicazoo.backgroundmanager import BackgroundManager
from musicazoo.modulemanager import ModuleManager
from musicazoo.mzqueue import MZQueue, MZQueueManager
from musicazoo.staticmanager import StaticManager

HOST_NAME = ''
PORT_NUMBER = 9000

mm = ModuleManager(settings.MODULES)
sm = StaticManager(settings.STATICS)
bm = BackgroundManager(settings.BACKGROUNDS)

q = MZQueue(mm, sm, bm)
qm = MZQueueManager(q)
qm.start()


def spin(cmd, secs, freq):
    for i in range(secs * freq):
        print q.doCommand(cmd)
        time.sleep(1.0 / freq)


test = '''
Your've raised an interesting topic.  Before I can respond, I need to
replace your frequently used the term "open source", because I think
that is not a good choice of classification, because of the underlying
assumptions in it.  "Open source" refers to free/libre/swatantra
Beispiel #6
0
from BaseHTTPServer import HTTPServer
from SocketServer import ThreadingMixIn

from musicazoo.backgroundmanager import BackgroundManager
from musicazoo.modulemanager import ModuleManager
from musicazoo.mzqueue import MZQueue, MZQueueManager
from musicazoo.staticmanager import StaticManager

HOST_NAME = ''
PORT_NUMBER = 9000

mm=ModuleManager(settings.MODULES)
sm=StaticManager(settings.STATICS)
bm=BackgroundManager(settings.BACKGROUNDS)

q = MZQueue(mm,sm,bm)
qm = MZQueueManager(q)
qm.start()

def spin(cmd,secs,freq):
	for i in range(secs*freq):
		print q.doCommand(cmd)
		time.sleep(1.0/freq)


test='''
Your've raised an interesting topic.  Before I can respond, I need to
replace your frequently used the term "open source", because I think
that is not a good choice of classification, because of the underlying
assumptions in it.  "Open source" refers to free/libre/swatantra
software but in a superficial practical way while avoiding the issues
Beispiel #7
0
from BaseHTTPServer import HTTPServer
from SocketServer import ThreadingMixIn

from musicazoo.backgroundmanager import BackgroundManager
from musicazoo.modulemanager import ModuleManager
from musicazoo.mzqueue import MZQueue, MZQueueManager
from musicazoo.staticmanager import StaticManager

HOST_NAME = ''
PORT_NUMBER = 9000

mm = ModuleManager(settings.MODULES)
sm = StaticManager(settings.STATICS)
bm = BackgroundManager(settings.BACKGROUNDS)

q = MZQueue(mm, sm, bm)
qm = MZQueueManager(q)
qm.start()

DEBUG = False


#class MultiThreadedHTTPServer(ThreadingMixIn,HTTPServer):
class MultiThreadedHTTPServer(HTTPServer):  # experimenting without Threading
    pass


class MZHandler(BaseHTTPServer.BaseHTTPRequestHandler):
    def address_string(self):
        return str(self.client_address[0])