예제 #1
0
    def __init__(self):
        Controller.__init__(self)

        # Create DVBStreamer objects
        username = '******'
        password = '******'

        try:
            username = config.DVBSTREAMER_USERNAME
            password = config.DVBSTREAMER_PASSWORD
        except:
            pass

        self.manager = DVBStreamerManager(username, password)
        self.last_device = None
예제 #2
0
    def __init__(self):
        plugin.DaemonPlugin.__init__(self)
        self.event_listener = True
        _debug_('dvbstreamer plugin starting')

        try:
            config.VLC_COMMAND
        except:
            print String(_( 'ERROR' )) + ': ' + \
                  String(_("'VLC_COMMAND' not defined, plugin 'DVBStreamer' deactivated.\n" \
                           'please check the vlc section in freevo_config.py' ))
            return

        # Create DVBStreamer objects
        username = '******'
        password = '******'

        try:
            username = config.DVBSTREAMER_USERNAME
            password = config.DVBSTREAMER_PASSWORD
        except:
            pass

        manager = DVBStreamerManager(username, password)

        # Determine size and location of the live buffer
        bitrate, duration = config.LIVE_PAUSE_BUFFER_SIZE
        size = int((((bitrate * 1000000 * duration) / (7* 188 * 8)) + 1) * (7 * 188))
        path = config.LIVE_PAUSE_BUFFER_PATH

        # register vlc as the object to play
        self.vlc = Vlc( manager, path, size)
        plugin.register(self.vlc, plugin.TV, False)
예제 #3
0
    def __init__(self):
        plugin.DaemonPlugin.__init__(self)
        self.event_listener = True
        _debug_('dvbstreamer plugin starting')
        try:
            config.XINE_COMMAND
        except:
            print String(_( 'ERROR' )) + ': ' + \
                  String(_("'XINE_COMMAND' not defined, plugin 'DVBStreamer' deactivated.\n" \
                           'please check the xine section in freevo_config.py' ))
            return

        if config.XINE_COMMAND.find('fbxine') >= 0:
            type = 'fb'
        else:
            type = 'X'

        if not hasattr(config, 'XINE_VERSION'):
            config.XINE_VERSION = 0
            for data in util.popen3.stdout('%s --version' %
                                           config.XINE_COMMAND):
                m = re.match('^.* v?([0-9])\.([0-9]+)\.([0-9]*).*', data)
                if m:
                    config.XINE_VERSION = int(
                        '%02d%02d%02d' %
                        (int(m.group(1)), int(m.group(2)), int(m.group(3))))
                    if data.find('cvs') >= 0:
                        config.XINE_VERSION += 1

            _debug_('detect xine version %s' % config.XINE_VERSION)

        if config.XINE_VERSION < 922:
            print String(_( 'ERROR' )) + ': ' + \
                  String(_( "'xine-ui' version too old, plugin 'xine' deactivated" ))
            print String(_('You need software %s')) % 'xine-ui > 0.9.21'
            return

        # Create DVBStreamer objects
        username = '******'
        password = '******'

        try:
            username = config.DVBSTREAMER_USERNAME
            password = config.DVBSTREAMER_PASSWORD
        except:
            pass

        manager = DVBStreamerManager(username, password)

        # Determine size and location of the live buffer
        bitrate, duration = config.LIVE_PAUSE_BUFFER_SIZE
        size = int(
            (((bitrate * 1000000 * duration) / (7 * 188 * 8)) + 1) * (7 * 188))
        path = config.LIVE_PAUSE_BUFFER_PATH

        # register xine as the object to play
        self.xine = Xine(type, config.XINE_VERSION, manager, path, size)
        plugin.register(self.xine, plugin.TV, False)
예제 #4
0
    def __init__(self):
        plugin.Plugin.__init__(self)
        _debug_('dvbstreamer plugin starting')

        # Create DVBStreamer objects
        username = '******'
        password = '******'

        try:
            username = config.DVBSTREAMER_USERNAME
            password = config.DVBSTREAMER_PASSWORD
        except:
            pass

        manager = DVBStreamerManager(username, password)

        # register the DVBStreamer record
        plugin.register(Recorder(manager), plugin.RECORD)
예제 #5
0
class DVBStreamerController(Controller):
    """
    Class to control a DVBStreamer server.
    """

    def __init__(self):
        Controller.__init__(self)

        # Create DVBStreamer objects
        username = '******'
        password = '******'

        try:
            username = config.DVBSTREAMER_USERNAME
            password = config.DVBSTREAMER_PASSWORD
        except:
            pass

        self.manager = DVBStreamerManager(username, password)
        self.last_device = None

    def start_filling(self, buffer, videogroup, channel, timeout):
        """
        Start filling the supplied buffer using the device supplied (VideoGroup)
        after tuning to the channel specified.
        If no data is received after timeout seconds send a Data Timed out event.
        """
        device = videogroup.vdev
        try:
            self.manager.select(device,  channel)
        except:
            traceback.print_exc()

        port = 1235
        if device.find(':') != -1:
            ip_address = self.manager.controllers[device].my_ip
        else:
            ip_address = 'localhost'

        try:
            controller = self.manager.get_controller(device)
            controller.execute_command('setprop adapter.active true', True)
        except:
            logger.debug('Not DVBStreamer 2.x?')

        try:
            self.manager.enable_udp_output(device,  ip_address, port)
        except:
            traceback.print_exc()

        self.last_device = device

        buffer.fill('udp', '%s:%d' % (ip_address, port))

    def stop_filling(self):
        """
        Stop filling the buffer supplied in the previous start_filling call.
        """
        try:
            self.manager.disable_output(self.last_device)
        except:
            traceback.print_exc()
        try:
            controller = self.manager.get_controller(self.last_device)
            controller.execute_command('setprop adapter.active false', True)
        except:
            logger.debug('Not DVBStreamer 2.x?')