def __init__(self, command=None, directory=None): Item.__init__(self, skin_type='commands') self.display_type = 'commands' self.stoposd = False self.use_wm = False self.spawnwm = config.COMMAND_SPAWN_WM self.killwm = config.COMMAND_KILL_WM self.stdout = True self.rc = rc.get_singleton() if command and directory: self.name = command self.cmd = os.path.join(directory, command) self.image = util.getimage(self.cmd)
def check_recordings(self, mask=None, filename=None, target=None): """ Check the TV recordings directory to determine if the contents have changed, and if they have update the list of recordings and the currently registered menu. """ changed = False try: if vfs.mtime(config.TV_RECORD_DIR) > self.last_time: changed = True except (OSError, IOError): # the directory is gone logger.debug('DiskManager: unable to read recordings directory') return if changed: self.last_time = vfs.mtime(config.TV_RECORD_DIR) self.update_recordings() # Only call update if the menu is on the top of the menu stack and we are in the menu's context if self.menu and (self.menuw.menustack[-1] == self.menu) and \ self.menuw.event_context == rc.get_singleton().context: self.obj.browse(menuw=self.menuw, arg='update')
# kaa imports import kaa import time #import sys #import os #import select #import struct #import traceback import config import plugin import rc rc = rc.get_singleton() CMD_SET_REPORT = 0x52 RID_LEDS = 0x11 RID_MODE = 0x12 MODE_BASIC = 0x30 MODE_ACC = 0x31 LED1_ON = 0x10 LED2_ON = 0x20 LED3_ON = 0x40 LED4_ON = 0x80
def __init__(self): plugin.DaemonPlugin.__init__(self) self.plugin_name = 'freevused' self.event_listener = True self.shutdown_plugin = False self.connected = False self.server_sock = None self.tx = None self.address = 0 self.port = 0 self.data = '' self.menuw = None self.timer = None self.conn_timer = None self.osd_message_status = None self.menu_isfresh = False self.playing = False self.menu_client_waiting = False self.audioplayer = None if hasattr(config, 'FVUSED_BIND_TIMEOUT'): self.bind_timeout = config.FVUSED_BIND_TIMEOUT else: self.bind_timeout = 5 if hasattr(config, 'FVUSED_OSD_MESSAGE'): self.osd_message = config.FVUSED_OSD_MESSAGE else: self.osd_message = False if hasattr(config, 'FVUSED_CMDS'): self.cmds = config.FVUSED_CMDS else: self.cmds = { 'PREV': 'UP', # 1st row left 'STRT': 'SELECT', # 1nd row center 'NEXT': 'DOWN', # 1st row right 'RWND': 'LEFT', # 2nd row left 'PAUS': 'PAUSE', # 2nd row center 'FFWD': 'RIGHT', # 2nd row right 'VOL-': 'MIXER_VOLDOWN', # 3rd row left 'STOP': 'EXIT', # 3rd row center 'VOL+': 'MIXER_VOLUP', # 3rd row right 'VOLM': 'MIXER_MUTE', # 4th row left 'SLCT': 'ENTER', # 4th row center 'MAIN': 'STOP', # 4th row right 'DISP': 'DISPLAY', # More actions 'EJEC': 'EJECT', 'DEAU': 'DISPLAY', 'CHA+': 'CH+', 'CHA-': 'CH-', 'RECO': 'REC', 'GUID': 'GUIDE', 'NUM0': '0', # Numeric keyboard 'NUM1': '1', 'NUM2': '2', 'NUM3': '3', 'NUM4': '4', 'NUM5': '5', 'NUM6': '6', 'NUM7': '7', 'NUM8': '8', 'NUM9': '9', 'STAT': 'FVUSED_ITEM_INFO' } # self.poll_menu_only = False self.timer = kaa.Timer(self.timer_handler) self.timer.start(config.POLL_TIME) self.rc = rc.get_singleton() self.FVUSED_ITEM_INFO = em.Event('FVUSED_ITEM_INFO') self.connection_thread()
# kaa imports import kaa import time #import sys #import os #import select #import struct #import traceback import config import plugin import rc rc = rc.get_singleton() CMD_SET_REPORT = 0x52 RID_LEDS = 0x11 RID_MODE = 0x12 MODE_BASIC = 0x30 MODE_ACC = 0x31 LED1_ON = 0x10 LED2_ON = 0x20 LED3_ON = 0x40 LED4_ON = 0x80 buttonmap = {
try: from xml.utils import qp_xml from xml.dom import minidom # now load other modules to check if all requirements are installed import pygame import twisted import Numeric import kaa import kaa.metadata as mmpython import kaa.imlib2 as Image import config import rc rc.get_singleton(is_helper=0) except ImportError, why: print 'Can\'t find all Python dependencies:' print why if str(why)[-7:] == 'Numeric': print 'You need to recompile pygame after installing Numeric!' print print 'Not all requirements of Freevo are installed on your system.' print 'Please check the INSTALL file for more information.' print sys.exit(0) # check if kaa.base is up to date to avoid bug reports for already fixed bugs v = 'unknown' try:
import pprint try: from xml.dom import minidom # now load other modules to check if all requirements are installed import pygame import twisted import kaa import kaa.metadata as metadata import kaa.imlib2 as imlib2 import config import rc rc.get_singleton(is_helper=0) except ImportError, why: print 'Can\'t find all Python dependencies:' print why if str(why)[-7:] == 'Numeric': print 'You need to recompile pygame after installing Numeric!' print print 'Not all requirements of Freevo are installed on your system.' print 'Please check the INSTALL file for more information.' print sys.exit(0) kaa_modules = [('kaa-base', 'kaa', '0.99'), ('kaa-metadata', 'kaa.metadata', '0.7'),
except e: raise _debug_(str(self.state)) _debug_(str(value_has_been)) for button, value in self.state['button'].iteritems(): if button in button_to_abbreviation: abbr_button = button_to_abbreviation[button] if abbr_button in config.JOY_CMDS: command = config.JOY_CMDS[abbr_button] if value == 1 or button in value_has_been['button']: self.ps_controller_started = 1 self.last_input_time = time.time() print('command:'+str(command)) handler = rc.get_singleton() handler.post_event(handler.key_event_mapper(command)) if abbr_button == 'ps': _debug_("PS button state:"\ +str(self.ps_button_time)\ +":"+str(value)\ +":"+str(time.time())) if self.ps_button_time != 0 \ and time.time() > self.ps_button_time + 2: handler = rc.get_singleton() handler.post_event(handler.key_event_mapper('SHUTDOWN')) elif value == 1 and self.ps_button_time == 0: self.ps_button_time = time.time() elif value == 0 and self.ps_button_time != 0: self.ps_button_time = 0 self.shutdown_controller()