예제 #1
0
    def __init__(self, command, enterkey=None):
        plugin.Plugin.__init__(self)

        self.command = command
        self.enterkey = enterkey

        plugin.register(self, 'EXTERNAL_TUNER')
예제 #2
0
    def __init__(self):
        """
        Setup the xine info plugin
        """
        # check if xine telnet access is possible:
        if config.XINE_COMMAND.find('--network') < 0 and config.XINE_ARGS_DEF.find('--network') < 0:
            self.reason = '"--network" is missing in xine args!'
            return
        else:
            passwd_file = '%s/.xine/passwd' % os.environ['HOME']
            if not os.path.exists(passwd_file):
                self.reason = 'xine passwd file is missing: %s it should at least contain ALL:ALLOW' % (passwd_file)
                return
        plugin.DaemonPlugin.__init__(self)

        self.playing = False
        self.timer = 0
        self.handle = None

        # plugin settings
        self.poll_interval = 4
        self.poll_menu_only = 0         # lcd even if player is on
        self.event_listener = 1         # listening to events

        # register this pluing
        plugin.register(self, 'xine_info')
예제 #3
0
    def __init__(self):
        plugin.Plugin.__init__(self)

        # get config locations and mod times so we can check if we need
        # to regen xml config files (because they changed)
        self.mylocalconf = self.findLocalConf()
        self.myfconfig = os.environ['FREEVO_CONFIG']
        self.tvtimecache = os.path.join(config.FREEVO_CACHEDIR, 'tvtimecache')
        self.mylocalconf_t = os.path.getmtime(self.mylocalconf)
        self.myfconfig_t = os.path.getmtime(self.myfconfig)
        self.major = 0
        self.minor = 0
        self.minorversion = 0

        self.getTvtimeVersion()
        self.xmltv_supported = self.isXmltvSupported()
        self.optionD_supported = self.isOptionDSupported()

        #check/create the stationlist.xml and tvtime.xml
        self.createTVTimeConfig()

        # create the tvtime object and register it
        plugin.register(TVTime(), plugin.TV)
        plugin.getbyname(plugin.TV).optionD_supported = self.optionD_supported
        plugin.getbyname(plugin.TV).xmltv_supported = self.xmltv_supported
예제 #4
0
    def __init__(self):
        """ Initialist the PluginInterface """
        _debug_('PluginInterface.__init__()', 2)
        plugin.Plugin.__init__(self)
        self._type = 'mplayer_audio'
        self.app_mode = 'audio'
        self.vis_mode = -1
        self.title = None
        self.message = None
        self.info = None
        self.message_fmt = config.MPLAYERVIS_MESSAGE_FMT

        # Event for changing between viewmodes
        config.EVENTS['audio']['LANG'] = Event('TOGGLE_MESSAGE')  #'a'
        config.EVENTS['audio']['SUBTITLE'] = Event('TOGGLE_TITLE')  #'l'
        config.EVENTS['audio']['DISPLAY'] = Event('CHANGE_MODE')  #'d'
        config.EVENTS['audio']['+'] = Event('NEXT_VISUAL')
        config.EVENTS['audio']['-'] = Event('CHANGE_VISUAL', arg=-1)
        config.EVENTS['audio']['0'] = Event('CHANGE_VISUAL', arg=0)
        config.EVENTS['audio']['1'] = Event('CHANGE_VISUAL', arg=1)
        config.EVENTS['audio']['2'] = Event('CHANGE_VISUAL', arg=2)
        config.EVENTS['audio']['3'] = Event('CHANGE_VISUAL', arg=3)
        config.EVENTS['audio']['4'] = Event('CHANGE_VISUAL', arg=4)
        config.EVENTS['audio']['5'] = Event('CHANGE_VISUAL', arg=5)
        config.EVENTS['audio']['6'] = Event('CHANGE_VISUAL', arg=6)
        config.EVENTS['audio']['7'] = Event('CHANGE_VISUAL', arg=7)
        config.EVENTS['audio']['8'] = Event('CHANGE_VISUAL', arg=8)
        config.EVENTS['audio']['9'] = Event('CHANGE_VISUAL', arg=9)

        self.plugin_name = 'audio.mplayervis'
        plugin.register(self, self.plugin_name)

        self.view = config.MPLAYERVIS_MODE
        self.view_func = [self.dock, self.fullscreen, self.noview]
예제 #5
0
    def __init__(self, standalone=False):
        """
        init the upsoon plugin
        """
        logger.log( 9, 'upsoon.PluginInterface.__init__()')
        plugin.DaemonPlugin.__init__(self)
        plugin.register(self, 'upsoon')
        self.standalone = standalone
        self.lock = thread.allocate_lock()
        self.running = True
        self.timer = Timer(self.timer_handler).start(15)
        self.event = EventHandler(self.event_handler)
        #self.event.register(('VIDEO_START', 'VIDEO_END'))
        self.event.register()

        self.recordclient = RecordClient()

        self.fc = FreevoChannels()
        self.rdev = config.RADIO_DEVICE

        self.next_program = None
        self.announced = False
        self.seconds_before_announce = config.TV_UPSOON_ANNOUNCE
        self.seconds_before_start = config.TV_UPSOON_BEFORE_START
        self.pending_lockfile = config.FREEVO_CACHEDIR + '/record.soon'
        self.tv_lockfile = None # lockfile of recordserver
        self.stopped = None     # flag that tells upsoon what stopped
        if os.path.exists(self.pending_lockfile):
            os.remove(self.pending_lockfile)
            logger.debug('%r lockfile removed', self.pending_lockfile)
예제 #6
0
    def __init__(self):
        """
        Setup the xine info plugin
        """
        # check if xine telnet access is possible:
        if config.XINE_COMMAND.find("--network") < 0 and config.XINE_ARGS_DEF.find("--network") < 0:
            self.reason = '"--network" is missing in xine args!'
            return
        else:
            passwd_file = "%s/.xine/passwd" % os.environ["HOME"]
            if not os.path.exists(passwd_file):
                self.reason = "xine passwd file is missing: %s it should at least contain ALL:ALLOW" % (passwd_file)
                return
        plugin.DaemonPlugin.__init__(self)

        self.playing = False
        self.timer = 0
        self.handle = None

        # plugin settings
        self.poll_interval = 4
        self.poll_menu_only = 0  # lcd even if player is on
        self.event_listener = 1  # listening to events

        # register this pluing
        plugin.register(self, "xine_info")
예제 #7
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)
예제 #8
0
    def __init__(self):
        """
        Set up the basics, register with Freevo and connect
        """

        plugin.DaemonPlugin.__init__(self)

        # DeamonPlugin internal settings.
        self.poll_interval = 3000
        self.poll_menu_only = False
        self.event_listener = 1

        # Register ourselves
        plugin.register(self, "audioscrobbler")

        # Internal Plugin Setting
        self.playitem = False
        self.failed_retries = 0
        self.logged_in = False
        self.lastsong = ''
        self.sleep_timeout = 0
        self.elapsed = 0

        # Read configuration
        self.read_conf()
        self.login()
예제 #9
0
    def __init__(self):
        plugin.Plugin.__init__(self)

        # get config locations and mod times so we can check if we need
        # to regen xml config files (because they changed)
        self.mylocalconf = self.findLocalConf()
        self.myfconfig = os.environ['FREEVO_CONFIG']
        self.tvtimecache = os.path.join(config.FREEVO_CACHEDIR, 'tvtimecache')
        self.mylocalconf_t = os.path.getmtime(self.mylocalconf)
        self.myfconfig_t = os.path.getmtime(self.myfconfig)
        self.major = 0
        self.minor = 0
        self.minorversion = 0

        self.getTvtimeVersion()
        self.xmltv_supported = self.isXmltvSupported()
        self.optionD_supported = self.isOptionDSupported()

        #check/create the stationlist.xml and tvtime.xml
        self.createTVTimeConfig()

        # create the tvtime object and register it
        plugin.register(TVTime(), plugin.TV)
        plugin.getbyname(plugin.TV).optionD_supported = self.optionD_supported
        plugin.getbyname(plugin.TV).xmltv_supported = self.xmltv_supported
예제 #10
0
    def __init__(self, standalone=False):
        """
        init the upsoon plugin
        """
        _debug_('upsoon.PluginInterface.__init__()', 2)
        plugin.DaemonPlugin.__init__(self)
        plugin.register(self, 'upsoon')
        self.standalone = standalone
        self.lock = thread.allocate_lock()
        self.running = True
        self.timer = Timer(self.timer_handler).start(15)
        self.event = EventHandler(self.event_handler)
        #self.event.register(('VIDEO_START', 'VIDEO_END'))
        self.event.register()

        self.recordclient = RecordClient()

        self.fc = FreevoChannels()
        self.rdev = config.RADIO_DEVICE

        self.next_program = None
        self.seconds_before_announce = 120
        self.seconds_before_start = 60
        self.pending_lockfile = config.FREEVO_CACHEDIR + '/record.soon'
        self.tv_lockfile = None  # lockfile of recordserver
        self.stopped = None  # flag that tells upsoon what stopped
예제 #11
0
    def __init__(self):
        """Initilise the plugin"""
        if not config.MPD_MUSIC_BASE_PATH:
            self.reason = 'MPD_MUSIC_BASE_PATH not set in local_conf.py'
            return

        plugin.MainMenuPlugin.__init__(self)
        self.show_item = menu.MenuItem('MPD status', action=self.show_menu)
        #self.show_item.type = 'menu'
        plugin.register(self, 'audio.MPD_status')
        # connect to the server
        self.conn = mpdclient2.Thread_MPD_Connection(config.MPD_SERVER_HOST, config.MPD_SERVER_PORT, True,
                    config.MPD_SERVER_PASSWORD)

        # items to go in the mpd menu
        self.item_play = menu.MenuItem('play', self.mpd_play)#, parent=self)
        self.item_status = menu.MenuItem('status', self.mpd_status)#, parent=self)
        self.item_pause = menu.MenuItem('pause', self.mpd_pause)#, parent=self)
        self.item_stop = menu.MenuItem('stop', self.mpd_stop)#, parent=self)
        self.item_next = menu.MenuItem('next track', self.mpd_next)#, parent=self)
        self.item_previous = menu.MenuItem('previous track', self.mpd_previous)#, parent=self)
        self.item_clear = menu.MenuItem('clear playlist', self.mpd_clear)#, parent=self)
        self.item_shuffle = menu.MenuItem('shuffle playlist', self.mpd_shuffle)#, parent=self)
        self.item_random = menu.MenuItem('toggle random', self.mpd_toggle_random)#, parent=self)
        self.item_repeat = menu.MenuItem('toggle repeat', self.mpd_toggle_repeat)#, parent=self)
        self.item_extern = menu.MenuItem('open external mpd client', self.start_external)#, parent=self)
예제 #12
0
    def __init__(self):
        """
        init the upsoon plugin
        """
        _debug_('__init__(self)', 2)
        plugin.DaemonPlugin.__init__(self)
        self.lock = thread.allocate_lock()
        self.poll_interval = 1500  #15 secs
        self.poll_menu_only = 0
        self.event_listener = 1
        plugin.register(self, 'upsoon')

        server_string = 'http://%s:%s/' % (config.RECORDSERVER_IP,
                                           config.RECORDSERVER_PORT)
        _debug_('%s' % server_string)
        self.server = xmlrpclib.Server(server_string, allow_none=1)
        _debug_('%s' % self.server)

        self.serverup = None
        self.next_program = self.findNextProgram()
        _debug_('%s' % (self.next_program))

        self.fc = FreevoChannels()

        self.seconds_before_announce = 120
        self.seconds_before_start = 60
        self.pending_lockfile = config.FREEVO_CACHEDIR + '/record.soon'
        self.tv_lockfile = None  # lockfile of recordserver
        self.stopped = False  # flag that tells upsoon stopped the tv, not the user
예제 #13
0
    def __init__(self, command, enterkey=None):
        plugin.Plugin.__init__(self)

        self.command = command
        self.enterkey = enterkey

        plugin.register(self, 'EXTERNAL_TUNER')
예제 #14
0
    def __init__( self ):
        """
        init the remote
        """
        self.clients = []
        self.disable = 0
        self.playitem = None

        plugin.DaemonPlugin.__init__( self )
        # start the network connection
        # read address and port of the remote from the config file
        try:
            clients = config.UDPREMOTE_CLIENTS.split(" ")
            ports = config.UDPREMOTE_PORTS.split(" ")
            if len(clients) == len(ports):
                for client in clients:
                    self.clients.append((client, int(ports.pop())))
        except:
            print "can't get Host or Port from config file. Please set UDPREMOTE_CLIENTS and UDPREMOTE_PORTS!"
            self.disable = 1

        if not self.disable:
            self.create_network_connection()

        if not self.disable:
            plugin.register( self, "udpremote" )
예제 #15
0
    def __init__(self, app, remote):
        plugin.Plugin.__init__(self)

        #XXX might want to check to see if .xawtv present.
        # we really don't have much of a prayer if it isn't

        # create the xawtv object and register it
        plugin.register(Xawtv(app, remote), plugin.TV)
예제 #16
0
    def __init__(self):
        plugin.MainMenuPlugin.__init__(self)

        self._type = 'mainmenu_tv'
        self.parent = None
        self.prog_menu = SearchProgramMenu()
        plugin.register(self.prog_menu, "Search Program")
        plugin.activate(self.prog_menu)
예제 #17
0
    def __init__(self):
        plugin.MainMenuPlugin.__init__(self)

        self._type = 'mainmenu_tv'
        self.parent = None
        self.prog_menu = SearchProgramMenu()
        plugin.register(self.prog_menu, "Search Program")
        plugin.activate(self.prog_menu)
예제 #18
0
    def __init__(self):
        plugin.DaemonPlugin.__init__(self)
        # Determine size and location of the live buffer

        self.event_listener = True

        self.livepause = LivePauseController(players.get_player())
        plugin.register(self.livepause, plugin.TV, False)
예제 #19
0
    def __init__(self, app, remote):
        plugin.Plugin.__init__(self)

        #XXX might want to check to see if .xawtv present.
        # we really don't have much of a prayer if it isn't

        # create the xawtv object and register it
        plugin.register(Xawtv(app, remote), plugin.TV)
예제 #20
0
    def __init__(self):
        """
        init the buttonbar
        """
        plugin.DaemonPlugin.__init__(self)
        plugin.register(self, 'buttonbar')
        self.visible = True
        self.bar = None
        self.barfile = ''
        self.surface = None
        self.colors = ['red', 'green', 'yellow', 'blue']
        self.actions = [None, None, None, None]
        if not hasattr(config, 'BUTTONBAR_TVGUIDE_ACTIONS'):
            self.tvguide_actions = [
                MenuItem('-1 Day', action=self.advance_tv_guide, arg=-24),
                MenuItem('-6 Hours', action=self.advance_tv_guide, arg=-6),
                MenuItem('+6 Hours', action=self.advance_tv_guide, arg=6),
                MenuItem('+1 Day', action=self.advance_tv_guide, arg=24)
            ]
        else:
            # Process TV Guide buttons
            self.tvguide_actions = [None, None, None, None]
            for index in range(0, len(self.colors)):
                if config.BUTTONBAR_TVGUIDE_ACTIONS.has_key(
                        self.colors[index]):
                    actionstr = config.BUTTONBAR_TVGUIDE_ACTIONS[
                        self.colors[index]]
                    if actionstr == 'record':
                        self.tvguide_actions[index] = MenuItem(
                            _('Record'),
                            action=self.send_event_to_menu,
                            arg=event.TV_START_RECORDING)
                    elif actionstr == 'info':
                        self.tvguide_actions[index] = MenuItem(
                            _('Full Description'),
                            action=self.show_program_info)
                    elif actionstr == 'now':
                        self.tvguide_actions[index] = MenuItem(
                            _('Now'), action=self.jump_to_now)

                    elif actionstr.startswith('adv:'):
                        hours = eval(actionstr[4:])
                        self.tvguide_actions[index] = MenuItem(
                            'Advance %d hours' % hours,
                            action=self.advance_tv_guide,
                            arg=hours)
                    else:
                        msgtext = _('WARNING: ')
                        msgtext += _(
                            '"%s" is not a valid argument for the button bar. '
                        ) % actionstr
                        _debug_(msgtext, DERROR)

        # Getting current LOCALE
        try:
            locale.resetlocale()
        except:
            pass
예제 #21
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)
예제 #22
0
파일: yac.py 프로젝트: spartrekus/freevo1
 def __init__ ( self):
     port = 10629
     host = ''
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.sock.bind((host,port))
     self.sock.listen(5)
     self.sock.setblocking(0)
     plugin.DaemonPlugin.__init__( self )
     plugin.register( self, "yac")
예제 #23
0
    def __init__(self, command, trans_cmd, enterkey=None):
        plugin.Plugin.__init__(self)

        self.command = command
        self.trans_cmd = trans_cmd
        self.enterkey = enterkey
        self.delay = '0.3'

        plugin.register(self, 'EXTERNAL_TUNER')
예제 #24
0
 def __init__(self):
     """
     init the events plug-in
     """
     plugin.DaemonPlugin.__init__(self)
     plugin.register(self, 'processevent')
     self.plugin_name = 'processevent'
     self.event = EventHandler(self.event_handler)
     self.event.register()
예제 #25
0
    def __init__(self, command, trans_cmd, enterkey=None):
        plugin.Plugin.__init__(self)

        self.command = command
        self.trans_cmd = trans_cmd
        self.enterkey = enterkey
        self.delay = '0.3'

        plugin.register(self, 'EXTERNAL_TUNER')
예제 #26
0
 def __init__(self):
     """
     init the events plug-in
     """
     plugin.DaemonPlugin.__init__(self)
     plugin.register(self, 'processevent')
     self.plugin_name = 'processevent'
     self.event = EventHandler(self.event_handler)
     self.event.register()
예제 #27
0
 def __init__(self, before='/bin/true', after='/bin/true'):
     """
     init the autocolor plugin
     """
     plugin.DaemonPlugin.__init__(self)
     self.poll_interval = 200
     self.plugins = None
     plugin.register(self, 'autocolor')
     self.before = before
     self.after = after
예제 #28
0
    def __init__(self):
        plugin.DaemonPlugin.__init__(self)
        self.item = None
        self.menuw = None
        self.item_menu = None
        self.dir = None
        self.files = None
        self.poll_interval = 100  # 1 sec

        plugin.register(self, 'Dirwatcher')
예제 #29
0
 def __init__(self,before='/bin/true', after='/bin/true'):
     """
     init the autocolor plugin
     """
     plugin.DaemonPlugin.__init__(self)
     self.poll_interval   = 20
     self.plugins = None
     plugin.register(self, 'autocolor')
     self.before = before
     self.after = after
예제 #30
0
    def __init__(self):
        plugin.Plugin.__init__(self)

        try:
            config.CONF.fbxine
        except:
            print String(_( 'ERROR' )) + ': ' + \
                  String(_( "'fbxine' not found, 'xine' audio plugin deactivated" ))
            return

        # register xine as the object to play
        plugin.register(Xine(), plugin.AUDIO_PLAYER, True)
예제 #31
0
    def __init__(self):
        logger.debug('PluginInterface.__init__()')
        plugin.MainMenuPlugin.__init__(self)
        if not config.AUDIO_ALBUM_TREE_SPEC:
            logger.warning('AUDIO_ALBUM_TREE_SPEC is empty; demo-mode, using predefined trees')
            self.album_tree_list = self.load_demo()
        else:
            self.album_tree_list = self.load_spec(config.AUDIO_ALBUM_TREE_SPEC)

        #self.show_item = menu.MenuItem(_('Album Tree'), action=self.onchoose_main)
        #self.show_item.type = 'audio'
        plugin.register(self, 'audio.album_tree')
예제 #32
0
    def __init__(self):
        plugin.MainMenuPlugin.__init__(self)
        #config.EVENTS['audio']['DISPLAY'] = Event(FUNCTION_CALL, arg=self.detach)
        self.show_item = menu.MenuItem(_('Album Tree'), action=self.onchoose_main)
        self.show_item.type = 'audio'
        plugin.register(self, 'audio.album_tree')

        if (not config.__dict__.has_key('AUDIO_ALBUM_TREE_SPEC') ) or  (not config.AUDIO_ALBUM_TREE_SPEC):
            print '*ALBUM_TREE:"config.AUDIO_ALBUM_TREE_SPEC" is empty:DEMO-MODE:USING PREDEFINED TREES'
            self.load_demo()
        else:
            self.load_spec(config.AUDIO_ALBUM_TREE_SPEC)
예제 #33
0
파일: lcd2.py 프로젝트: adozenlines/freevo1
    def __init__(self):
        """
        Init the lcd screen and this plugin
        """
        plugin.DaemonPlugin.__init__(self)

        self.poll_interval = 20         # timer resolution is 200ms
        self.poll_menu_only = 0         # lcd even if player is on
        self.event_listener = 1         # listening to events

        self.menu_pos = (0, 1)          # to detect menu position changes

        # use pylcd to connect to LCDd
        try:
            self.lcd = pylcd.client()
            self.lcd.connect()
            self.lcd.screen_add('s')
            self.lcd.screen_set('s', '-priority foreground -heartbeat off')
        except:
            logger.error(_('LCD plugin will not load! Maybe you don\'t have LCDd (lcdproc daemon) running?'))
            return

        # prepare the lcd frames for different types
        info_width = 7
        width = self.lcd.d_width
        height = self.lcd.d_height

        # menu, title and player lines (could be configured in local_conf.py?)
        self.lcd_head = LcdFrame(self.lcd, 'head', col=1, start=1, end=(width-info_width-1))
        self.lcd_info = LcdFrame(self.lcd, 'info', col=1, start=(width-info_width+1), end=width)
        self.lcd_menu_sel = LcdFrame(self.lcd, 'msel', col=2, start=1, end=width)
        if height == 2:
            self.lcd_menu_add = [] # no additional menue lines
            self.lcd_title = self.lcd_menu_sel # use bottom line, share with menu selection
            self.lcd_player = self.lcd_menu_sel # use bottom line, share with menu selecton
        elif height == 3:
            self.lcd_menu_add = [LcdFrame(self.lcd, 'madd0', col=3, start=1, end=width)]
            self.lcd_title = self.lcd_menu_sel # use middle line for titles, share with menu selection
            self.lcd_player = self.lcd_menu_add[0] # use last line for player info
        elif height == 4:
            self.lcd_menu_add = [LcdFrame(self.lcd, 'madd0', col=3, start=1, end=width),
                                 LcdFrame(self.lcd, 'madd1', col=4, start=1, end=width)]
            self.lcd_title = self.lcd_menu_add[0] # use third line for titles, share with additional menu line
            self.lcd_player = self.lcd_menu_add[1] # use last line for player, share with additional menu line
        else:
            logger.error(_('LCD not supported yet!'))

        # updating menu head
        self.lcd_head.draw('Freevo')

        # register this pluing
        plugin.register(self, 'lcd2')
예제 #34
0
    def __init__(self):
        logger.debug('PluginInterface.__init__()')
        plugin.MainMenuPlugin.__init__(self)
        if not config.AUDIO_ALBUM_TREE_SPEC:
            logger.warning(
                'AUDIO_ALBUM_TREE_SPEC is empty; demo-mode, using predefined trees'
            )
            self.album_tree_list = self.load_demo()
        else:
            self.album_tree_list = self.load_spec(config.AUDIO_ALBUM_TREE_SPEC)

        #self.show_item = menu.MenuItem(_('Album Tree'), action=self.onchoose_main)
        #self.show_item.type = 'audio'
        plugin.register(self, 'audio.album_tree')
예제 #35
0
    def __init__(self):
        plugin.Plugin.__init__(self)
        self._type    = 'mplayer_audio'
        self.app_mode = 'audio'

        # Event for changing between viewmodes
        config.EVENTS['audio']['0'] = Event('CHANGE_MODE')

        self.plugin_name = 'audio.mplayervis'
        plugin.register(self, self.plugin_name)

        self.view_func = [self.dock,
                          self.fullscreen,
                          self.noview]
예제 #36
0
 def __init__(self):
     """
     init the osd
     """
     plugin.DaemonPlugin.__init__(self)
     self.poll_interval = 2
     self.plugins = None
     plugin.register(self, 'osd')
     self.visible = True
     self.message = ''
     # set to 2 == we have no idea right now if
     # we have an idlebar
     self.idlebar_visible = 2
     self.poll_menu_only  = False
예제 #37
0
 def __init__(self):
     """
     init the osd
     """
     plugin.DaemonPlugin.__init__(self)
     self.poll_interval = 2
     self.plugins = None
     plugin.register(self, 'osd')
     self.visible = True
     self.message = ''
     # set to 2 == we have no idea right now if
     # we have an idlebar
     self.idlebar_visible = 2
     self.poll_menu_only = False
예제 #38
0
    def __init__(self):
        if not config.SYS_USE_NETWORK:
            self.reason = 'SYS_USE_NETWORK not enabled'
            return
        
        if not plugin.is_active('video.subtitles'):
            self.reason = 'Plugin \'video.subtitles\' not active, activate it first in your local_config.py!'
            return

        # opensubtitles XMLRPC server and token
        self.server = None
        self.token  = None
        
        SubtitlesPlugin.__init__(self, 'os', 'opensubtitles.org', [])
        plugin.register(self, 'video.subtitles.opensubtitles')
예제 #39
0
    def __init__(self):
        if not config.SYS_USE_NETWORK:
            self.reason = 'SYS_USE_NETWORK not enabled'
            return

        if not plugin.is_active('video.subtitles'):
            self.reason = 'Plugin \'video.subtitles\' not active, activate it first in your local_config.py!'
            return

        # opensubtitles XMLRPC server and token
        self.server = None
        self.token = None

        SubtitlesPlugin.__init__(self, 'os', 'opensubtitles.org', [])
        plugin.register(self, 'video.subtitles.opensubtitles')
예제 #40
0
def scenario(dirpath=None, logdir=None, proxyaddr=None, autolocalsocks=True,
             **scenkwargs):
    """Return a single Scenario loaded from `dirpath` if provided else the
    basic default call flow.
    """
    if dirpath:
        # deliver single scenario from dir
        path, scen = next(
            walk(dirpath, autolocalsocks=autolocalsocks, **scenkwargs)
        )
    else:
        with plugin.register([netplug] if autolocalsocks else []):
            # deliver the default scenario bound to loopback sockets
            uas = agent.server(logdir=logdir)
            uac = agent.client(logdir=logdir)

            # same as above
            scen = plugin.mng.hook.pysipp_conf_scen_protocol(
                agents=[uas, uac], confpy=None,
                scenkwargs=scenkwargs
            )

            if proxyaddr:
                assert isinstance(
                    proxyaddr, tuple), 'proxyaddr must be a (addr, port) tuple'
                scen.clientdefaults.proxyaddr = proxyaddr

    return scen
예제 #41
0
파일: __init__.py 프로젝트: JorisE/pysipp
def pysipp_conf_scen_protocol(agents, confpy, defaults):
    """Perform default configuration rule set
    """
    # more sanity
    if confpy:
        ua = agents[0]
        assert dirname(confpy.__file__) == dirname(ua.scen_file)

    hooks = plugin.mng.hook
    # register pysipp_conf.py module temporarily so that each scenario only
    # hooks a single pysipp_conf.py
    with plugin.register([confpy]):
        # default scen impl
        scen = agent.Scenario(agents, confpy=confpy)

        # order the agents for launch
        agents = list(hooks.pysipp_order_agents(
            agents=scen.agents, clients=scen.clients,
            servers=scen.servers)) or agents

        # create scenario wrapper
        scen = hooks.pysipp_new_scen(
            agents=agents, confpy=confpy, defaults=defaults)

        # configure scenario
        hooks.pysipp_conf_scen(agents=scen.agents, scen=scen)

        # XXX patch pluggy to support direct method parsing allowing to
        # remove ^
        # hooks.pysipp_conf_scen.call_extra(scen=scen)

    return scen
예제 #42
0
    def __init__(self, conf='/etc/lircd.conf', device='/dev/lirc', remote=None):
        plugin.Plugin.__init__(self)

        self.conf = conf
        self.device = device
        self.remotes = util.lirc.parse_lircd(self.conf)
        util.lirc.dump_remotes(self.remotes)
        self.fd = None

        if not remote and len(self.remotes.values()) > 0:
            remote = self.remotes.values()[0]
        else:
            remote = self.remotes[remote]
        self.remote = remote

        plugin.register(self, 'EXTERNAL_TUNER')
예제 #43
0
def pysipp_conf_scen_protocol(agents, confpy, scenkwargs):
    """Perform default configuration rule set
    """
    # more sanity
    if confpy:
        ua = agents[0]
        assert dirname(confpy.__file__) == dirname(ua.scen_file)

    hooks = plugin.mng.hook
    # register pysipp_conf.py module temporarily so that each scenario only
    # hooks a single pysipp_conf.py
    with plugin.register([confpy]):
        # default scen impl
        scen = agent.Scenario(agents, confpy=confpy)

        # order the agents for launch
        agents = list(hooks.pysipp_order_agents(
            agents=scen.agents, clients=scen.clients,
            servers=scen.servers)) or agents

        # create scenario wrapper
        scen = hooks.pysipp_new_scen(
            agents=agents, confpy=confpy, scenkwargs=scenkwargs)

        # configure scenario
        hooks.pysipp_conf_scen(agents=scen.agents, scen=scen)

        # XXX patch pluggy to support direct method parsing allowing to
        # remove ^
        # hooks.pysipp_conf_scen.call_extra(scen=scen)

    return scen
예제 #44
0
파일: xine.py 프로젝트: freevo/freevo1
    def __init__(self):
        plugin.Plugin.__init__(self)

        try:
            config.XINE_COMMAND
        except:
            self.reason = _("'XINE_COMMAND' not defined, 'xine' tv plugin deactivated.\n" \
                'please check the xine section in freevo_config.py')
            return

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

        # register xine as the object to play
        plugin.register(Xine(type), plugin.TV, False)
예제 #45
0
    def __init__(self):
        plugin.Plugin.__init__(self)

        try:
            config.XINE_COMMAND
        except:
            self.reason = _("'XINE_COMMAND' not defined, 'xine' tv plugin deactivated.\n" \
                'please check the xine section in freevo_config.py')
            return

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

        # register xine as the object to play
        plugin.register(Xine(type), plugin.TV, False)
예제 #46
0
    def __init__(self):
        plugin.Plugin.__init__(self)
        logger.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)
예제 #47
0
파일: xine.py 프로젝트: freevo/freevo1
    def __init__(self):
        logger.log( 9, 'PluginInterface.__init__()')
        try:
            config.XINE_COMMAND
        except:
            print _('\'XINE_COMMAND\' not defined, \'xine\' video plugin deactivated.\n' \
                           'please check the xine section in freevo_config.py')
            self.reason = '\'XINE_COMMAND\' not defined, \'xine\' video plugin deactivated'
            return

        plugin.Plugin.__init__(self)

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

        # register xine as the object to play
        plugin.register(Xine(type), plugin.VIDEO_PLAYER, True)
예제 #48
0
    def __init__(self):
        """
        Constructor
        """
        if not config.SYS_USE_NETWORK:
            self.reason = 'SYS_USE_NETWORK not enabled'
            return
        
        if not plugin.is_active('video.subtitles'):
            self.reason = 'Plugin \'video.subtitles\' not active, activate it first in your local_config.py!'
            return

        langs = []

        try:
            langs = config.NAPI_LANGS
        except:
            langs = NAPI_LANGS

        SubtitlesPlugin.__init__(self, 'np', 'napiprojekt.pl', langs)
        plugin.register(self, 'video.subtitles.napiprojekt')
예제 #49
0
    def __init__(self):
        """
        initialise an instance of the PluginInterface
        """
        logger.log( 9, 'PluginInterface.__init__()')
        plugin.DaemonPlugin.__init__(self)
        self.poll_interval  = 30
        self.poll_menu_only = False
        self.plugins = None
        plugin.register(self, 'idlebar')
        self.visible = True
        self.bar = None
        self.rect = None
        self.barfile = ''
        self.free_space = -1
        self.used_space = 0

        # Getting current LOCALE
        try:
            locale.resetlocale()
        except:
            pass
예제 #50
0
    def __init__(self):
        """ Initialist the PluginInterface """
        logger.debug('PluginInterface.__init__()')
        plugin.Plugin.__init__(self)
        self._type    = 'mplayer_audio'
        self.event_context = 'audio'
        self.title    = None
        self.message  = None
        self.infodata = None
        self.message_fmt = config.MPLAYERVIS_MESSAGE_FMT

        # Event for changing between viewmodes
        config.EVENTS['audio']['SUBTITLE'] = Event('DISPLAY_TITLE')   #'l'
        config.EVENTS['audio']['ENTER']    = Event('DISPLAY_MESSAGE') #'a'
        config.EVENTS['audio']['LANG']     = Event('DISPLAY_FPS')     #'ENTER'
        config.EVENTS['audio']['DISPLAY']  = Event('CHANGE_MODE')     #'d'
        config.EVENTS['audio']['+'] = Event('NEXT_VISUAL')
        config.EVENTS['audio']['-'] = Event('CHANGE_VISUAL', arg=-1)
        config.EVENTS['audio']['0'] = Event('CHANGE_VISUAL', arg=0)
        config.EVENTS['audio']['1'] = Event('CHANGE_VISUAL', arg=1)
        config.EVENTS['audio']['2'] = Event('CHANGE_VISUAL', arg=2)
        config.EVENTS['audio']['3'] = Event('CHANGE_VISUAL', arg=3)
        config.EVENTS['audio']['4'] = Event('CHANGE_VISUAL', arg=4)
        config.EVENTS['audio']['5'] = Event('CHANGE_VISUAL', arg=5)
        config.EVENTS['audio']['6'] = Event('CHANGE_VISUAL', arg=6)
        config.EVENTS['audio']['7'] = Event('CHANGE_VISUAL', arg=7)
        config.EVENTS['audio']['8'] = Event('CHANGE_VISUAL', arg=8)
        config.EVENTS['audio']['9'] = Event('CHANGE_VISUAL', arg=9)

        self.plugin_name = 'audio.mplayervis'
        plugin.register(self, self.plugin_name)

        self.mpvgoom = None
        self.view = MpvMode(config.MPLAYERVIS_MODE)
        self.view_func = [self.dock, self.fullscreen, self.noview]
        self.initialised = False
        self.timer = OneShotTimer(self._paused_handler)
예제 #51
0
    def __init__(self):
        """
        Set up the basics, register with Freevo and connect
        """
        logger.log( 9, 'PluginInterface.__init__()')
        if not config.LASTFM_USER or not config.LASTFM_PASS:
            self.reason = 'LASTFM_USER or LASTFM_PASS have not been set'
            return

        plugin.DaemonPlugin.__init__(self)
        self.plugin_name = 'audioscrobbler'

        # DeamonPlugin internal settings.
        self.poll_interval = 30
        self.poll_menu_only = False
        self.event_listener = 1

        # Register ourselves
        plugin.register(self, "audioscrobbler")

        # Internal Plugin Setting
        self.playitem = None
        self.starttime = time.time()
        self.failed = []
        self.logincachefilename = os.path.join(config.FREEVO_CACHEDIR, 'audioscrobbler.session')
        self.failedcachefilename = os.path.join(config.FREEVO_CACHEDIR, 'audioscrobbler.pickle')
        self.nowplaying = False
        self.submitted = None

        util.audioscrobbler.DEBUG = config.LASTFM_DEBUG
        self.lastfm = Audioscrobbler(config.LASTFM_USER, config.LASTFM_PASS, self.logincachefilename)
        try:
            f = open(self.failedcachefilename, 'r')
            self.failed = pickle.load(f)
            f.close()
        except IOError:
            pass
예제 #52
0
    # disallow nested Alt

    save = AST2.default_namespace


class Plugin (plugin.TransformPlugin) :
    """Convert (arbitrary) grammars to yacc-style grammars.  Kind of like converting logical formula to Conjunctive Normal Form.

    """
    id = "to_yacc"

    def transform(self, root):
        convert_to_yacc_form(root)
        return root

plugin.register(Plugin)

def convert_plus(node, additions):
    
    if node.has_type('Plus'):
        name = AST2.string("_plus_gen%d" % len(additions))
        e = AST2.Instance(('Alt'), 
                     left=deepcopy(node.expr.the),
                     right=AST2.Instance(('Seq'),
                                    left=AST2.Instance(('Reference'),
                                                  name=name),
                                    right=deepcopy(node.expr.the)
                                    )
                     )
        
        additions.append(AST2.Instance(('Production'), name=name, expr=e))
예제 #53
0
    def __init__(self):
        # create the plugin object
        plugin.Plugin.__init__(self)

        # register xmms as the object to play audio
        plugin.register(FXMMS(), plugin.AUDIO_PLAYER, True)
예제 #54
0
 def __init__(self):
     logger.log( 9, 'PluginInterface.__init__()')
     plugin.MainMenuPlugin.__init__(self)
     self.reminders = Reminders()
     plugin.register(self.reminders, "TVReminders")
     plugin.activate(self.reminders)
예제 #55
0
    def __init__(self):
        """
        init the buttonbar
        """
        plugin.DaemonPlugin.__init__(self)
        plugin.register(self, 'buttonbar')
        self.visible = True
        self.bar     = None
        self.barfile = ''
        self.surface = None
        self.colors = config.BUTTONBAR_ORDER

        self.events = []
        for index in self.colors:
            eventname = 'BUTTONBAR_' + index.upper()
            self.events.append(eventname)

        self.actions = [None, None, None, None]
        if not hasattr(config, 'BUTTONBAR_TVGUIDE_ACTIONS'):
            self.tvguide_actions = [MenuItem('-1 Day', action= self.advance_tv_guide, arg= -24),
                                    MenuItem('-6 Hours', action= self.advance_tv_guide, arg= -6),
                                    MenuItem('+6 Hours', action= self.advance_tv_guide, arg= 6),
                                    MenuItem('+1 Day', action= self.advance_tv_guide, arg= 24)]
        else:
            # Process TV Guide buttons
            self.tvguide_actions = [None, None, None, None]
            for index in range(0, len(self.colors)):
                actionstr = ''
                if config.BUTTONBAR_TVGUIDE_ACTIONS.has_key('button' + str(index+1)):
                    actionstr = config.BUTTONBAR_TVGUIDE_ACTIONS['button' + str(index+1)]
                if config.BUTTONBAR_TVGUIDE_ACTIONS.has_key(self.colors[index]):
                    actionstr = config.BUTTONBAR_TVGUIDE_ACTIONS[self.colors[index]]
                

                if actionstr == 'record':
                    self.tvguide_actions[index] = MenuItem(_('Record'),
                                                  action=self.send_event_to_menu,
                                                  arg= event.TV_START_RECORDING)
                elif actionstr == 'enter':
                    self.tvguide_actions[index] = MenuItem(_('More options'),
                                                  action=self.show_options,
                                                  arg=None)
                                                  #action=self.send_event_to_menu,
                                                  #arg= event.MENU_SUBMENU)
                elif actionstr == 'info':
                    self.tvguide_actions[index] = MenuItem(_('Full Description'),
                                                  action=self.show_program_info)
                elif actionstr == 'now':
                    self.tvguide_actions[index] = MenuItem(_('Now'),
                                                  action=self.jump_to_now)

                elif actionstr.startswith('adv:'):
                    hours = eval(actionstr[4:])
                    self.tvguide_actions[index] = MenuItem('Advance %d hours' % hours,
                                                  action= self.advance_tv_guide,
                                                  arg= hours)
                else:
                    msgtext = _('WARNING: ')
                    msgtext+= _('"%s" is not a valid argument for the button bar. ') % actionstr
                    logger.error(msgtext)



        # Getting current LOCALE
        try:
            locale.resetlocale()
        except:
            pass