コード例 #1
0
ファイル: cameracontrol.py プロジェクト: sinhote/Galicaster
def init():
    global conf, logger, event_handler, jobs
    dispatcher = context.get_dispatcher()
    conf = context.get_conf()
    logger = context.get_logger()

    path = conf.get('cameracontrol', 'path')
    pysca.connect(path)
    pysca.set_zoom(1, 0)
    pysca.pan_tilt_home(1)
    dispatcher.connect('init', load_ui)
    pysca.osd_off(1)
    logger.info("Cam connected")

    icons = [
        "left", "right", "up1", "down1", "up_right", "up_left", "down_left",
        "down_right", "plus", "minus"
    ]
    icontheme = Gtk.IconTheme()
    for name in icons:
        pixbuf = GdkPixbuf.Pixbuf.new_from_file(get_image_path(name + ".svg"))
        icontheme.add_builtin_icon(name, 20, pixbuf)

    dispatcher.connect("action-key-press", on_key_press)
    dispatcher.connect("action-key-release", on_key_release)

    event_handler = Handler()
    jobs = Queue.Queue()
    t = T(jobs)
    t.setDaemon(True)
    t.start()
コード例 #2
0
def init():
    global conf, logger, event_handler, jobs, cam_ctrl
    dispatcher = context.get_dispatcher()
    conf = context.get_conf()
    logger = context.get_logger()
    camera = conf.get('cameracontrol', 'camera')

    cam = __import__(camera, globals())
    cam_ctrl = cam.Controls()

    icons = [
        "left", "right", "up1", "down1", "up_right", "up_left", "down_left",
        "down_right", "plus", "minus"
    ]
    icontheme = Gtk.IconTheme()
    for name in icons:
        pixbuf = GdkPixbuf.Pixbuf.new_from_file(get_image_path(name + ".svg"))
        icontheme.add_builtin_icon(name, 20, pixbuf)

    dispatcher.connect('init', load_ui)
    dispatcher.connect("action-key-press", on_key_press)
    dispatcher.connect("action-key-release", on_key_release)

    event_handler = Handler()
    jobs = Queue.Queue()
    t = T(jobs)
    t.setDaemon(True)
    t.start()
コード例 #3
0
ファイル: worker.py プロジェクト: sinhote/Galicaster
    def __init__(self,
                 dispatcher,
                 repo,
                 logger,
                 oc_client=None,
                 export_path=None,
                 tmp_path=None,
                 use_namespace=True,
                 sbs_layout='sbs',
                 hide_ops=[],
                 hide_nightly=[]):
        """Initializes a worker that manages the mediapackages of the repository in order to do long operations concurrently by throwing Threads when necessay.
        Args:
            dispacher (Dispatcher): the galicaster event-dispatcher to emit signals.
            repo (Repository): the galicaster mediapackage repository.
            logger (Logger): the object that prints all the information, warning and error messages.
            oc_client (OCHTTPClient): the opencast HTTP client.
            export_path (str): the absolute path where galicaster exports zip and sidebyside.
            tmp_path (str): temporal path (needed if /tmp partition is small).
            use_namespace (bool): if true the manifest attribute xmlns has 'http://mediapackage.opencastproject.org' value.
            sbs_layout (str): the identifier of side by side layout. See notes.
            hide_ops (List[str]): List of hidden mediapackage operations.
            hide_nightly (List[str]): List of nightly hidden mediapackage operations.
        Attributes:
            jobs (Queue): queue of jobs.
            t (Thread)
        Note:
            sbs_layouts possible values:
                'sbs': screen and camera have the same size.
                'pip_screen': screen smaller than camera.
                'pip_camera:': camera smaller than screen.
            """

        self.repo = repo
        self.oc_client = oc_client
        self.export_path = export_path or os.path.expanduser('~')
        self.tmp_path = tmp_path or tempfile.gettempdir()
        self.use_namespace = use_namespace
        self.sbs_layout = sbs_layout
        self.dispatcher = dispatcher
        self.logger = logger
        self.hide_ops = hide_ops
        self.hide_nightly = hide_nightly

        for dir_path in (self.export_path, self.tmp_path):
            if not os.path.isdir(dir_path):
                os.makedirs(dir_path)

        self.add_operation(SBS, SBS_CODE, self._side_by_side)
        self.add_operation(INGEST, INGEST_CODE, self._ingest)
        self.add_operation(ZIPPING, ZIPPING_CODE, self._export_to_zip)

        self.jobs = Queue.Queue()

        self.t = T(self.jobs)
        self.t.setDaemon(True)
        self.t.start()

        self.dispatcher.connect('timer-nightly', self.exec_nightly)
コード例 #4
0
ファイル: service.py プロジェクト: samuvlad/Galicaster
    def __init__(self, repo, occlient, scheduler, conf, disp, logger,
                 recorder):
        """Initializes the scheduler of future recordings.
        The instance of this class is in charge of set all the necessary timers in order to manage scheduled recordings.
        It also manages the update of mediapackages with scheduled recordings and capture agent status.
        Args:
            repo (Repository): the galicaster mediapackage repository. See mediapackage/repository.py.
            scheduler (Scheduler): the galicaster scheduler. See scheduler/scheduler.py.
            conf (Conf): galicaster users and default configuration. See galicaster/core/conf.py.
            disp (Dispatcher): the galicaster event-dispatcher to emit signals. See core/dispatcher.py.
            occlient (MHTTPClient): opencast HTTP client. See utils/mhttpclient.py.
            logger (Logger): the object that prints all the information, warning and error messages. See core/logger.py
            recorder (Recorder)
        Attributes:
            ca_status (str): actual capture agent status.
            old_ca_status (str): old capture agent status.
            conf (Conf): galicaster users and default configuration given as an argument.
            repo (Repository): the galicaster mediapackage repository given as an argument.
            dispatcher (Dispatcher): the galicaster event-dispatcher to emit signals given by the argument disp.
            client (MHTTPClient): opencast HTTP client given by the argument occlient.
            logger (Logger): the object that prints all the information, warning and error messages.
            recorder (Recorder)
            mp_rec (str): identifier of the mediapackage that is going to be recorded at the scheduled time.
            last_events (List[Events]): list of calendar Events.
            net (bool): True if the connectivity with opencast is up. False otherwise.
        Notes:
            Possible values of ca_status and old_ca_status:
                - idle
                - recording
        """
        self.ca_status = 'idle'
        self.old_ca_status = None

        self.conf = conf
        self.repo = repo
        self.scheduler = scheduler
        self.dispatcher = disp
        self.client = occlient
        self.logger = logger
        self.recorder = recorder

        self.dispatcher.connect('timer-short', self.do_timers_short)
        self.dispatcher.connect('timer-long', self.do_timers_long)
        self.dispatcher.connect('recorder-started',
                                self.__check_recording_started)
        self.dispatcher.connect('recorder-stopped',
                                self.__check_recording_stopped)
        self.dispatcher.connect("recorder-error", self.on_recorder_error)
        self.dispatcher.connect("opencast-status", self.on_opencast_status)
        self.dispatcher.connect('init', self.on_start)
        self.dispatcher.connect("quit", self.on_quit)

        self.t_stop = None

        self.mp_rec = None
        self.last_events = self.init_last_events()
        self.net = False
        self.series = []

        self.ical_data = None
        self.jobs = Queue.Queue()
        t = T(self.jobs)
        t.setDaemon(True)
        t.start()