Exemple #1
0
 def start_record(self, session_id, project_name, camera_id, stream_url, upload_cbk_url, prerecord_seconds):
     log.info('Try to start record session <{0}> of project <{1}> camera <{2}> on {3}'.format(
         session_id,
         project_name,
         camera_id,
         stream_url)
     )
     try:
         if not Load.is_available(self.working_load):
             log.warn('Working load is full, not able to take more record job')
             return {'result': 'error', 'load': self.working_load}
         if session_id in self._tasks:
             log.warn('Record session {0} already started'.format(session_id))
             return {'result': 'ok', 'load': self.working_load}
         record_proc = self._start_recorder(session_id, project_name, camera_id, stream_url, upload_cbk_url, prerecord_seconds)
         self._tasks[session_id] = {
             'stream_url': stream_url,
             'upload_cbk_url': upload_cbk_url,
             'proc': record_proc,
         }
         log.info('Record session {0} started successfully'.format(session_id))
         return {'result': 'ok', 'load': self.working_load}
     except Exception:
         log.exception('Failed to start record session {0}'.format(session_id))
         return {'result': 'error', 'load': self.working_load}
Exemple #2
0
 def is_offline(self):
     return Load.is_offline(self.load)
Exemple #3
0
 def is_available(self):
     return Load.is_available(self.load)