Пример #1
0
def state():
    response.content_type = 'application/json'
    #TODO: Complete!
    return json.dumps({"is-recording" : context.get_recorder().is_recording(),
                       "hostname" : context.get_conf().get_hostname(),
                       "net" : context.get_ocservice().net if context.get_ocservice() else None,
                       "recorder-status" : str(context.get_recorder().status),
                       "current-profile" : context.get_conf().get_current_profile().name,
                       "current-mediapackage" : context.get_recorder().current_mediapackage.getIdentifier() if context.get_recorder().current_mediapackage else None
})
Пример #2
0
    def fill_mp_info(self, gui, info):
        """ Fill next recordings PopUp grid with the MP information
        """
        # FIXME: Merge fill info and fill mp info in any way?
        # Make a generic function in order to fill grids with dynamic widgets information
        grid = gui.get_object('mp_grid')
        row = 1
        for mp in info:
            column = 0
            for label, content in mp.iteritems():
                widget = gui.get_object('{}_mp'.format(label))
                if widget:
                    if isinstance(widget, Gtk.Label):
                        new_widget = Gtk.Label().new(content)
                    else:
                        new_widget = Gtk.Button().new_with_label(
                            _("Record Now"))
                        # FIXME: Use set_properties?
                        new_widget.set_property('halign',
                                                widget.get_property('halign'))
                        new_widget.set_property('valign',
                                                widget.get_property('valign'))
                        new_widget.connect("clicked", self.send_start, content)
                        recorder = context.get_recorder()
                        if recorder.status == ERROR_STATUS:
                            new_widget.set_sensitive(False)
                    widget_classes = widget.get_style_context().list_classes()
                    for style_class in widget_classes:
                        widget_style_context = new_widget.get_style_context()
                        widget_style_context.add_class(style_class)
                    new_widget.show()

                grid.attach(new_widget, column, row, 1, 1)
                column += 1
            row += 1
Пример #3
0
    def fill_mp_info(self, gui, info):
        """ Fill next recordings PopUp grid with the MP information
        """
        # FIXME: Merge fill info and fill mp info in any way?
        # Make a generic function in order to fill grids with dynamic widgets information
        grid = gui.get_object('mp_grid')
        row = 1
        for mp in info:
            column = 0
            for label, content in mp.iteritems():
                widget = gui.get_object('{}_mp'.format(label))
                if widget:
                    if isinstance(widget, Gtk.Label):
                        new_widget = Gtk.Label().new(content)
                    else:
                        new_widget = Gtk.Button().new_with_label(_("Record Now"))
                        # FIXME: Use set_properties?
                        new_widget.set_property('halign', widget.get_property('halign'))
                        new_widget.set_property('valign', widget.get_property('valign'))
                        new_widget.connect("clicked", self.send_start, content)
                        recorder = context.get_recorder()
                        if recorder.status == ERROR_STATUS:
                            new_widget.set_sensitive(False)
                    widget_classes = widget.get_style_context().list_classes()
                    for style_class in widget_classes:
                        widget_style_context = new_widget.get_style_context()
                        widget_style_context.add_class(style_class)
                    new_widget.show()

                grid.attach(new_widget, column, row, 1, 1)
                column += 1
            row += 1
Пример #4
0
def init():
    global conf, logger, recorder, dispatcher
    dispatcher = context.get_dispatcher()
    logger = context.get_logger()
    conf = context.get_conf()
    recorder = context.get_recorder()
    dispatcher.connect('init', manage_button)
Пример #5
0
def set_property():
    logger = context.get_logger()
    recorder = context.get_recorder()
    if not recorder.current_mediapackage:
        error_message = "[{}] No current_mediapackage available. Recording should be started before calling the endpoint.".format(request.fullpath)
        logger.error(error_message)
        abort(400, error_message)

    mp = recorder.current_mediapackage
    try:
        property_name = request.forms['name']
    except KeyError as exc:
        error_message = "[{}] The request does not have the required field {}".format(request.fullpath, exc)
        logger.error(error_message)
        abort(400, error_message)

    if mp.getProperty(property_name):
        error_message = "[{}] The mp already has the property {}, we do not overwrite it.".format(request.fullpath, property_name)
        logger.error(error_message)
        abort(400, error_message)

    try:
        property_value = request.forms['value']
    except KeyError as exc:
        error_message = "[{}] The request does not have the required field {}".format(request.fullpath, exc)
        logger.error(error_message)
        abort(400, error_message)

    mp.setProperty(property_name, property_value)
    logger.info("Setting property {} with value {} for the mediapackage {}".format(property_name, property_value, mp.getIdentifier()))
def init():
    global conf, logger, recorder, dispatcher
    dispatcher = context.get_dispatcher()
    logger = context.get_logger()
    conf = context.get_conf()
    recorder = context.get_recorder()
    dispatcher.connect('init', manage_button)
Пример #7
0
def start():
    response.content_type = 'text/xml'
    recorder = context.get_recorder()
    if recorder.is_recording():
        abort(500, "couldn't start capture")
    else:
        recorder.record(None)
    return "Signal to start recording sent"
Пример #8
0
def start():
    response.content_type = 'text/xml'
    recorder = context.get_recorder()
    if recorder.is_recording():
        abort(500, "couldn't start capture")
    else:
        recorder.record(None)
    return "Signal to start recording sent"
Пример #9
0
def stop():
    response.content_type = 'text/html'
    recorder = context.get_recorder()

    if recorder.is_recording():
        Gdk.threads_add_idle(GLib.PRIORITY_HIGH, recorder.stop)
    else:
        abort(500, "failed to stop the capture, or no current active capture")

    return "Signal to stop recording sent"
Пример #10
0
def stop():
    response.content_type = 'text/html'
    recorder = context.get_recorder()

    if recorder.is_recording():
        recorder.stop()
    else:
        abort(500, "failed to stop the capture, or no current active capture")
        
    return "Signal to stop recording sent"
Пример #11
0
def stop():
    response.content_type = 'text/html'
    recorder = context.get_recorder()

    if recorder.is_recording():
        recorder.stop()
    else:
        abort(500, "failed to stop the capture, or no current active capture")

    return "Signal to stop recording sent"
Пример #12
0
def check_pipeline_amp(self, valor):
    if context.get_recorder().is_recording():
        rms = valor
        rms_list.append(rms)
        if os.path.exists(temp_amp):
            f = open(temp_amp, 'a')
        else:
            f = open(temp_amp, 'w')
        if len(rms_list) > 100:
            f.write(str(max(rms_list)) + '\n')
            f.close()
            del rms_list[:]
Пример #13
0
def get_series():
    logger = context.get_logger()
    recorder = context.get_recorder()

    if not recorder.current_mediapackage:
        error_message = "[{}] No current_mediapackage available. Recording should be started before calling the endpoint.".format(request.fullpath)
        logger.error(error_message)
        abort(400, error_message)

    mp = recorder.current_mediapackage
    series = mp.getSeries()
    logger.info("Called {} api. Returned series of mp {} as {}".format(request.fullpath, mp.getIdentifier(), series))
    return json.dumps(series);
Пример #14
0
def quit():
    logger = context.get_logger()
    recorder = context.get_recorder()
    main_window = context.get_mainwindow()

    force = request.forms.get('force')

    if not recorder.is_recording() or readable.str2bool(force):
        logger.info("Quit Galicaster through API rest")

        GObject.idle_add(main_window.do_quit)
    else:
        abort(401, "Sorry, there is a current recording")
Пример #15
0
def init():

    logger.info('Start rapidrec plugin')

    global recorder, dispatcher
    dispatcher = context.get_dispatcher()
    recorder = context.get_recorder()

    try:
        dispatcher = context.get_dispatcher()
        dispatcher.connect('timer-short', monitor_timer_action)
        logger.info("Registered")

    except ValueError:
        logger.info("Error")
        pass
Пример #16
0
def check_key(element, source, event):
    """
    Filter Ctrl combinations for quit,restart and configuration
    """

    dispatcher = context.get_dispatcher()
    window = context.get_mainwindow()
    if ((event.get_state() & Gdk.ModifierType.SHIFT_MASK and event.get_state() & Gdk.ModifierType.CONTROL_MASK)
        and event.get_state() & Gdk.ModifierType.MOD2_MASK and
        (event.keyval in [Gdk.keyval_from_name('q'), Gdk.keyval_from_name('Q')])):

        if not context.get_recorder().is_recording():
            dispatcher.emit('action-quit')

    if ((event.get_state() & Gdk.ModifierType.CONTROL_MASK)  and
        event.keyval == Gdk.keyval_from_name('Return') ):
        window.toggle_fullscreen(None)

    return True
Пример #17
0
def get_property():
    logger = context.get_logger()
    recorder = context.get_recorder()
    if not recorder.current_mediapackage:
        error_message = "[{}] No current_mediapackage available. Recording should be started before calling the endpoint.".format(request.fullpath)
        logger.error(error_message)
        abort(400, error_message)

    mp = recorder.current_mediapackage
    try:
        property_name = request.query['name']
    except KeyError as exc:
        error_message = "[{}] The request does not have the required field {}".format(request.fullpath, exc)
        logger.error(error_message)
        abort(400, error_message)

    property = mp.getProperty(property_name)
    logger.info("Called {} api for property {} of mp {}: {}".format(request.fullpath, property_name,  mp.getIdentifier(), property))
    return json.dumps(property)
Пример #18
0
def check_pipeline_amp(self, valor, valor2, stereo):
    global temp_amp, logger

    # gstreamer pipeline amplitude temp file
    temp_amp = os.path.join(FAIL_DIR, 'gc_pipeline_amp')

    if context.get_recorder().is_recording():
        rms = valor
        rms_list.append(rms)
        if os.path.exists(temp_amp):
            f = open(temp_amp, 'a')
        else:
            f = open(temp_amp, 'w')
        if len(rms_list) > 100:
            value = str(max(rms_list))
            logger.debug("Writing data {} to {}".format(value, temp_amp))
            f.write(value + '\n')
            f.close()
            del rms_list[:]
Пример #19
0
 def __init__(self,
              mode,
              symbols,
              hold_timeout,
              rescale,
              drop_frames,
              buffers,
              ignore_bins,
              logger=None):
     self.symbol_start = symbols['start']
     self.symbol_stop = symbols['stop']
     self.symbol_hold = symbols['hold']
     self.mode = mode
     self.rescale = rescale
     self.drop_frames = drop_frames
     self.queue_buffers = buffers
     if ignore_bins:
         self.ignore_bins_list = ignore_bins.split(',')
     else:
         self.ignore_bins_list = []
     self.hold_timeout = hold_timeout  # secs
     self.hold_timeout_ns = hold_timeout * SEC2NANO  # nano secs
     self.hold_timestamp = 0
     self.hold_timer = None
     self.hold_timer_timestamp = 0
     self.logger = logger
     self.pipeline = None
     self.bins = None
     self.recording_paused = False
     self.pause_state_file = path.join(
         context.get_repository().get_rectemp_path(), "paused")
     # self.logger.debug(self.pause_state_file)
     self.sync_msg_handler = None
     self.msg_pattern = re.compile(ZBAR_MESSAGE_PATTERN)
     # mediapackage modifiers
     self.trimhold = False
     self.add_smil = False
     self.add_edits = False
     self.recorder = context.get_recorder()
     self.dispatcher = context.get_dispatcher()
Пример #20
0
def check_key(element, source, event):
    """
    Filter Ctrl combinations for quit,restart and configuration
    """

    dispatcher = context.get_dispatcher()
    window = context.get_mainwindow()
    if ((event.get_state() & Gdk.ModifierType.SHIFT_MASK
         and event.get_state() & Gdk.ModifierType.CONTROL_MASK)
            and event.get_state() & Gdk.ModifierType.MOD2_MASK
            and (event.keyval
                 in [Gdk.keyval_from_name('q'),
                     Gdk.keyval_from_name('Q')])):

        if not context.get_recorder().is_recording():
            dispatcher.emit('action-quit')

    if ((event.get_state() & Gdk.ModifierType.CONTROL_MASK)
            and event.keyval == Gdk.keyval_from_name('Return')):
        window.toggle_fullscreen(None)

    return True
Пример #21
0
def init():
    global recorder, dispatcher, logger, config, repo, oc_client, METADATA, ACL

    config = context.get_conf().get_section(CONFIG_SECTION) or {}
    dispatcher = context.get_dispatcher()
    repo = context.get_repository()
    logger = context.get_logger()
    recorder = context.get_recorder()
    oc_client = context.get_occlient()

    with open(get_ui_path("series_metadata_template.json"),
              "r") as metadataFile:
        METADATA = Template(metadataFile.read())

    with open(get_ui_path("acl_template.json"), "r") as aclFile:
        ACL = Template(aclFile.read())

    try:
        dispatcher.connect("init", init_user_ui)

    except Exception as e:
        logger.error(e)
    logger.info("Set user loaded.")
Пример #22
0
def set_series():
    logger = context.get_logger()
    recorder = context.get_recorder()

    if not recorder.current_mediapackage:
        error_message = "[{}] No current_mediapackage available. Recording should be started before calling the endpoint.".format(request.fullpath)
        logger.error(error_message)
        abort(400, error_message)

    mp = recorder.current_mediapackage
    if mp.getSeriesIdentifier() != None:
        error_message = "[{}] The mp {} already has an Opencast series {} we do not overwrite it.".format(request.fullpath, mp.getIdentifier(), mp.getSeries())
        logger.error(error_message)
        abort(400, error_message)

    try:
        series_id = request.forms['id']
    except KeyError as exc:
        error_message = "[{}] The request does not have the required field {}".format(request.fullpath, exc)
        logger.error(error_message)
        abort(400, error_message)
        return

    series_title = request.forms.get('title', None)
    opencastSeries = series.getSeriesbyId(series_id)
    if opencastSeries != None:
        series_title = opencastSeries['name']
        logger.info("Series with id {} found. Using stored title: {}".format(series_id, series_title))

    mp.setSeries(
        catalog = {
            'identifier': series_id,
            'title': series_title
        }
    )
    logger.info("Set series of mp {} to {}".format(mp.getIdentifier(), mp.getSeries()))
Пример #23
0
 def send_start(self, origin, data):
     mp = context.get_repository().get(data)
     mp.anticipated = True
     context.get_recorder().record(mp)
     self.dialog.destroy()
     return True
Пример #24
0
def disable_input():
    logger = context.get_logger()
    recorder = context.get_recorder()
    preview = request.json
    recorder.disable_input(list(preview.values())[0])
    logger.info("Input disabled")
Пример #25
0
def enable_preview():
    logger = context.get_logger()
    recorder = context.get_recorder()
    preview = request.json
    recorder.enable_preview(list(preview.values())[0])
    logger.info("Preview enabled")
Пример #26
0
def disable_preview():
    logger = context.get_logger()
    recorder = context.get_recorder()
    preview = request.json
    recorder.disable_preview(preview.values()[0])
    logger.info("Preview disabled")
Пример #27
0
def enable_input():
    logger = context.get_logger()
    recorder = context.get_recorder()
    preview = request.json
    recorder.enable_input(preview.values()[0])
    logger.info("Input enabled")
def init():
    global recorder, dispatcher
    dispatcher = context.get_dispatcher()
    recorder = context.get_recorder()
    dispatcher.connect("init", post_init)
Пример #29
0
def init():
    global recorder, dispatcher
    dispatcher = context.get_dispatcher()
    recorder = context.get_recorder()
    dispatcher.connect("init", post_init)
Пример #30
0
 def send_start(self, origin, data):
     mp = context.get_repository().get(data)
     mp.anticipated = True
     context.get_recorder().record(mp)
     self.dialog.destroy()
     return True
Пример #31
0
    def __init__(self, package=None):
        logger.info("Creating Recording Area")
        Gtk.Box.__init__(self)

        builder = Gtk.Builder()
        builder.add_from_file(get_ui_path('recorder.glade'))
        release = builder.get_object("release_label")
        release.set_label(get_footer())

        # TEST
        self.repo = context.get_repository()
        self.dispatcher = context.get_dispatcher()
        self.worker = context.get_worker()
        self.conf = context.get_conf()
        self.recorder = context.get_recorder()
        self.recorder.set_create_drawing_areas_func(self.create_drawing_areas)
        self.start_recording = False
        self.font = None
        self.scheduled_recording = False
        self.focus_is_active = False
        self.net_activity = None
        self.error_dialog = None
        self.close_before_response_action = False

        # BUILD
        self.recorderui = builder.get_object("recorderbox")
        self.main_area = builder.get_object("videobox")
        self.vubox = builder.get_object("vubox")
        self.gui = builder

        # VUMETER
        self.rangeVum = 50
        self.thresholdVum = self.conf.get_float('audio', 'min')
        self.mute = False
        self.stereo = True
        self.vumeterL = builder.get_object("progressbarL")
        self.vumeterR = builder.get_object("progressbarR")
        self.label_channels = builder.get_object("label_channels")

        # SWAP
        if not self.conf.get_boolean('basic', 'swapvideos'):
            self.gui.get_object("swapbutton").destroy()
        self.swap = False

        # STATUS
        self.view = self.set_status_view()
        hbox1 = self.gui.get_object('hbox1')
        hbox1.add(self.view)
        self.dispatcher.connect_ui("init", self.check_status_area)
        self.dispatcher.connect_ui("init", self.check_net, None)
        self.dispatcher.connect_ui("opencast-status", self.check_net)

        # UI
        self.pack_start(self.recorderui, True, True, 0)
        self.pause_dialog = None

        # Event Manager
        self.dispatcher.connect_ui("recorder-vumeter", self.set_vumeter)
        self.dispatcher.connect_ui("view-changed", self.event_change_mode)
        self.dispatcher.connect_ui("recorder-status", self.handle_status)
        self.dispatcher.connect_ui("recorder-ready", self.reset_mute)

        # STATES
        self.previous = None

        # PERMISSIONS
        self.allow_pause = self.conf.get_permission("pause")
        self.allow_start = self.conf.get_permission("start")
        self.allow_stop = self.conf.get_permission("stop")
        self.allow_manual = self.conf.get_permission("manual")
        self.allow_overlap = self.conf.get_permission("overlap")

        self.help_main_str = self.conf.get('help', 'main')
        self.help_text_str = self.conf.get('help', 'text')

        # OTHER
        builder.connect_signals(self)
        self.net_activity = self.conf.get_boolean('ingest', 'active')

        self.proportion = 1

        #TIMEOUTS
        deps = self.update_scheduler_deps()
        GObject.timeout_add(500, self.update_scheduler_timeout, *deps)
        self.update_clock_timeout(self.gui.get_object("local_clock"))
        GObject.timeout_add(10000, self.update_clock_timeout,
                            self.gui.get_object("local_clock"))
Пример #32
0
import time

from datetime import datetime
from email.mime.text import MIMEText
from pulsectl import Pulse

from galicaster.core import context

gi.require_version('GUdev', '1.0')
from gi.repository import GLib, GUdev # noqa


conf = context.get_conf()
dispatcher = context.get_dispatcher()
logger = context.get_logger()
recorder = context.get_recorder()

pulse = Pulse('galicaster-plugin-unplugged')
udev = GUdev.Client(subsystems=['usb'])


def init():
    Unplugged()


class WatchedDevice(object):
    def __init__(self, device_name, device_info):
        self.name = device_name
        self.vendor_id = device_info.get('vendor_id')
        self.device_id = device_info.get('device_id')
        self.switch_on_connect = device_info.get('switch_on_connect')
Пример #33
0
    def __init__(self, package=None):
        logger.info("Creating Recording Area")
        Gtk.Box.__init__(self)

        builder = Gtk.Builder()
        builder.add_from_file(get_ui_path('recorder.glade'))
        release = builder.get_object("release_label")
        release.set_label(get_footer())

        # TEST
        self.repo = context.get_repository()
        self.dispatcher = context.get_dispatcher()
        self.worker = context.get_worker()
        self.conf = context.get_conf()
        self.recorder = context.get_recorder()
        self.recorder.set_create_drawing_areas_func(self.create_drawing_areas)
        self.start_recording = False
        self.font = None
        self.scheduled_recording = False
        self.focus_is_active = False
        self.net_activity = None
        self.error_dialog = None
        self.close_before_response_action = False

        # BUILD
        self.recorderui = builder.get_object("recorderbox")
        self.main_area = builder.get_object("videobox")
        self.vubox = builder.get_object("vubox")
        self.gui = builder

        # VUMETER
        self.rangeVum = 50
        self.thresholdVum = self.conf.get_float('audio','min')
        self.mute = False
        self.stereo = True
        self.vumeterL = builder.get_object("progressbarL")
        self.vumeterR = builder.get_object("progressbarR")
        self.label_channels= builder.get_object("label_channels")
        self.low_audio = False
        self.lowaudio_threshold = self.conf.get_float('lowaudio','lowaudio_threshold')

        # SWAP
        if not self.conf.get_boolean('basic', 'swapvideos'):
            self.gui.get_object("swapbutton").destroy()
        self.swap = False

        # STATUS
        self.view = self.set_status_view()
        hbox1 = self.gui.get_object('hbox1')
        hbox1.add(self.view)
        self.dispatcher.connect_ui("init", self.check_status_area)
        self.dispatcher.connect_ui("init", self.check_net, None)
        self.dispatcher.connect_ui("opencast-status", self.check_net)
        self.dispatcher.connect_ui("operation-started", self.check_operations)
        self.dispatcher.connect_ui("operation-stopped", self.check_operations)

        # UI
        self.pack_start(self.recorderui,True,True,0)
        self.pause_dialog = None

        # Event Manager
        self.dispatcher.connect_ui("recorder-vumeter", self.set_vumeter)
        self.dispatcher.connect_ui("view-changed", self.event_change_mode)
        self.dispatcher.connect_ui("recorder-status", self.handle_status)
        self.dispatcher.connect_ui("recorder-ready", self.reset_mute)

        # STATES
        self.previous = None

        # PERMISSIONS
        self.allow_pause = self.conf.get_permission("pause")
        self.allow_start = self.conf.get_permission("start")
        self.allow_stop = self.conf.get_permission("stop")
        self.allow_manual = self.conf.get_permission("manual")
        self.allow_overlap = self.conf.get_permission("overlap")

        self.help_main_str = self.conf.get('help', 'main')
        self.help_text_str = self.conf.get('help', 'text')

        # OTHER
        builder.connect_signals(self)
        self.net_activity = self.conf.get_boolean('ingest', 'active')
        self.pausedialog_size = self.conf.get_int('basic', 'pausedialog_size',
                                                  default=15)
        if self.pausedialog_size < 5:
            self.pausedialog_size = 5
        elif self.pausedialog_size > 100:
            self.pausedialog_size = 100

        self.proportion = 1

        #TIMEOUTS
        deps = self.update_scheduler_deps()
        GObject.timeout_add(500, self.update_scheduler_timeout, *deps)
        self.update_clock_timeout(self.gui.get_object("local_clock"))
        GObject.timeout_add(10000, self.update_clock_timeout, self.gui.get_object("local_clock"))
Пример #34
0
    def __init__(self, package=None): 
        logger.info("Creating Recording Area")
        Gtk.Box.__init__(self)
       
	builder = Gtk.Builder()
        builder.add_from_file(get_ui_path('recorder.glade'))
        
        # TEST
        recorderui = builder.get_object("recorderbox")
        self.repo = context.get_repository()
        self.dispatcher = context.get_dispatcher()
        self.worker = context.get_worker()
        self.conf = context.get_conf()
        self.recorder = context.get_recorder()
        self.recorder.set_create_drawing_areas_func(self.create_drawing_areas)
        self.start_recording = False
        self.font = None
        self.scheduled_recording = False
        self.focus_is_active = False
        self.net_activity = None
        self.error_dialog = None

        # BUILD
        self.recorderui = builder.get_object("recorderbox")
        self.main_area = builder.get_object("videobox")
        self.vubox = builder.get_object("vubox")
        self.gui = builder

        # SWAP
        if not self.conf.get_boolean('basic', 'swapvideos'):
            self.gui.get_object("swapbutton").hide()
        self.swap = False

        # STATUS
        big_status = builder.get_object("bg_status")
        self.view = self.set_status_view()
        big_status.add(self.view)
        self.dispatcher.connect("galicaster-init", self.check_status_area)
        self.dispatcher.connect("galicaster-init", self.check_net)
        self.dispatcher.connect("net-up", self.check_net, True)        
        self.dispatcher.connect("net-down", self.check_net, False)        

        # VUMETER
        self.audiobar=Vumeter()

        # UI
        self.vubox.add(self.audiobar)
        self.pack_start(self.recorderui,True,True,0)

        # Event Manager       
        self.dispatcher.connect("recorder-vumeter", self.audiobar.SetVumeter)
        self.dispatcher.connect("galicaster-status", self.event_change_mode)
        self.dispatcher.connect("recorder-status", self.handle_status)

        nb=builder.get_object("data_panel")
        pages = nb.get_n_pages()        
        for index in range(pages):
            page=nb.get_nth_page(index)
#            nb.set_tab_label_packing(page, True, True,Gtk.PackType.START)

        # STATES
        self.previous = None

        # PERMISSIONS
        self.allow_pause = self.conf.get_permission("pause")
        self.allow_start = self.conf.get_permission("start")
        self.allow_stop = self.conf.get_permission("stop")
        self.allow_manual = self.conf.get_permission("manual")
        self.allow_overlap = self.conf.get_permission("overlap")
     
        # OTHER
        builder.connect_signals(self)
        self.net_activity = self.conf.get_boolean('ingest', 'active')

        self.proportion = 1

        #TIMEOUTS
        deps = self.update_scheduler_deps()
        GObject.timeout_add(500, self.update_scheduler_timeout, *deps)
        self.update_clock_timeout(self.gui.get_object("local_clock"))
        GObject.timeout_add(10000, self.update_clock_timeout, self.gui.get_object("local_clock"))
Пример #35
0
def state():
    response.content_type = 'application/json' 
    #TODO: Complete!
    return json.dumps({"is-recording": context.get_recorder().is_recording()})
Пример #36
0
"""
TODO:
 - Timer only in manual recordings
 - Doc
"""
from threading import Timer
from threading import _Timer

from galicaster.core import context


dispatcher = context.get_dispatcher()
conf = context.get_conf()
logger = context.get_logger()
recorder = context.get_recorder()

t_stop = None
max_duration = conf.get_int('forcedurationrec', 'duration') or 240


def init():
    dispatcher.connect("galicaster-notify-quit", do_stop_timers)
    dispatcher.connect('starting-record', create_timer)
    dispatcher.connect('restart-preview', do_stop_timers)


def create_timer(sender=None):
    global t_stop
    do_stop_timers()
    t_stop = Timer(60 * max_duration, stop_recording) 
Пример #37
0
 def send_start(self,origin, event, data):
     mp = context.get_repository().get(data)
     context.get_recorder().record(mp)
     self.dialog.destroy()
     return True