Exemplo n.º 1
0
    def __init__(self):
        # init config reader
        self._config = ConfigMonitor()
        # start debugger
        log.debug(self._config.getVar('logging','dir'))

        # init serverpush
        self._push = Serverpush(self._config.getVar('cluster','host'))

        # basic informations
        info = BasicInformations()

        # register on server
        if self._config.getVar('cluster','id')!='':
            print(self._config.getVar('cluster','id'))
        else:
            log.info("reciving new id")
            response = self._push.push('register',json.dumps(info.getInfo()))

            print(response)


        # start webserver
        s = WebServer(self._config.getVar("webserver","host"),self._config.getVar("webserver","port"))
        s.start()
        pass
Exemplo n.º 2
0
    def addWorker(self, color, radius, script, interval, title):
        if (title == "auto"):
            title = str(self.id)
            self.id += 1

        newws = WebServer(color, radius, self, script, interval, title)
        newws.start()
        self.threadList.append(newws)
Exemplo n.º 3
0
	def addWorker(self,color,radius,script,interval,title):
		if(title=="auto"):
			title = str(self.id)
			self.id += 1
			
		newws = WebServer(color,radius,self,script,interval,title)
		newws.start()
		self.threadList.append(newws)
Exemplo n.º 4
0
def main():
    relay_controller = RelayController(vendor_id=VENDOR_ID,
                                       product_id=PRODUCT_ID,
                                       activation_time=ACTIVATION_TIME)
    web_server = WebServer(host=HOST,
                           port=PORT,
                           relay_controller=relay_controller)
    web_server.start()
Exemplo n.º 5
0
class TeleMotePlugin(GObject.Object, Peas.Activatable):
    __gtype_name__ = 'TeleMotePlugin'

    object = GObject.property(type=GObject.Object)

    def __init__(self):
        GObject.Object.__init__(self)

    def do_activate(self):
        self.server = WebServer(self.object, os.path.dirname(os.path.realpath(__file__)))
        self.server.start()

    def do_deactivate(self):
        self.server.stop()
Exemplo n.º 6
0
# Module name : main.py
# created by alvifsandanamahardika at 6/10/21
import signal
import sys

from webserver import WebServer


def shutdownServer(sig, unused):
    """
    Shutdown server from a SIGINT received signal
    :param sig: integer
    """
    server.shutdown()
    sys.exit(1)


if __name__ == '__main__':
    signal.signal(signal.SIGINT, shutdownServer)
    server = WebServer(8000)
    server.start()
    print("Press Ctrl+C to shut down server.")
Exemplo n.º 7
0
import gc, core
from webserver import WebServer
gc.collect()
core.do_connect()
ws = WebServer()
ws.start()
from time import sleep

from webserver import WebServer


class mydataclass(object):
    def __init__(self):
        self.param1 = 0
        self.param2 = 0


#MAIN LOOP
try:
    mydata = mydataclass()
    myWebServer = WebServer(mydata)
    myWebServer.start()

    cycling = True
    while cycling:
        #In the mail loop , do something, for example  increment param2
        #and do some verificationon param1
        mydata.param2 += 1
        sleep(1)
        if mydata.param1 < 0:
            print 'param1 is negative...'
        if mydata.param1 == 5:
            #parameter param1 is incremented by the user on the browser
            cycling = False

    myWebServer.stop()
    print "well done!"
                self.out.write(image_to_classify)
                if self.frameCount == 75:
                    self.out.release()

            self.frameCount += 1
            #if (overlaid == False and self.capture == True):
            #print("early stop")
            #self.sendEmailMessage(self.dirName)
            #self.capture = False
            #self.dirName = ''

        return image_to_classify


if __name__ == '__main__':

    videoThread = VideoProcessing()

    serverThread = WebServer(videoThread)

    videoThread.start()
    serverThread.start()
    time.sleep(10)
    while True:
        choice = input("Please enter q to quit" + '\n')
        if choice == 'q':
            videoThread.killSwitch = True
            break
    #answer = input("Please enter 'v' to stop video thread, enter 's' to stop server thread. Enter q to quit")
    #if (answer == 'v'):
    #videoThread.