rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.playlist)
self.playlist, zoom=self.zoom, rotation = self.rotation)
def eventhandler(self, event):
osd.drawbox(0, osd.height - 90, 350, osd.height, width=-1,
osd.drawbox(0, osd.height - 110, osd.width, osd.height, width=-1,
def drawosd(self):
if tags.has_key('Image DateTime'): osd.drawstring('%s' % tags['Image DateTime'], 20, osd.height - pos, fgcolor=osd.COL_ORANGE)
if tags.has_key('Image DateTime') and \ tags.has_key('EXIF ExifImageWidth') and tags.has_key('EXIF ExifImageLength'): osd.drawstring('%s (%s x %s) @ %s' % \ (os.path.basename(self.filename), tags['EXIF ExifImageWidth'], tags['EXIF ExifImageLength'], \ tags['Image DateTime']), \ 20, osd.height - pos, fgcolor=osd.COL_ORA...
def drawosd(self):
osd.drawstring(os.path.basename(self.filename), 20, osd.height - pos, fgcolor=osd.COL_ORANGE) pos += 30
if tags.has_key('Image Make') and tags.has_key('Image Model') and tags.has_key('Image Software'): osd.drawstring('%s %s (%s)' % (tags['Image Make'], tags['Image Model'], tags['Image Software']), 20, osd.height - pos, fgcolor=osd.COL_ORANGE) pos += 30
def drawosd(self):
str = mameKey('CONFIGMENU')
str = gameKey('CONFIGMENU')
def cmd(self, command): print "In cmd going to do: " + command str = '' if command == 'config': str = mameKey('CONFIGMENU') elif command == 'pause': str = mameKey('PAUSE') elif command == 'reset': str = mameKey('RESET') elif command == 'exit': str = mameKey('EXIT') elif command == 'snapshot': str = mameKey('SNAPSHOT')
str = mameKey('PAUSE')
str = gameKey('PAUSE')
def cmd(self, command): print "In cmd going to do: " + command str = '' if command == 'config': str = mameKey('CONFIGMENU') elif command == 'pause': str = mameKey('PAUSE') elif command == 'reset': str = mameKey('RESET') elif command == 'exit': str = mameKey('EXIT') elif command == 'snapshot': str = mameKey('SNAPSHOT')
str = mameKey('RESET')
str = gameKey('RESET')
def cmd(self, command): print "In cmd going to do: " + command str = '' if command == 'config': str = mameKey('CONFIGMENU') elif command == 'pause': str = mameKey('PAUSE') elif command == 'reset': str = mameKey('RESET') elif command == 'exit': str = mameKey('EXIT') elif command == 'snapshot': str = mameKey('SNAPSHOT')
str = mameKey('EXIT')
str = gameKey('EXIT')
def cmd(self, command): print "In cmd going to do: " + command str = '' if command == 'config': str = mameKey('CONFIGMENU') elif command == 'pause': str = mameKey('PAUSE') elif command == 'reset': str = mameKey('RESET') elif command == 'exit': str = mameKey('EXIT') elif command == 'snapshot': str = mameKey('SNAPSHOT')
str = mameKey('SNAPSHOT')
str = gameKey('SNAPSHOT')
def cmd(self, command): print "In cmd going to do: " + command str = '' if command == 'config': str = mameKey('CONFIGMENU') elif command == 'pause': str = mameKey('PAUSE') elif command == 'reset': str = mameKey('RESET') elif command == 'exit': str = mameKey('EXIT') elif command == 'snapshot': str = mameKey('SNAPSHOT')
print default_val.font.h print
def get_items_geometry(self, settings, obj, display_style=0): if self.last_settings == settings: return self.last_items_geometry self.display_style = display_style self.init_vars(settings, None, widget_type = 'tv')
print selected_val.font.h print
def get_items_geometry(self, settings, obj, display_style=0): if self.last_settings == settings: return self.last_items_geometry self.display_style = display_style self.init_vars(settings, None, widget_type = 'tv')
else:
elif event != rc.IDENTIFY_MEDIA:
def eventhandler(self, event): if event == rc.MENU: if self.view.getVisible() == 1: self.view.setVisible(0) else: self.view.setVisible(1)
parent for all idlebar plugins
To activate the idle bar, put the following in your local_conf.py: plugin.activate('idlebar') You can then add various plugins. Plugins inside the idlebar are sorted based on the level (except the clock, it's always on the right side). Use "freevo plugins -l" to see all available plugins, and "freevo plugins -i idlebar...
def poll(self): """ update the idlebar every 30 secs even if nothing happens """ skin.get_singleton().redraw()
show the current time
Shows the current time. Activate with: plugin.activate('idlebar.clock', level=50) Note: The clock will always be displayed on the right side of the idlebar.
def draw(self, (type, object), x, osd): return
show the status of all rom drives
Show the status of all rom drives. Activate with: plugin.activate('idlebar.cdstatus')
def draw(self, (type, object), x, osd): clock = time.strftime(self.timeformat) font = osd.get_font('clock') pad_x = 10 idlebar_height = 60 w = font.font.stringsize( clock ) h = font.font.height if h > idlebar_height: h = idlebar_height osd.write_text( clock, font, None, ( osd.x + osd.width - w -pad_x ), ( osd.y + ( i...
show if new mail is in the mailbox
Shows if new mail is in the mailbox. Activate with: plugin.activate('idlebar.mail', level=10, args=('path to mailbox', ))
def draw(self, (type, object), x, osd): image = self.cdimages['empty_cdrom'] width = 0 for media in config.REMOVABLE_MEDIA: image = self.cdimages['empty_cdrom'] if hasattr(media.info,'type') and hasattr(media.info,'handle_type'): if media.info.type == 'empty_cdrom': image = self.cdimages['empty_cdrom'] elif not media.i...
show if the tv is locked or not
Informs you, when the xmltv-listings expires. Activate with: plugin.activate('idlebar.tv', level=20, args=(listings_threshold,)) listings_threshold must be a number in hours. For example if you put args=(12, ) then 12 hours befor your xmltv listings run out the tv icon will present a warning. Once your xmltv data is...
def draw(self, (type, object), x, osd): if self.checkmail() > 0: return osd.draw_image(self.MAILIMAGE, (x, osd.y + 10, -1, -1))[0] else: return osd.draw_image(self.NO_MAILIMAGE, (x, osd.y + 10, -1, -1))[0]
show the current weather
Shows the current weather. Activate with: plugin.activate('idlebar.weather', level=30, args=('4-letter code', )) For weather station codes see: http://www.nws.noaa.gov/tg/siteloc.shtml You can also set the unit as second parameter in args ('C', 'F', or 'K')
def draw(self, (type, object), x, osd):
read lm_sensors data for cpu temperature
Displays sensor temperature information (cpu,case) and memory-stats. Activate with: plugin.activate('idlebar.sensors', level=40, args=('cpusensor', 'casesensor', 'meminfo')) plugin.activate('idlebar.sensors', level=40, args=(('cpusensor','compute expression'), ('casesensor','compute_expression'), 'meminfo')) cpu and c...
def draw(self, (type, object), x, osd): font = osd.get_font('weather') self.getStats() widthmem = 0 widthcpu = 0
def __init__(self, sensor, hotstack):
def __init__(self, sensor, compute_expression, hotstack):
def __init__(self, sensor, hotstack): self.initpath = "/proc/sys/dev/sensors/" self.senspath = self.getSensorPath() self.sensor = sensor self.hotstack = hotstack self.washot = False
temp = int(float(string.split(data)[2])) hot = int(float(string.split(data)[0]))
temp = int(temp_compute (float(string.split(data)[2]))) hot = int(temp_compute (float(string.split(data)[0])))
def temp(self): if self.senspath == -1 or not self.senspath: return "?" file = os.path.join( self.senspath, self.sensor ) f = open(file) data = f.read() f.close() temp = int(float(string.split(data)[2])) hot = int(float(string.split(data)[0])) if temp > hot: if self.washot == False: self.hotstack = self.hotstack + 1 ...
print temp
def temp(self): if self.senspath == -1 or not self.senspath: return "?" file = os.path.join( self.senspath, self.sensor ) f = open(file) data = f.read() f.close() temp = int(float(string.split(data)[2])) hot = int(float(string.split(data)[0])) if temp > hot: if self.washot == False: self.hotstack = self.hotstack + 1 ...
self.cpu = self.sensor(cpu, self.hotstack)
if isinstance (cpu,types.StringType): self.cpu = self.sensor(cpu, '@', self.hotstack) else: self.cpu = self.sensor(cpu[0], cpu[1], self.hotstack)
def __init__(self, cpu='temp3', case='temp2' , ram='MemTotal'): IdleBarPlugin.__init__(self) import re self.hotstack = 0 self.case = None self.cpu = self.sensor(cpu, self.hotstack) if case: self.case = self.sensor(case, self.hotstack)
self.case = self.sensor(case, self.hotstack)
if isinstance (case,types.StringType): self.cpu = self.sensor(case, '@', self.hotstack) else: self.cpu = self.sensor(case[0], case[1], self.hotstack)
def __init__(self, cpu='temp3', case='temp2' , ram='MemTotal'): IdleBarPlugin.__init__(self) import re self.hotstack = 0 self.case = None self.cpu = self.sensor(cpu, self.hotstack) if case: self.case = self.sensor(case, self.hotstack)
return a list of actions to that item. Each actions is a tuple (function, 'name-in-the-menu')
return a list of actions to that item. Each action is type Action
def actions(self, item): """ return a list of actions to that item. Each actions is a tuple (function, 'name-in-the-menu') """ return []
print self.network_play
def play(self, arg=None, menuw=None): """ Start playing the item """ print self.network_play self.parent.current_item = self self.elapsed = 0
os.close(fd)
try: os.close(fd) except: pass
def identify(self, media):
if visible and not area.visible:
if visible and not area.visible and old_area:
def prepare(self, settings, menuw, force_redraw): """ this is the first part of main draw function. This function draws the background, checks if redraws are needed and calls the two update functions for the different types of areas """ menu = menuw.menustack[-1]
osd.screen.blit(self.alpha_bg, (area.x, area.y), (area.x, area.y, area.width, area.height))
osd.screen.blit(self.alpha_bg, old_area.pos(self.name), old_area.rect(self.name))
def prepare(self, settings, menuw, force_redraw): """ this is the first part of main draw function. This function draws the background, checks if redraws are needed and calls the two update functions for the different types of areas """ menu = menuw.menustack[-1]
if menuw: menuw.back_one_menu(arg='reload')
def schedule_program(self, arg=None, menuw=None): (result, msg) = record_client.scheduleRecording(self.prog) if result: AlertBox(text=_('"%s" has been scheduled for recording') % \ self.prog.title).show() if menuw: menuw.back_one_menu(arg='reload') else: AlertBox(text=_('Scheduling Failed')+(': %s' % msg)).show() # the...
def fit_item_in_rectangle(self, rectangle, width, height):
def fit_item_in_rectangle(self, rectangle, width, height, font_h):
def fit_item_in_rectangle(self, rectangle, width, height): """ calculates the rectangle geometry and fits it into the area """ x = 0 y = 0 r = self.get_item_rectangle(rectangle, width, height)[2] if r.width > width: r.width, width = width, width - (r.width - width) if r.height > height: r.height, height = height, heigh...
r = self.get_item_rectangle(rectangle, width, height)[2]
r = self.get_item_rectangle(rectangle, width, font_h)[2]
def fit_item_in_rectangle(self, rectangle, width, height): """ calculates the rectangle geometry and fits it into the area """ x = 0 y = 0 r = self.get_item_rectangle(rectangle, width, height)[2] if r.width > width: r.width, width = width, width - (r.width - width) if r.height > height: r.height, height = height, heigh...
ig, r2 = self.fit_item_in_rectangle( head_val.rectangle, col_size, head_h )
ig, r2 = self.fit_item_in_rectangle( head_val.rectangle, col_size, head_h, head_h )
def update_content(self): """ update the listing area """
ig, r = self.fit_item_in_rectangle(val.rectangle, tx1-tx0+1, item_h)
ig, r = self.fit_item_in_rectangle(val.rectangle, tx1-tx0+1, item_h, font_h)
def update_content(self): """ update the listing area """
y=ty0+ig.y, width=ig.width, height=item_h - 2 * ig.y,
y=ty0+ig.y, width=ig.width, height=ig.height,
def update_content(self): """ update the listing area """
del_list = []
def add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): title = escape_value(title) subtitle = escape_value(subtitle) description = escape_value(description) # print 'DESC: %s' % description episode = escape_value(episode)
if old_prog and old_prog.title == title: if old_prog.subtitle != subtitle: self.execute('update programs set subtitle="%s" \ where id="%s"' % (subtitle, old_prog.id)) self.commit() if old_prog.description != description: self.execute('update programs set description="%s" \ where id="%s"' % (description, old_prog.id))...
if old_prog: if old_prog['title'] == title: if old_prog['subtitle'] != subtitle: print 'different subtitles: %s - %s' % (old_prog['subtitle'], subtitle) self.execute('update programs set subtitle="%s" where id=%d' % (subtitle, old_prog.id)) self.commit() if old_prog['description'] != description: print 'different des...
def add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): title = escape_value(title) subtitle = escape_value(subtitle) description = escape_value(description) # print 'DESC: %s' % description episode = escape_value(episode)
self.execute(query) self.commit()
try: self.execute(query) self.commit() except IntegrityError: print 'Program for (%s, %s) exists:' % (channel_id, start) rows = self.execute('select * from programs where channel_id="%s" \ and start=%s' % (channel_id, start)) for row in rows: print ' %s' % row traceback.print_exc()
def add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): title = escape_value(title) subtitle = escape_value(subtitle) description = escape_value(description) # print 'DESC: %s' % description episode = escape_value(episode)
query = 'delete from programs where id="%s"' % id
query = 'delete from programs where id=%d' % id print 'REMOVE: %s' % escape_query(query)
def remove_program(self, id): query = 'delete from programs where id="%s"' % id
query = '%s id="%s"' % (query, id)
query = '%s id=%d' % id
def remove_programs(self, ids): query = 'delete from programs where' for id in ids: query = '%s id="%s"' % (query, id) if ids.index(id) < len(ids)-1: query = '%s or' % query
print 'REMOVE: %s' % escape_query(query)
def remove_programs(self, ids): query = 'delete from programs where' for id in ids: query = '%s id="%s"' % (query, id) if ids.index(id) < len(ids)-1: query = '%s or' % query
def add_data_vdr(self, vdr_epg_file):
def add_data_vdr(self, epg_file=None, host=None, port=None):
def add_data_vdr(self, vdr_epg_file): try: import vdrpylib except: print 'vdrpylib not installed'
import vdrpylib
import vdr.vdr
def add_data_vdr(self, vdr_epg_file): try: import vdrpylib except: print 'vdrpylib not installed'
print 'vdrpylib not installed' return False
print 'vdrpylib is not installed:' print 'http://sourceforge.net/projects/vdrpylib/' print 'pyepg epgfile1 is %s' % epg_file if os.path.isfile(epg_file): (vdr_dir, epg_file) = os.path.split(epg_file) vdr = vdr.vdr.VDR(epgfile=epg_file, videopath=vdr_dir) print 'pyepg epgfile is %s' % vdr.epgfile epg = vdr.readepg() ch...
def add_data_vdr(self, vdr_epg_file): try: import vdrpylib except: print 'vdrpylib not installed'
ret.append(True)
ret.append(False)
def __check_list(self, val, pattern): """ check parameter against pattern """ ret = [] for i in range(len(val)): if pattern[i] == str: ret.append(unicode(val[i], 'UTF8').\ encode(sysconfig.ENCODING, 'replace')) elif pattern[i] == unicode: ret.append(unicode(val[i], 'UTF8')) elif pattern[i] == bool: if val[i] in ( 'TRUE...
if DEBUG: print 'DrawMenu_Selection()'
def DrawMenu_Selection(self, menuw, settings, x0, y0, width, height): val = settings menu = menuw.menustack[-1]
kaa.epg.get_channel_by_id(p.channel).title \
kaa.epg.get_channel_by_id(p.channel).id \
def render(self, request): """ Render the page based on the given request. """ fv = HTMLResource() form = request.query chan = form.get('chan') start = form.get('start') action = form.get('action') progs = []
'</a>') % (channel, prog.start, Unicode(prog['title']))
'</a>') % (prog.channel, prog.start, Unicode(prog['title']))
def render(self, request): """ Render the page based on the given request. """ fv = HTMLResource() form = request.query chan = form.get('chan') start = form.get('start') action = form.get('action') progs = []
info = media[0], '%s [%s]' % (media[0], label), image, (media[2], 1, [])
info = media[0], '%s [%s]' % (media[0], label), image, \ (media[2], '1 -cdrom-device %s' % device, [])
def identify(self, cd_entry): dir, device, name, ejected, last_code, info = cd_entry
if i.id() == selected_id:
if Unicode(i.id()) == Unicode(selected_id):
def build(self, arg=None, menuw=None): """ build the items for the directory """ self.playlist = [] self.play_items = [] self.dir_items = [] self.pl_items = []
if menu.page_start + (self.getCols(val) * self.getRows(val)) > \ len(menu.choices):
if (menu.page_start + (self.getCols(val) * self.getRows(val)) >= len(menu.choices)):
def __call__(self, menuw, settings): menu = menuw.menustack[-1] val = settings.e_menu['image']
self.drawstringframedhard(string,x,y,width, height, fgcolor, bgcolor, font, ptsize, align_h, align_v)
return self.drawstringframedhard(string,x,y,width, height, fgcolor, bgcolor, font, ptsize, align_h, align_v)
def drawstringframed(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', mode='hard'): if mode == 'hard': self.drawstringframedhard(string,x,y,width, height, fgcolor, bgcolor, font, ptsize, align_h, align_v) elif mode == 'soft': self.drawstringframedsoft(st...
self.drawstringframedsoft(string,x,y,width, height, fgcolor, bgcolor, font, ptsize, align_h, align_v)
return self.drawstringframedsoft(string,x,y,width, height, fgcolor, bgcolor, font, ptsize, align_h, align_v)
def drawstringframed(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', mode='hard'): if mode == 'hard': self.drawstringframedhard(string,x,y,width, height, fgcolor, bgcolor, font, ptsize, align_h, align_v) elif mode == 'soft': self.drawstringframedsoft(st...
def ext(machine):
class Emu(ChildApp):
def ext(machine): """ Returns a list of extensions to search for based on machine type. """ extensions = { 'GB' : 'gb', 'GBC' : 'gbc', 'GBA' : 'gba', 'VBOY' : 'vb', 'NES' : 'nes', 'SNES' : 'smc', 'N64' : [ 'rom', 'z64', 'v64' ], 'GG' : [ 'gg' ], 'SG1K' : [ 'sc', 'sg' ], 'SMS' : [ 'sms' ], 'SMD' : [ 'bin', 'smd' ], 'LYN...
Returns a list of extensions to search for based on machine type.
Code used by all supported emulators This is a generic emulator class that all of the supported emulators extend. It is a nice place to store all the similar code.
def ext(machine): """ Returns a list of extensions to search for based on machine type. """ extensions = { 'GB' : 'gb', 'GBC' : 'gbc', 'GBA' : 'gba', 'VBOY' : 'vb', 'NES' : 'nes', 'SNES' : 'smc', 'N64' : [ 'rom', 'z64', 'v64' ], 'GG' : [ 'gg' ], 'SG1K' : [ 'sc', 'sg' ], 'SMS' : [ 'sms' ], 'SMD' : [ 'bin', 'smd' ], 'LYN...
extensions = { 'GB' : 'gb', 'GBC' : 'gbc', 'GBA' : 'gba', 'VBOY' : 'vb', 'NES' : 'nes', 'SNES' : 'smc', 'N64' : [ 'rom', 'z64', 'v64' ], 'GG' : [ 'gg' ], 'SG1K' : [ 'sc', 'sg' ], 'SMS' : [ 'sms' ], 'SMD' : [ 'bin', 'smd' ], 'LYNX' : [ 'o', 'lnx' ], '2600' : 'a26', '5200' : [ 'bin', 'a52' ], '7800' : 'a78', 'JAG' : 'ja...
def __init__(self, cmdline): ChildApp.__init__(self, cmdline, 'games', True, has_display=True) self.__rom = None self.__cmd = cmdline
def ext(machine): """ Returns a list of extensions to search for based on machine type. """ extensions = { 'GB' : 'gb', 'GBC' : 'gbc', 'GBA' : 'gba', 'VBOY' : 'vb', 'NES' : 'nes', 'SNES' : 'smc', 'N64' : [ 'rom', 'z64', 'v64' ], 'GG' : [ 'gg' ], 'SG1K' : [ 'sc', 'sg' ], 'SMS' : [ 'sms' ], 'SMD' : [ 'bin', 'smd' ], 'LYN...
if machine in extensions: return extensions[machine]
def __get_rom(self): return self.__rom
def ext(machine): """ Returns a list of extensions to search for based on machine type. """ extensions = { 'GB' : 'gb', 'GBC' : 'gbc', 'GBA' : 'gba', 'VBOY' : 'vb', 'NES' : 'nes', 'SNES' : 'smc', 'N64' : [ 'rom', 'z64', 'v64' ], 'GG' : [ 'gg' ], 'SG1K' : [ 'sc', 'sg' ], 'SMS' : [ 'sms' ], 'SMD' : [ 'bin', 'smd' ], 'LYN...
log.warning('Unknown machine type %s' % machine) return None
def launch(self, rom): self.__rom = rom
def ext(machine): """ Returns a list of extensions to search for based on machine type. """ extensions = { 'GB' : 'gb', 'GBC' : 'gbc', 'GBA' : 'gba', 'VBOY' : 'vb', 'NES' : 'nes', 'SNES' : 'smc', 'N64' : [ 'rom', 'z64', 'v64' ], 'GG' : [ 'gg' ], 'SG1K' : [ 'sc', 'sg' ], 'SMS' : [ 'sms' ], 'SMD' : [ 'bin', 'smd' ], 'LYN...
def title(system): """ Returns the standard name for a machine type """ titles = { 'GB' : 'Nintendo Gameboy (Handheld)', 'GBC' : 'Nintendo Gameboy Color (Handheld)', 'GBA' : 'Nintendo Gameboy Advance (Handheld)', 'VBOY' : 'Nintendo VirtualBoy', 'NES' : 'Nintendo Entertainment System', 'SNES' : 'Super Nintendo', 'N64' :...
log.warn(self.__cmd + ' ' + self.title())
def title(system): """ Returns the standard name for a machine type """ titles = { 'GB' : 'Nintendo Gameboy (Handheld)', 'GBC' : 'Nintendo Gameboy Color (Handheld)', 'GBA' : 'Nintendo Gameboy Advance (Handheld)', 'VBOY' : 'Nintendo VirtualBoy', 'NES' : 'Nintendo Entertainment System', 'SNES' : 'Super Nintendo', 'N64' :...
if system in titles: return titles[system]
self.child_start(self.__cmd + ' "' + self.title() + '"')
def title(system): """ Returns the standard name for a machine type """ titles = { 'GB' : 'Nintendo Gameboy (Handheld)', 'GBC' : 'Nintendo Gameboy Color (Handheld)', 'GBA' : 'Nintendo Gameboy Advance (Handheld)', 'VBOY' : 'Nintendo VirtualBoy', 'NES' : 'Nintendo Entertainment System', 'SNES' : 'Super Nintendo', 'N64' :...
log.warning('Unknown machine type %s' % system) return None
def eventhandler(self, event): log.debug('The emulator eventhandler got an event: %s' % event) if event == STOP: self.stop() if plugin.is_active('input.joystick'): plugin.getbyname('JOYSTICK').activate(True)
def title(system): """ Returns the standard name for a machine type """ titles = { 'GB' : 'Nintendo Gameboy (Handheld)', 'GBC' : 'Nintendo Gameboy Color (Handheld)', 'GBA' : 'Nintendo Gameboy Advance (Handheld)', 'VBOY' : 'Nintendo VirtualBoy', 'NES' : 'Nintendo Entertainment System', 'SNES' : 'Super Nintendo', 'N64' :...
prog.stop = timestr2secs_utc(p['start'][0:8] + '235900' + p['start'][14:18])
prog.stop = timestr2secs_utc(p['start'][0:8] + '235900' + \ p['start'][14:18])
def load_guide(verbose=True, XMLTV_FILE=None): """ Load a guide from the raw XMLTV file using the xmltv.py support lib. Returns a TvGuide or None if an error occurred """ if not XMLTV_FILE: XMLTV_FILE = config.XMLTV_FILE # Create a new guide guide = epg_types.TvGuide() # Is there a file to read from? if os.path.isfil...
for dep in libdeps:
deplist = libdeps.keys() for dep in deplist:
def main(): '''Build a list of all dll dependencies, copy stripped versions to dll/ Dependencies are found in the directory lib (Python with installed modules), and apps (Freevo applications). The "preloads" file is also generated. ''' libdeps = {} check_dir('lib', libdeps) check_dir('apps', libdeps) print print 'F...
self.item = item
def play(self, item, player=None): """ play an item """ self.item = item if self.player and self.player.is_playing(): log.info('stop playing') self.stop()
log.info('stop playing') self.stop()
return
def play(self, item, player=None): """ play an item """ self.item = item if self.player and self.player.is_playing(): log.info('stop playing') self.stop()
if plugin.getbyname('MIXER'): plugin.getbyname('MIXER').reset()
def play(self, item, player=None): """ play an item """ self.item = item if self.player and self.player.is_playing(): log.info('stop playing') self.stop()
def try_next_player(self): """ try next possible player because the last one didn't work """ self.stop() log.info('error, try next player') player = None next = False for r, p in self.possible_player: if next: player = p break if p == self.player: next = True if player: self.play(self.item, player=player) return 1 l...
def try_next_player(self): """ try next possible player because the last one didn't work """ self.stop() log.info('error, try next player') player = None next = False for r, p in self.possible_player: if next: player = p break if p == self.player: next = True
stop playing """ Application.stop(self)
Stop playing. """
def stop(self): """ stop playing """ Application.stop(self) if self.player: self.player.stop() self.running = False
if not self.visible:
if not self.visible or not self.running:
def refresh(self): """ update the screen """ if not self.visible: return
if not self.running: return
def refresh(self): """ update the screen """ if not self.visible: return
if event == PLAY_END and event.arg: self.player.stop() if self.try_next_player(): return True if event in ( STOP, PLAY_END, USER_END ):
if event == STOP:
def eventhandler(self, event): """ React on some events or send them to the real player or the item belongig to the player """ if event == PLAY_END and event.arg: self.player.stop() if self.try_next_player(): return True if event in ( STOP, PLAY_END, USER_END ): self.stop() return self.item.eventhandler(event)
return self.item.eventhandler(event)
self.item.eventhandler(event) return True if event == PLAY_END: Application.stop(self) self.item.eventhandler(event) return True
def eventhandler(self, event): """ React on some events or send them to the real player or the item belongig to the player """ if event == PLAY_END and event.arg: self.player.stop() if self.try_next_player(): return True if event in ( STOP, PLAY_END, USER_END ): self.stop() return self.item.eventhandler(event)
def __get_dummy_programs(self, start, stop):
def __get_dummy_program(self, start, stop):
def __get_dummy_programs(self, start, stop): """ Return some default Program with intervals no longer than a set default. """ default_prog_interval = 30 * 60 dummies = [] d_start = start d_stop = 0
default_prog_interval = 30 * 60 dummies = [] d_start = start d_stop = 0 sec_after_last = start % default_prog_interval sec_until_next = default_prog_interval - sec_after_last while(d_stop < stop): d_stop = d_start + sec_until_next if d_stop > stop: d_stop = stop dummies.append(Program(-1, u'NO DATA', d_start, d_sto...
return Program(-1, u'NO DATA', start, stop, '', '', '', self)
def __get_dummy_programs(self, start, stop): """ Return some default Program with intervals no longer than a set default. """ default_prog_interval = 30 * 60 dummies = [] d_start = start d_stop = 0
dummy_progs = self.__get_dummy_programs(start, stop)
dummy_progs.append(self.__get_dummy_program(start, stop))
def __import_programs(self, start, stop=-1, progs=[]): """ Get programs from the database to create Program from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ # FIXME: adding dummy programs will add them from start to stop and # not in 30 minu...
n = self.__get_dummy_programs(start, p.start) dummy_progs += n
dummy_progs.append(self.__get_dummy_program(start, p.start))
def __import_programs(self, start, stop=-1, progs=[]): """ Get programs from the database to create Program from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ # FIXME: adding dummy programs will add them from start to stop and # not in 30 minu...
n = self.__get_dummy_programs(p.stop, stop) dummy_progs += n
dummy_progs.append(self.__get_dummy_program(p.stop, (int(time.time())/86400*86400)))
def __import_programs(self, start, stop=-1, progs=[]): """ Get programs from the database to create Program from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ # FIXME: adding dummy programs will add them from start to stop and # not in 30 minu...
n = self.__get_dummy_programs(last.stop, p.start) dummy_progs += n
dummy_progs.append(self.__get_dummy_program(last.stop, p.start))
def __import_programs(self, start, stop=-1, progs=[]): """ Get programs from the database to create Program from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ # FIXME: adding dummy programs will add them from start to stop and # not in 30 minu...
print "Conversion took", time.time()-t1
def _blit(self, img, r): pos, size = r t0=time.time()
print "Blit", r, "took", time.time()-t0
def _blit(self, img, r): pos, size = r t0=time.time()
if not os.path.isfile(record_daemon.SCHEDULE): return None
def view_schedule(self,arg=None, menuw=None): '''Set up the view recording menu or the delete scheduled item menu''' items = [] line = '0' itemcount = 0 global killflag fd = open(record_daemon.SCHEDULE,'r') #delete old scheduled items from the file since we wont need them #this could be done more efficiently from re...
line = line[ line.rfind('/') +1: line.find('.avi')]
line = line[ line.rfind('/') +1: line.find('.mpg')]
def view_schedule(self,arg=None, menuw=None): '''Set up the view recording menu or the delete scheduled item menu''' items = [] line = '0' itemcount = 0 global killflag fd = open(record_daemon.SCHEDULE,'r') #delete old scheduled items from the file since we wont need them #this could be done more efficiently from re...
image = util.resize(image, 200, 280)
if image != None: image = util.resize(image, 200, 280)
def DrawMenu(self, menuw): osd.clearscreen(osd.COL_WHITE)
for root, dirs, files in os.walk(top, topdown=False):
for root, dirs, files in os.path.walk(top, topdown=False):
def rmrf(top=None): """ Pure python version of 'rm -rf' """ if not top == '/' and not top == '' and not top == ' ' and top: for root, dirs, files in os.walk(top, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: os.rmdir(os.path.join(root, name)) os.rmdir(top)
self.track, self.trackof, self.year )
self.track, self.trackof, self.year, self.url )
def dump(self): return ( self.title, self.album, self.artist, self.length, self.track, self.trackof, self.year )
self.trackof, self.year = data
self.trackof, self.year, self.url = data
def restore(self, data): self.title, self.album, self.artist, self.length, self.track, \ self.trackof, self.year = data
Sets the info variables with info from the mp3
Sets the info variables with info from the fxd
def set_info_radio(self, filename): """ Sets the info variables with info from the mp3
media.videoinfo.media_id = media_id
media.videoinfo.media_id = media.id media.videoinfo.label = media.label
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) s = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) except: # maybe we n...
PopupBox.__init__(self, text, handler)
PopupBox.__init__(self, text)
def __init__(self, text, handler=None): PopupBox.__init__(self, text, handler) self.handler = handler c = self.content_pos
if self_num_changes != 0:
if self_num.changes != 0:
def callback(self): if self_num_changes != 0: progress = '%3d%%' % (self.pos * 100 / self.num_changes) else: progress = '??%%' print '\r%-70s %s' % (self.txt, progress), sys.__stdout__.flush() self.pos += 1
os.system('rm %s' % dbath)
os.system('rm %s' % dbpath)
def __init__(self, dbpath): try: if os.path.getsize(dbpath) == 0: log.error('EPG database is zero size (invalid), removing it') os.system('rm %s' % dbath) except OSError: if os.path.isfile(dbpath): log.error('Problem reading %s, check permissions' % dbpath) traceback.print_exc() raise OSError
print " <icon>http://www.teveblad.be/gfx/logos/%s.gif</icon>" % self.title
print " <icon src=\"http://www.teveblad.be/gfx/logos/%s.gif\" />" % self.title
def xml(self,today = strftime("%Y/%m/%d",localtime(time())),tomorrow = strftime("%Y/%m/%d",localtime(time()+86400))):
usage()
sys.stderr.write('Invalid command line options. Try --help for more info.\n')
def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "days="]) except getopt.GetoptError: # print help information and exit: usage() sys.exit(2) dagen = 2 for o, a in opts: if o in ("-h", "--help"): print "help" usage() sys.exit() if o in ("-d", "--days"): dagen = int(a) print "<?xml version=\"1.0...
dagen = 2
def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "days="]) except getopt.GetoptError: # print help information and exit: usage() sys.exit(2) dagen = 2 for o, a in opts: if o in ("-h", "--help"): print "help" usage() sys.exit() if o in ("-d", "--days"): dagen = int(a) print "<?xml version=\"1.0...
print "help" usage()
usage(dagen)
def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "days="]) except getopt.GetoptError: # print help information and exit: usage() sys.exit(2) dagen = 2 for o, a in opts: if o in ("-h", "--help"): print "help" usage() sys.exit() if o in ("-d", "--days"): dagen = int(a) print "<?xml version=\"1.0...
cChannel(1,'TV1',dagen).xml() cChannel(2,'Ketnet',dagen).xml() cChannel(3,'Canvas',dagen).xml() cChannel(4,'VTM',dagen).xml() cChannel(5,'Kanaal2',dagen).xml() cChannel(6,'VT4',dagen).xml() cChannel(7,'Vitaya',dagen).xml() cChannel(11,'Ned1',dagen).xml() cChannel(12,'Ned2',dagen).xml() cChannel(13,'Ned3',dagen).xml(...
for channel in config.options('channels'): if config.getint('channels', channel) == TRUE: cChannel(lower(channel), channel, dagen).xml()
def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "days="]) except getopt.GetoptError: # print help information and exit: usage() sys.exit(2) dagen = 2 for o, a in opts: if o in ("-h", "--help"): print "help" usage() sys.exit() if o in ("-d", "--days"): dagen = int(a) print "<?xml version=\"1.0...
def __child_died( self, proc ):
def __child_died( self ):
def __child_died( self, proc ): """ Callback from watcher when the child died. """ self.dead = True # cleanup IO handler and kill timer self.stdout.cleanup() self.stderr.cleanup() if self.__kill_timer: notifier.removeTimer( self.__kill_timer ) self.finished()
self.__processes[ p ]( p )
def step( self ): remove_proc = [] for p in copy.copy( self.__processes ): try: if isinstance( p.child, popen2.Popen3 ): pid, status = os.waitpid( p.child.pid, os.WNOHANG ) else: pid, status = os.waitpid( p.pid, os.WNOHANG ) except OSError: remove_proc.append( p ) continue if not pid: continue log.info('DEAD CHILD: %s ...
config.XMLTV_FILE ))
xmltvtmp ))
def grab(): if not config.XMLTV_GRABBER: print 'No program found to grab the listings. Please set XMLTV_GRABBER' print 'in local.conf.py to the grabber you need' print usage() print 'Grabbing listings.' xmltvtmp = '/tmp/TV.xml.tmp' os.system('%s --output %s --days %s' % ( config.XMLTV_GRABBER, xmltvtmp, config.XMLTV_D...
def progRunning(prog=None): if not prog: return 'ERROR: no prog'
def progRunning(prog):
def progRunning(prog=None): if not prog: return 'ERROR: no prog' now = time.time() if prog.start <= now and prog.stop >= now: return True return False