rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
Default for PopubBox is to have no border.
Default for PopupBox is to have no border.
def set_border(self, bs): """ bs Border style to create.
img = self._image.scale(w, h / aspect)
img = self._image.scale(0, 0, self.width, self.height, w, h / aspect)
def scale_preserve_aspect(self, (w, h)): """ Scales the image while retaining the original aspect ratio and return a new image.
img = self._image.scale(w * aspect, h)
img = self._image.scale(0, 0, self.width, self.height, w * aspect, h)
def scale_preserve_aspect(self, (w, h)): """ Scales the image while retaining the original aspect ratio and return a new image.
return None
return None, 0, 0
def getFormatedImage(self, filename, w, h, i_orientation=None): image = osd.loadbitmap('thumb://%s' % filename)
if h > w: orientation='vertical' else: orientation='horizontal'
def getFormatedImage(self, filename, w, h, i_orientation=None): image = osd.loadbitmap('thumb://%s' % filename)
else: if i_h > i_w: i_orientation='vertical' else: i_orientation='horizontal' if orientation != i_orientation: rotation=90.0
def getFormatedImage(self, filename, w, h, i_orientation=None): image = osd.loadbitmap('thumb://%s' % filename)
return image
return image, int(i_w*scale), int(i_h*scale)
def getFormatedImage(self, filename, w, h, i_orientation=None): image = osd.loadbitmap('thumb://%s' % filename)
orientation)
orientation)[0]
def View(self, item, settings): val = settings.view
image_width, image_height)
image_width, image_height)[0]
def Listing(self, to_listing, settings): val = settings.listing
image_height, orientation)
image_height, orientation)[0]
def Listing(self, to_listing, settings): val = settings.listing
def timestr2secs_utc(str):
def timestr2secs_utc(timestr):
def timestr2secs_utc(str): # This is either something like 'EDT', or '+1' try: tval, tz = str.split() except ValueError: # The time value couldn't be decoded raise EPG_TIME_EXC if tz == 'CET': tz='+1' # Is it the '+1' format? if tz[0] == '+' or tz[0] == '-': tmTuple = ( int(tval[0:4]), int(tval[4:6]), int(tval[6:8]), ...
tval, tz = str.split()
tval, tz = timestr.split()
def timestr2secs_utc(str): # This is either something like 'EDT', or '+1' try: tval, tz = str.split() except ValueError: # The time value couldn't be decoded raise EPG_TIME_EXC if tz == 'CET': tz='+1' # Is it the '+1' format? if tz[0] == '+' or tz[0] == '-': tmTuple = ( int(tval[0:4]), int(tval[4:6]), int(tval[6:8]), ...
raise EPG_TIME_EXC
tval = timestr tz = str(-time.timezone/3600)
def timestr2secs_utc(str): # This is either something like 'EDT', or '+1' try: tval, tz = str.split() except ValueError: # The time value couldn't be decoded raise EPG_TIME_EXC if tz == 'CET': tz='+1' # Is it the '+1' format? if tz[0] == '+' or tz[0] == '-': tmTuple = ( int(tval[0:4]), int(tval[4:6]), int(tval[6:8]), ...
secs = time.mktime(strptime.strptime(str, xmltv.date_format))
secs = time.mktime(strptime.strptime(timestr, xmltv.date_format))
def timestr2secs_utc(str): # This is either something like 'EDT', or '+1' try: tval, tz = str.split() except ValueError: # The time value couldn't be decoded raise EPG_TIME_EXC if tz == 'CET': tz='+1' # Is it the '+1' format? if tz[0] == '+' or tz[0] == '-': tmTuple = ( int(tval[0:4]), int(tval[4:6]), int(tval[6:8]), ...
str = str.replace('EST', '') secs = time.mktime(strptime.strptime(str, xmltv.date_format))
timestr = timestr.replace('EST', '') secs = time.mktime(strptime.strptime(timestr, xmltv.date_format))
def timestr2secs_utc(str): # This is either something like 'EDT', or '+1' try: tval, tz = str.split() except ValueError: # The time value couldn't be decoded raise EPG_TIME_EXC if tz == 'CET': tz='+1' # Is it the '+1' format? if tz[0] == '+' or tz[0] == '-': tmTuple = ( int(tval[0:4]), int(tval[4:6]), int(tval[6:8]), ...
MPLAYER_ARGS_DVD += ' -nodvdprotection-override'
MPLAYER_ARGS['dvd'] += ' -nodvdprotection-override'
def read_config(filename, conf): if DEBUG: print 'Reading config file %s' % filename c = open(filename) for line in c.readlines(): vals = line.strip().split() if DEBUG: print 'Cfg file data: "%s"' % line.strip() try: name, val = vals[0], vals[2] except: print 'Error parsing config file data "%s"' % line.strip() contin...
self.h += self.shadow.y
self.h += abs(self.shadow.y)
def prepare(self, color, search_dirs=None, image_names=None, scale=1.0): if color.has_key(self.color): self.color = color[self.color] self.size = int(float(self.size) * scale) self.font = osd.getfont(self.name, self.size) self.h = self.font.height if self.shadow.visible: if color.has_key(self.shadow.color): se...
menu.page_start += self.cols * (self.rows-1)
if self.rows == 1: menu.page_start += self.cols else: menu.page_start += self.cols * (self.rows-1)
def goto_next_page(self, arg=None, menuw=None): menu = self.menustack[-1] self.rows, self.cols = skin.ItemsPerMenuPage(menu) items_per_page = self.rows*self.cols
curr_selected = self.all_items.index(menu.selected)
try: curr_selected = self.all_items.index(menu.selected) except ValueError: curr_selected += self.cols
def eventhandler(self, event): menu = self.menustack[-1]
curr_selected = self.all_items.index(menu.selected)
try: curr_selected = self.all_items.index(menu.selected) except ValueError: curr_selected -= self.cols
def eventhandler(self, event): menu = self.menustack[-1]
self.tmp_objects.text.append((x, y, x+width, y+height2, Unicode(_(text)), font, height,
self.tmp_objects.text.append((x, y, x+width, y+height2, text, font, height,
def drawstring(self, text, font, content, x=-1, y=-1, width=None, height=None, align_h = None, align_v = None, mode='hard', ellipses='...'): """ writes a text ... or better stores the information about this call in a variable. The real drawing is done inside draw() """
menuw.init_page()
def toggle(arg=None, menuw=None): arg[1][arg[2]] = not arg[1][arg[2]] old = menuw.menustack[-1].selected pos = menuw.menustack[-1].choices.index(menuw.menustack[-1].selected) new = add_toogle(arg[0], arg[1], arg[2]) new.image = old.image if hasattr(old, 'display_type'): new.display_type = old.display_type menuw.men...
if item.filename or (item.mode in ('dvd', 'vcd') and item.player_rating >= 20):
if item.filename or (item.mode in ('dvd', 'vcd') and \ item.player_rating >= 20):
def get_items(item): next_start = 0 items = [] print item.subitems if item.filename or (item.mode in ('dvd', 'vcd') and item.player_rating >= 20): if item.info.has_key('audio') and len(item.info['audio']) > 1: items.append(menu.MenuItem(_('Audio selection'), audio_selection_menu, item)) if item.info.has_key('subtitles...
item.info['type'] and item.info['type'].lower().find('mpeg') != -1):
item.info['type'] and \ item.info['type'].lower().find('mpeg') != -1):
def get_items(item): next_start = 0 items = [] print item.subitems if item.filename or (item.mode in ('dvd', 'vcd') and item.player_rating >= 20): if item.info.has_key('audio') and len(item.info['audio']) > 1: items.append(menu.MenuItem(_('Audio selection'), audio_selection_menu, item)) if item.info.has_key('subtitles...
'MENU' : DVDNAV_TITLEMENU,
'GUIDE' : DVDNAV_TITLEMENU, 'MENU' : DVDNAV_MENU,
def __cmp__(self, other): """ compare function, return 0 if the objects are identical, 1 otherwise """ if not other: return 1 if isinstance(other, Event): return self.name != other.name return self.name != other
additional_args += [ '-vobsubid', str(item.selected_subtitle) ]
if os.path.isfile(os.path.splitext(item.filename)[0]+'.idx'): additional_args += [ '-vobsubid', str(item.selected_subtitle) ] else: additional_args += [ '-sid', str(item.selected_subtitle) ]
def play(self, options, item): """ play a videoitem with mplayer """ self.options = options self.item = item mode = item.mode url = item.url
self._getbitmap(filename)
return self._getbitmap(filename)
def loadbitmap(self, filename): self._getbitmap(filename)
def zoombitmap(self, filename, scaling=None, bbx=0, bby=0, bbw=0, bbh=0, rotation = 0): if not pygame.display.get_init(): return None image = self._getbitmap(filename) if not image: return
def zoomsurface(self, image, scaling=None, bbx=0, bby=0, bbw=0, bbh=0, rotation = 0):
def loadbitmap(self, filename): self._getbitmap(filename)
def zoombitmap(self, filename, scaling=None, bbx=0, bby=0, bbw=0, bbh=0, rotation = 0): if not pygame.display.get_init(): return None image = self._getbitmap(filename) if not image: return return self.zoomimage(image, scaling, bbx, bby, bbw, bbh, rotation) def drawsurface(self, image, x=0, y=0, scaling=None, bbx=0, ...
def zoombitmap(self, filename, scaling=None, bbx=0, bby=0, bbw=0, bbh=0, rotation = 0): if not pygame.display.get_init(): return None
image = self.zoombitmap(filename, scaling, bbx, bby, bbw, bbh, rotation) if not image: return if layer: layer.blit(image, (x, y)) else: self.screen.blit(image, (x, y))
image = self._getbitmap(filename) self.drawsurface(image, x, y, scaling, bbx, bby, bbw, bbh, rotation, layer)
def drawbitmap(self, filename, x=0, y=0, scaling=None, bbx=0, bby=0, bbw=0, bbh=0, rotation = 0, layer=None): if not pygame.display.get_init(): return None image = self.zoombitmap(filename, scaling, bbx, bby, bbw, bbh, rotation) if not image: return if layer: layer.blit(image, (x, y)) else: self.screen.blit(image, (x, ...
return node.attrs[('', attr)]
return node.attrs[('', attr)].encode()
def attr_str(self, node, attr, default): if node.attrs.has_key(('', attr)): return node.attrs[('', attr)] return default
font = os.path.join(OSD_FONT_DIR, node.attrs[('', attr)] + '.TTF')
font = os.path.join(OSD_FONT_DIR, node.attrs[('', attr)] + '.TTF').encode()
def attr_font(self, node, attr, default): if node.attrs.has_key(('', attr)): fontext = os.path.splitext(node.attrs[('', attr)])[1] if fontext: # There is an extension (e.g. '.pfb'), use the full name font = os.path.join(OSD_FONT_DIR, node.attrs[('', attr)]).encode() else: # '.ttf' is the default extension font = os.pat...
self.child = childapp.ChildApp2(arg)
self.child = childapp.ChildApp2(arg, stop_osd=0)
def restart(self): """ Restart the display. This will restart the background video to make the canvas work. """ _debug_('restart bmovl2') if self.start_video and not self.child: import childapp arg = [config.MPLAYER_CMD] + self.mplayer_args.split(' ') + \ [config.OSD_BACKGROUND_VIDEO] self.child = childapp.ChildApp2(ar...
self.app.child.wait()
while self.mode == 'play' and self.app.isAlive(): time.sleep(0.5) print('Game_Thread::run: GAME OVER') self.app.kill()
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'play':
_debug_('no skin information for %s' % (self.area_name), )
_debug_('no skin information for %s' % (self.area_name), 0)
def __init_vars(self, settings, area): """ Check which layout is used and set variables for the object """ self.settings = settings
tray_open = 1
tray_open = 0
def getcmd(): items = [] items += [menu.MenuItem('TV', tv.main_menu, 'tv','icons/tv.png',0)] # XXX Move icons into skin items += [menu.MenuItem('MOVIES', movie.main_menu,'','icons/movies.png',0)] items += [menu.MenuItem('MUSIC', mp3.main_menu,'','icons/mp3.png',0)] items += [menu.MenuItem('DVD/CD', movie.play_movie, (...
tvcmd = ('tv://%s -tv on:driver=v4l:%s:%s:%s:'
tvcmd = ('tv://%s -tv driver=v4l:%s:%s:%s:'
def Play(self, mode, tuner_channel=None, channel_change=0):
self.to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
local_to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
def mover_to_series(self, arg=None, menuw=None): # make to_dir an absolute path if not os.path.isabs(self.to_dir): self.to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
if not os.path.exists(self.to_dir): if os.path.exists(os.path.dirname(self.to_dir)):
if not os.path.exists(local_to_dir): if os.path.exists(os.path.dirname(local_to_dir)):
def mover_to_series(self, arg=None, menuw=None): # make to_dir an absolute path if not os.path.isabs(self.to_dir): self.to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
os.makedirs(self.to_dir)
os.makedirs(local_to_dir)
def mover_to_series(self, arg=None, menuw=None): # make to_dir an absolute path if not os.path.isabs(self.to_dir): self.to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
elif not os.path.isdir(self.to_dir): _debug_("%s is not a dir" % self.to_dir)
elif not os.path.isdir(local_to_dir): _debug_("%s is not a dir" % local_to_dir)
def mover_to_series(self, arg=None, menuw=None): # make to_dir an absolute path if not os.path.isabs(self.to_dir): self.to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
os.system('mv "%s" "%s"' % (self.item.filename, self.to_dir))
os.system('mv "%s" "%s"' % (self.item.filename, local_to_dir))
def mover_to_series(self, arg=None, menuw=None): # make to_dir an absolute path if not os.path.isabs(self.to_dir): self.to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
os.system('mv "%s" "%s"' % (self.item.fxd_file, self.to_dir))
os.system('mv "%s" "%s"' % (self.item.fxd_file, local_to_dir))
def mover_to_series(self, arg=None, menuw=None): # make to_dir an absolute path if not os.path.isabs(self.to_dir): self.to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
os.system('mv "%s" "%s"' % (file, self.to_dir))
os.system('mv "%s" "%s"' % (file, local_to_dir))
def mover_to_series(self, arg=None, menuw=None): # make to_dir an absolute path if not os.path.isabs(self.to_dir): self.to_dir = os.path.join(os.path.dirname(self.item.filename), self.to_dir)
padding = 0
logo_w, logo_h = 0, 0
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
channel_logo_size = osd.bitmapsize(channel_logo) padding = channel_logo_size[0] osd.drawbitmap(util.resize(channel_logo, padding, padding), conf_x + val.spacing, y0 + val.spacing + \ (str_h - padding)/2)
logo_w, logo_h = osd.bitmapsize(channel_logo) scalefac = float(y1 - y0 - 2) / logo_h logo_w = int(logo_w * scalefac) logo_h = int(logo_h * scalefac) osd.drawbitmap(util.resize(channel_logo, logo_w, logo_h), conf_x + val.spacing, y0 + val.spacing + (str_h - logo_h)/2)
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
conf_x + val.spacing + padding, y0 + val.spacing, val.label.width - 2 * val.spacing - padding, str_h)
conf_x + val.spacing + logo_w, y0 + val.spacing, val.label.width - 2 * val.spacing - logo_h, str_h)
def DrawTVGuide_Listing(self, to_listing, settings): val = settings.listing
print 'recordserver.check_recordings: next in %s sec' % timer
print 'recordserver.check_recordings: next in %s sec' % secs
def check_recordings(self): """ Check the current recordings. This includes checking conflicts, removing old entries. At the end, the timer is set for the next recording. """ ctime = time.time() # remove informations older than one week self.recordings = filter(lambda r: r.start > ctime - 60*60*24*7, self.recordings) #...
print 'recordserver.record: next in %s sec' % timer
print 'recordserver.record: next in %s sec' % secs
def record(self): """ Record a program now using one of the record plugins """ # FIXME: handle not conflicting recordings when the padding # has a conflict! for r in self.recordings: if r.status == SCHEDULED: break else: print 'recordserver.record: unable to find the next recording' # This should never happen self.chec...
comment = re.sub("\x00+$", "", id3tag[97:127].strip())
comment = id3tag[97:127]
def __loadV1Tag(self, f): if isinstance(f, str): fp = file(f, "rb") closeFile = 1; else: fp = f; closeFile = 0;
print "seek "+str(self.seek)+" 2\n"
if DEBUG: print "seek "+str(self.seek)+" 2\n"
def eventhandler(self, event): """ eventhandler for mplayer control. If an event is not bound in this function it will be passed over to the items eventhandler """
print 'seek stopped'
if DEBUG: print 'seek stopped'
def eventhandler(self, event): """ eventhandler for mplayer control. If an event is not bound in this function it will be passed over to the items eventhandler """
print "Added bookmark at position " + str(self.item.elapsed)
def eventhandler(self, event): """ eventhandler for mplayer control. If an event is not bound in this function it will be passed over to the items eventhandler """
print 'seek timeout'
if DEBUG: print 'seek timeout'
def reset_seek(self): print 'seek timeout' self.seek = 0 rc.set_context('video')
print 'data parsing done'
def parse(self, line): if self.check_audio: if line.find('MPEG: No audio stream found -> no sound') == 0: # OK, audio is broken, restart without -alang self.check_audio = 2 self.item.mplayer_audio_broken = TRUE rc.post_event(Event('AUDIO_ERROR_START_AGAIN')) if self.RE_START(line): print 'data parsing done' if self.ch...
print "Stopping Display for Video Playback"
if DEBUG: print "Stopping Display for Video Playback"
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear()
os.system('/usr/sbin/matroxcolor')
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear()
print "Display back online"
if DEBUG: print "Display back online"
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear()
os.system('/usr/sbin/undomatroxcolor')
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear()
if font.stringsize(text) <= width:
if font.stringsize(text) <= width and text.find('\n') == -1:
def __init__(self, text, (x, y), (width, height), font, align_h='left', align_v='top', mode='hard', ellipses = '...', fgcolor=None, bgcolor=None):
for d in get_dummy_programs(start, stop):
for d in get_dummy_programs(self.info['id'], start, stop):
def import_programs(self, start, stop=-1): """ Get programs from the database to create ProgramItems from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ new_progs = [] dummy_progs = []
for d in get_dummy_programs(start, p.start):
for d in get_dummy_programs(self.info['id'], start, p.start):
def import_programs(self, start, stop=-1): """ Get programs from the database to create ProgramItems from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ new_progs = [] dummy_progs = []
for d in get_dummy_programs(p.stop, next_p.start):
for d in get_dummy_programs(self.info['id'], p.stop, next_p.start):
def import_programs(self, start, stop=-1): """ Get programs from the database to create ProgramItems from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ new_progs = [] dummy_progs = []
for d in get_dummy_programs(p.stop, stop):
for d in get_dummy_programs(self.info['id'], p.stop, stop):
def import_programs(self, start, stop=-1): """ Get programs from the database to create ProgramItems from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ new_progs = [] dummy_progs = []
def get_dummy_programs(self, start, stop): """ Return some default ProgramItems with intervals no longer than a set default. """ 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 ...
def import_programs(self, start, stop=-1): """ Get programs from the database to create ProgramItems from then add them to our local list. If there are gaps between the programs we will add dummy programs to fill it (TODO). """ new_progs = [] dummy_progs = []
for c in config.TV_CHANNELS: if not c[0] in self.channel_dict.keys(): self.add_channel(ChannelItem(id=c[0], call_sign=c[1], uri=c[2]))
def __init__(self): self.selected = 0 self.channel_list = [] self.channel_dict = {}
def getbyname(self, name, multiple_choises=0):
def getbyname(self, name, multiple_choises=False):
def getbyname(self, name, multiple_choises=0): """ Get a plugin by it's name """ if self.names.has_key(name): return self.names[name] if multiple_choises: return [] return None
def register(self, plugin, name, multiple_choises=0):
def register(self, plugin, name, multiple_choises=False):
def register(self, plugin, name, multiple_choises=0): """ Register an object as a named plugin """ if multiple_choises: if not self.names.has_key(name): self.names[name] = [] self.names[name].append(plugin) else: self.names[name] = plugin
def __init__( self, app, mplayer, size=None ):
def __init__( self, app, mplayer, size=None, rplugin=None ):
def __init__( self, app, mplayer, size=None ): self.osd = osd self.item = mplayer.item self.mplayer = mplayer self.lines = [] self.messages = [] childapp.ChildApp2.__init__( self, app ) self.change_resolution( size ) self.toggle_fs()
plugin.activate( 'audio.mpav', args=( ( <width>, <height> ), ) )
plugin.activate( 'audio.mpav', args=( ( <width>, <height> ), <render_plugin>) ) where: <width> and <height> are the MPAV window size (or resolution); <render_plugin> is the render plugin, it must be in your LD_LIBRARY_PATH or you need to give the full path. Usually it's libmpav_goom.so.
def change_resolution( self, size ): """ Change resolution """ self.size = size if isinstance( size, tuple ): self.write( "sr %d %d\n" % size )
def __init__( self, size=None ):
def __init__( self, size=None, rplugin=None ):
def __init__( self, size=None ): """ normal plugin init, but sets _type to 'mplayer_audio' """ plugin.Plugin.__init__( self ) self.mpav = None self.player = None self.size = size self._type = "mplayer_audio" self.osd_view = 0 self.messages = [] config.EVENTS['audio']['0'] = TOGGLE_OSD
self.mpav = None self.player = None self.size = size self._type = "mplayer_audio"
self.start = False self.mpav = None self.player = None self.size = size self.rplugin = rplugin self._type = "mplayer_audio"
def __init__( self, size=None ): """ normal plugin init, but sets _type to 'mplayer_audio' """ plugin.Plugin.__init__( self ) self.mpav = None self.player = None self.size = size self._type = "mplayer_audio" self.osd_view = 0 self.messages = [] config.EVENTS['audio']['0'] = TOGGLE_OSD
self.start_mpav()
self.start = True
def stdout( self, line ): """ get information from mplayer stdout """ if self.mpav: return
return
def stdout( self, line ): """ get information from mplayer stdout """ if self.mpav: return
self.mpav = MPAV( command, self.player, ( self.size ) )
self.mpav = MPAV( command, self.player, self.size, self.rplugin )
def start_mpav( self ): """ start mpav """ if not self.mpav: command = [ app, "-s", "-f", mmap_file ] self.mpav = MPAV( command, self.player, ( self.size ) ) if self.osd_view == 1: self.show_info_mpav()
if self.filename == '0' and self.mode == 'dvd' and \ plugin.getbyname(plugin.DVD_PLAYER):
if (not self.filename or self.filename == '0') and \ self.mode == 'dvd' and plugin.getbyname(plugin.DVD_PLAYER):
def play(self, arg=None, menuw=None): """ play the item. """ self.parent.current_item = self if not self.menuw: self.menuw = menuw
x_contents = content.x + label_width + content.spacing w_contents = content.width - label_width - content.spacing for i in range(n_cols): x0 = int(x_contents + (float(w_contents) / n_cols) * i) x1 = int(x_contents + (float(w_contents) / n_cols) * (i+1)) ty0 = content.y ig = Geometry(0, 0, x1-x0+1, head_h)
x_contents = content.x + content.spacing y_contents = content.y + content.spacing w_contents = content.width - 2 * content.spacing h_contents = content.height - 2 * content.spacing dateformat = config.TV_DATEFORMAT if not dateformat: dateformat = '%e-%b' r = Geometry( 0, 0, label_width, font_h ) if label_val.recta...
def update_content(self): """ update the listing area """
ig, r = self.fit_item_in_rectangle(head_val.rectangle, x1-x0+1, head_h) self.drawroundbox(x0+r.x, ty0+r.y, r.width, r.height, r) self.write_text(time.strftime("%H:%M",time.localtime(to_listing[0][i+1])), head_font, content, x=x0+ig.x, y=ty0+ig.y, width=ig.width, height=-1, align_v='center', align_h = head_val.align)
ig, r = self.fit_item_in_rectangle( head_val.rectangle, col_size, head_h ) self.drawroundbox( math.floor(x0), ty0, math.floor( col_size + x0 ) - math.floor( x0 ) + 1, head_h + 1, r ) self.write_text( time.strftime( "%H:%M", time.localtime( to_listing[ 0 ][ i + 1 ] ) ), head_font, content, x=( x0 + ig.x ), y=( ty0 + i...
def update_content(self): """ update the listing area """
prop_1sec = float(w_contents) / float(n_cols * col_time * 60)
def update_content(self): """ update the listing area """
r = self.get_item_rectangle(label_val.rectangle, label_txt_width, font_h)[2]
r = self.get_item_rectangle(label_val.rectangle, label_width, font_h)[2]
def update_content(self): """ update the listing area """
self.drawroundbox(tx0 + r.x, ty0 + r.y, r.width, r.height, r)
self.drawroundbox(tx0 + r.x, ty0 + r.y, r.width+1, r.height, r)
def update_content(self): """ update the listing area """
x=tx0, y=ty0, width=label_width, height=font_h)
x=tx0, y=ty0, width=r.width+2*r.x, height=font_h)
def update_content(self): """ update the listing area """
</playlist>
</slideshow>
def fxdhandler(self, fxd, node): """ parse image specific stuff from fxd files
mmpython.cache_dir(os.path.dirname(filename))
def make_query(filename,dirtitle): md5 = 'null' if not os.path.exists(filename): print "File %s does not exist" % (filename) return None a = mmpython.parse(filename) md5 = util.md5file(filename) # This is ugly, how do I clean it up? trackno = -1 trackof = -1 if a['trackno']: trackno = inti(a['trackno'].split('/')...
if sys.argv[1]:
if len(sys.argv) > 1:
def mainloop(path='/media/Music',dirtitle='',type='*.mp3'): db = sqlite.connect(DATABASE,autocommit=0) cursor = db.cursor() songs = util.recursefolders(path,1,type,1) tempvar = '' for song in songs: cursor.execute(make_query(song,dirtitle)) # Only call commit after we're done to save time... (autocommit slows down t...
if DEBUG: print 'drawstringframedhard (%d;%d; w=%d; h=%d) "%s"' % (x, y, w, h, s)
if DEBUG: print 'drawstringframedhard (%d;%d; w=%d; h=%d) "%s"' % (x, y, width, height, string)
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top'):
if occupied_size + char_size <= width and string[i] != '\n':
if ((occupied_size + char_size) <= width) and (string[i] != '\n'):
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top'):
if occupied_height + char_height <= height:
if (occupied_height + char_height) <= height:
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top'):
if string[i] != '\n':
if string[i] == '\n': occupied_size = 0 else:
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top'):
if occupied_size + tmp_size <= width: break
if (occupied_size + tmp_size) <= width: break
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top'):
if (self.current_item.type == 'audio'):
if self.current_item and self.current_item.type == 'audio':
def eventhandler(self, event, menuw=None): """ Handle playlist specific events """
event.arg and hasattr(self.current_item,'type'):
event.arg and self.current_item and hasattr(self.current_item,'type'):
def eventhandler(self, event, menuw=None): """ Handle playlist specific events """
timestamp = os.stat(self.dir)[stat.ST_MTIME]
try: timestamp = os.stat(self.dir)[stat.ST_MTIME] except OSError: return
def create_metainfo(self): """ create some metainfo for the directory """ display_type = self.display_type
elif not os.path.exists(self.dir): AlertBox(text=_('Directory does not exist')).show() return
def build(self, arg=None, menuw=None): """ build the items for the directory """ self.playlist = [] self.play_items = [] self.dir_items = [] self.pl_items = []
cachefile = open(self.WEATHERCACHE,'r') newlist = map(string.rstrip, cachefile.readlines()) temperature,icon = newlist cachefile.close()
try: cachefile = open(self.WEATHERCACHE,'r') newlist = map(string.rstrip, cachefile.readlines()) temperature,icon = newlist cachefile.close() except IOError: print 'WEATHER: error reading cache. Using fake weather.' return '0', 'sun.png'
def checkweather(self): # We don't want to do this every 30 seconds, so we need # to cache the date somewhere. # # First check the age of the cache. # if (os.path.isfile(self.WEATHERCACHE) == 0 or \ (abs(time.time() - os.path.getmtime(self.WEATHERCACHE)) > 3600)): weather = pymetar.MetarReport() try: weather.fetchMetar...
self.image = image[0] self.type = image[1]
self.type = image[0] self.image = image[1]
def setImage(self, image): self.image = image[0] self.type = image[1]
def __init__(self, items=[], left=None, top=None, width=None, height=None,
def __init__(self, items=None, left=None, top=None, width=None, height=None,
def __init__(self, items=[], left=None, top=None, width=None, height=None, bg_color=None, fg_color=None, selected_bg_color=None, selected_fg_color=None, border=None, bd_color=None, bd_width=None, show_h_scrollbar=None, show_v_scrollbar=None):
self.set_items(items)
if self.items: self.set_items(self.items)
def __init__(self, items=[], left=None, top=None, width=None, height=None, bg_color=None, fg_color=None, selected_bg_color=None, selected_fg_color=None, border=None, bd_color=None, bd_width=None, show_h_scrollbar=None, show_v_scrollbar=None):
return ''
return 0
def getattr(self, attr): """ return the specific attribute as string or an empty string """ if attr == 'length': try: length = int(self.info['length']) except ValueError: return self.info['length'] except: try: length = int(self.length) except: return '' if length / 3600: return '%d:%02d:%02d' % ( length / 3600, (lengt...
return ''
pass
def getattr(self, attr): """ return the specific attribute as string or an empty string """ if attr == 'length': try: length = int(self.info['length']) except ValueError: return self.info['length'] except: try: length = int(self.length) except: return '' if length / 3600: return '%d:%02d:%02d' % ( length / 3600, (lengt...