def main():
    options = parse_options()
    settings.update(options.__dict__)
    pid_store = PidStore.GetStore(options.pid_store, ('pids.proto'))

    logging.basicConfig(level=logging.INFO, format='%(message)s')

    SetupLogDirectory(options)

    #Check olad status
    logging.info('Checking olad status')
    try:
        ola_client = OlaClient()
    except OLADNotRunningException:
        logging.error('Error creating connection with olad. Is it running?')
        sys.exit(127)

    ola_thread = OLAThread(ola_client)
    ola_thread.start()
    test_thread = RDMTestThread(pid_store, settings['log_directory'])
    test_thread.start()
    app = BuildApplication(ola_thread, test_thread)

    httpd = make_server('', settings['PORT'], app.HandleRequest)
    logging.info('Running RDM Tests Server on %s:%s' %
                 ('127.0.0.1', httpd.server_port))

    try:
        httpd.serve_forever()
    except KeyboardInterrupt:
        pass
    ola_thread.Stop()
    test_thread.Stop()
    ola_thread.join()
    test_thread.join()
Beispiel #2
0
    def start_timecode(self, cue):
        """Start the timecode, using the given cue."""
        # Test and create client, if needed, return on fail
        if not self.__client:
            try:
                self.__client = OlaClient()
            except OLADNotRunningException:
                logging.debug('TIMECODE: Cannot track cue, OLA not running.')
                return

        # Load cue settings, if enabled, otherwise return
        if not cue.timecode['enabled']:
            return

        # Stop the currently "running" timecode
        self.stop_timecode()

        # Reload format settings
        self.__hres = config['Timecode'].getboolean('hres')
        self.__format = TcFormat[config['Timecode']['format']].format
        self.__millis = TcFormat[config['Timecode']['format']].millis

        # Setup new cue and options
        self.__cue = cue
        self.__cue_time = HRCueTime(cue) if self.__hres else CueTime(cue)
        self.__replace_hours = cue.timecode['replace_hours']
        self.__track = cue.timecode['track']

        # Start watching the new cue
        self.__cue_time.notify.connect(self.__send_timecode,
                                       Connection.QtQueued)
Beispiel #3
0
 def testOla(self):
     if self.activateBox.isChecked():
         try:
             client = OlaClient()
             del client
         except OLADNotRunningException:
             QMessageBox.warning(
                 MainWindow(), translate('TimecodeSettings', 'OLA status'),
                 translate('TimecodeSettings',
                           'OLA is not running - start the OLA daemon.'))
Beispiel #4
0
    def __init__(self):
        try:
            self.__client = OlaClient()
        except OLADNotRunningException:
            self.__client = None

        self.__cue = None
        self.__cue_time = None

        self.__track = 0
        self.__hres = config['Timecode'].getboolean('hres')
        self.__format = TcFormat[config['Timecode']['format']].format
        self.__millis = TcFormat[config['Timecode']['format']].millis
        self.__replace_hours = False
        self.__last_frame = -1
Beispiel #5
0
 def __init__(self, socket=None):
   self._ss = SelectServer()
   self._client = OlaClient(socket)
   self._ss.AddReadDescriptor(self._client.GetSocket(),
                              self._client.SocketReady)
Beispiel #6
0
 def __init__(self):
     self._quit = False
     self._sock = socket.socket()
     self._sock.connect(('localhost', 9010))
     self._client = OlaClient(self._sock)