rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def getProgFilename(prog=None): if not prog: return 'ERROR: no prog' mask = config.TV_RECORDFILE_MASK
def getProgFilename(prog):
def getProgFilename(prog=None): if not prog: return 'ERROR: no prog' mask = config.TV_RECORDFILE_MASK # '%%m-%%d %%H:%%M %(progname)s - %(title)s' filename_array = { 'progname': String(prog.title), 'title' : String(prog.sub_title) } filemask = mask % filename_array filemask = time.strftime(filemask, time.localtim...
filemask = mask % filename_array
filemask = config.TV_RECORDFILE_MASK % filename_array
def getProgFilename(prog=None): if not prog: return 'ERROR: no prog' mask = config.TV_RECORDFILE_MASK # '%%m-%%d %%H:%%M %(progname)s - %(title)s' filename_array = { 'progname': String(prog.title), 'title' : String(prog.sub_title) } filemask = mask % filename_array filemask = time.strftime(filemask, time.localtim...
filename = progname2filename(filemask)
filename = os.path.join(config.TV_RECORD_DIR, progname2filename(filemask) + config.TV_RECORDFILE_SUFFIX)
def getProgFilename(prog=None): if not prog: return 'ERROR: no prog' mask = config.TV_RECORDFILE_MASK # '%%m-%%d %%H:%%M %(progname)s - %(title)s' filename_array = { 'progname': String(prog.title), 'title' : String(prog.sub_title) } filemask = mask % filename_array filemask = time.strftime(filemask, time.localtim...
pos = max(0, min(self.selected_pos-1, len(self.choices)-1)) self.select(self.choices[pos])
if self.choices: pos = max(0, min(self.selected_pos-1, len(self.choices)-1)) self.select(self.choices[pos]) else: self.select(None)
def set_items(self, items, refresh=True): """ Set/replace the items in this menu. If refresh is True, the menu stack will be refreshed and redrawn. """ # delete ref to menu for old choices for c in self.choices: c.menu = None
print line
def str2XML(self, line): """return a valid XML string""" print line try: s = unicode(line, 'latin-1') while s[-1] == ' ': s = s[:-1] if s[:4] == '&#34': s = s[5:] if s[-4:] == '#34;': s = s[:-5] # replace all & to & ... s = s.replace("&", "&")
print s
def str2XML(self, line): """return a valid XML string""" print line try: s = unicode(line, 'latin-1') while s[-1] == ' ': s = s[:-1] if s[:4] == '&#34': s = s[5:] if s[-4:] == '#34;': s = s[:-5] # replace all & to & ... s = s.replace("&", "&")
if not self.item.xml_file: box = AlertBox(text=_('There is no IMDB information for this file.')) box.show() return info = self.item box = AlertBox(icon=info.image, width=550, height=400, text=_('%s\n \n \n %s\n \n \n----\n Year: %s\n Genre: %s\n Rating: %s\n Runtime: %s') % (info.name,info.info['plot'],info.info['ye...
text='%s\n \n \n %s\n \n \n----\n' % (self.item.name, self.item.getattr('plot')) text += _(' Year: %s\n Genre: %s\n Rating: %s\n Runtime: %s') % \ (self.item.getattr('year'), self.item.getattr('genre'), self.item.getattr('rating'),self.item.getattr('length')) AlertBox(icon=self.item.image, width=550, height=400, text...
def info_showdata(self, arg=None, menuw=None): """ show info for this item """ if not self.item.xml_file: box = AlertBox(text=_('There is no IMDB information for this file.')) box.show() return
print item.url
def parse_video_child(fxd, node, dirname): """ parse a subitem from <video> """ filename = fxd.gettext(node) media_id = fxd.getattr(node, 'media-id') mode = node.name id = fxd.getattr(node, 'id') options = fxd.getattr(node, 'mplayer-options') player = fxd.childcontent(node, 'player') playlist ...
for rp in rec_progs: if p.channel.id == rp.channel and rp.start == p.start: if rp.status == u'recording': status = 'recording' elif rp.status == u'conflict': status = 'basic' elif rp.status == u'saved': status = 'basic' elif rp.status != u'deleted': status = 'scheduled'
def render(self, request): fv = HTMLResource() form = request.query by_chan = None
cell = ('<a href="recordings?chan=%s&start=%s&action=add">'+
cell = ('<a href="recordings?chan=%s&start=%s&action=remove">'+
def render(self, request): fv = HTMLResource() form = request.query by_chan = None
args += (' ' + config.MPLAYER_ARGS['tv'])
args += (config.MPLAYER_ARGS['tv'],)
def Play(self, mode, tuner_channel=None, channel_change=0):
if DEBUG: log.debug('GET: reading cached file (%s)' % config.TV_RECORD_SCHEDULE)
_debug_('GET: reading cached file (%s)' % config.TV_RECORD_SCHEDULE)
def getScheduledRecordings(self): file_ver = None scheduledRecordings = None
log.debug('The cache does not have a version and must be recreated.')
_debug_('The cache does not have a version and must be recreated.')
def getScheduledRecordings(self): file_ver = None scheduledRecordings = None
log.debug(('ScheduledRecordings version number %s is stale (new is %s), must ' +
_debug_(('ScheduledRecordings version number %s is stale (new is %s), must ' +
def getScheduledRecordings(self): file_ver = None scheduledRecordings = None
if DEBUG: log.debug('Got ScheduledRecordings (version %s).' % file_ver)
_debug_('Got ScheduledRecordings (version %s).' % file_ver)
def getScheduledRecordings(self): file_ver = None scheduledRecordings = None
if DEBUG: log.debug('GET: making a new ScheduledRecordings')
_debug_('GET: making a new ScheduledRecordings')
def getScheduledRecordings(self): file_ver = None scheduledRecordings = None
if DEBUG: log.debug('ScheduledRecordings has %s items.' % \ len(scheduledRecordings.programList))
_debug_('ScheduledRecordings has %s items.' % \ len(scheduledRecordings.programList))
def getScheduledRecordings(self): file_ver = None scheduledRecordings = None
if DEBUG: print 'SAVE: making a new ScheduledRecordings'
_debug_('SAVE: making a new ScheduledRecordings')
def saveScheduledRecordings(self, scheduledRecordings=None): if not scheduledRecordings: if DEBUG: print 'SAVE: making a new ScheduledRecordings' scheduledRecordings = ScheduledRecordings() if DEBUG: log.debug('SAVE: saving cached file (%s)' % config.TV_RECORD_SCHEDULE) if DEBUG: log.debug("SAVE: ScheduledRecordings ...
if DEBUG: log.debug('SAVE: saving cached file (%s)' % config.TV_RECORD_SCHEDULE) if DEBUG: log.debug("SAVE: ScheduledRecordings has %s items." % \ len(scheduledRecordings.programList))
_debug_('SAVE: saving cached file (%s)' % config.TV_RECORD_SCHEDULE) _debug_("SAVE: ScheduledRecordings has %s items." % \ len(scheduledRecordings.programList))
def saveScheduledRecordings(self, scheduledRecordings=None): if not scheduledRecordings: if DEBUG: print 'SAVE: making a new ScheduledRecordings' scheduledRecordings = ScheduledRecordings() if DEBUG: log.debug('SAVE: saving cached file (%s)' % config.TV_RECORD_SCHEDULE) if DEBUG: log.debug("SAVE: ScheduledRecordings ...
if DEBUG: log.debug('scheduleRecording: prog.channel_id="%s" chan.id="%s" chan.tunerid="%s"' % (prog.channel_id, chan.id, chan.tunerid))
_debug_('scheduleRecording: prog.channel_id="%s" chan.id="%s" chan.tunerid="%s"' % (prog.channel_id, chan.id, chan.tunerid))
def scheduleRecording(self, prog=None): global guide
if DEBUG: log.debug('findProg: %s, %s' % (chan, start))
_debug_('findProg: %s, %s' % (chan, start))
def findProg(self, chan=None, start=None): global guide
if DEBUG: log.debug('CHANNEL MATCH')
_debug_('CHANNEL MATCH')
def findProg(self, chan=None, start=None): global guide
if DEBUG: log.debug('PROGRAM MATCH')
_debug_('PROGRAM MATCH')
def findProg(self, chan=None, start=None): global guide
if DEBUG: log.debug('findMatches: %s' % find)
_debug_('findMatches: %s' % find)
def findMatches(self, find=None, movies_only=None): global guide
if DEBUG: log.debug('nothing to find')
_debug_('nothing to find')
def findMatches(self, find=None, movies_only=None): global guide
if DEBUG: log.debug('PROGRAM MATCH: %s' % prog.decode())
_debug_('PROGRAM MATCH: %s' % prog.decode())
def findMatches(self, find=None, movies_only=None): global guide
if DEBUG: log.debug('return: %s' % str(matches))
_debug_('return: %s' % str(matches))
def findMatches(self, find=None, movies_only=None): global guide
if DEBUG: log.debug('in checkToRecord')
_debug_('in checkToRecord')
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None delay_recording = FALSE total_padding = 0
if DEBUG: log.debug('checkToRecord: progloop = %s' % prog)
_debug_('checkToRecord: progloop = %s' % String(prog))
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None delay_recording = FALSE total_padding = 0
log.debug('CALLED RECORD STOP 1')
_debug_('CALLED RECORD STOP 1')
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None delay_recording = FALSE total_padding = 0
log.debug('CALLED RECORD STOP 2')
_debug_('CALLED RECORD STOP 2')
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None delay_recording = FALSE total_padding = 0
if DEBUG: log.debug('delaying: %s' % prog)
_debug_('delaying: %s' % prog)
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None delay_recording = FALSE total_padding = 0
if DEBUG: log.debug('going to record: %s' % prog)
_debug_('going to record: %s' % prog)
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None delay_recording = FALSE total_padding = 0
if DEBUG: log.debug('found a program to clean')
_debug_('found a program to clean')
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None delay_recording = FALSE total_padding = 0
if DEBUG: log.debug('ap: mod=%s\n' % mod)
_debug_('ap: mod=%s\n' % mod)
def adjustPriority(self, favname, mod=0): save = [] mod = int(mod) (status, me) = getFavorite(favname) oldprio = int(me.priority) newprio = oldprio + mod if DEBUG: log.debug('ap: mod=%s\n' % mod) sr = self.getScheduledRecordings() favs = sr.getFavorites().values() sys.stderr.write('adjusting prio of '+favname+'\n') ...
if DEBUG: log.debug('MATCH')
_debug_('MATCH')
def adjustPriority(self, favname, mod=0): save = [] mod = int(mod) (status, me) = getFavorite(favname) oldprio = int(me.priority) newprio = oldprio + mod if DEBUG: log.debug('ap: mod=%s\n' % mod) sr = self.getScheduledRecordings() favs = sr.getFavorites().values() sys.stderr.write('adjusting prio of '+favname+'\n') ...
log.debug('moved prio of %s: %s => %s\n' % (fav.name, oldprio, newprio))
_debug_('moved prio of %s: %s => %s\n' % (fav.name, oldprio, newprio))
def adjustPriority(self, favname, mod=0): save = [] mod = int(mod) (status, me) = getFavorite(favname) oldprio = int(me.priority) newprio = oldprio + mod if DEBUG: log.debug('ap: mod=%s\n' % mod) sr = self.getScheduledRecordings() favs = sr.getFavorites().values() sys.stderr.write('adjusting prio of '+favname+'\n') ...
if DEBUG: log.debug('fp: %s, old: %s, new: %s\n' % (fav.priority, oldprio, newprio)) log.debug('skipping: %s\n' % fav.name)
_debug_('fp: %s, old: %s, new: %s\n' % (fav.priority, oldprio, newprio)) _debug_('skipping: %s\n' % fav.name)
def adjustPriority(self, favname, mod=0): save = [] mod = int(mod) (status, me) = getFavorite(favname) oldprio = int(me.priority) newprio = oldprio + mod if DEBUG: log.debug('ap: mod=%s\n' % mod) sr = self.getScheduledRecordings() favs = sr.getFavorites().values() sys.stderr.write('adjusting prio of '+favname+'\n') ...
if DEBUG: log.debug('moved prio of %s: %s => %s\n' % (fav.name, fav.priority-1, fav.priority))
_debug_('moved prio of %s: %s => %s\n' % (fav.name, fav.priority-1, fav.priority))
def adjustPriority(self, favname, mod=0): save = [] mod = int(mod) (status, me) = getFavorite(favname) oldprio = int(me.priority) newprio = oldprio + mod if DEBUG: log.debug('ap: mod=%s\n' % mod) sr = self.getScheduledRecordings() favs = sr.getFavorites().values() sys.stderr.write('adjusting prio of '+favname+'\n') ...
if DEBUG: log.debug('skipping: %s\n' % fav.name)
_debug_('skipping: %s\n' % fav.name)
def adjustPriority(self, favname, mod=0): save = [] mod = int(mod) (status, me) = getFavorite(favname) oldprio = int(me.priority) newprio = oldprio + mod if DEBUG: log.debug('ap: mod=%s\n' % mod) sr = self.getScheduledRecordings() favs = sr.getFavorites().values() sys.stderr.write('adjusting prio of '+favname+'\n') ...
if DEBUG: log.debug('moved prio of %s: %s => %s\n' % (fav.name, fav.priority+1, fav.priority))
_debug_('moved prio of %s: %s => %s\n' % (fav.name, fav.priority+1, fav.priority))
def adjustPriority(self, favname, mod=0): save = [] mod = int(mod) (status, me) = getFavorite(favname) oldprio = int(me.priority) newprio = oldprio + mod if DEBUG: log.debug('ap: mod=%s\n' % mod) sr = self.getScheduledRecordings() favs = sr.getFavorites().values() sys.stderr.write('adjusting prio of '+favname+'\n') ...
if DEBUG: log.debug('top of the minute in %s seconds' % next_minute)
_debug_('top of the minute in %s seconds' % next_minute)
def startMinuteCheck(self): next_minute = (int(time.time()/60) * 60 + 60) - int(time.time()) if DEBUG: log.debug('top of the minute in %s seconds' % next_minute) reactor.callLater(next_minute, self.minuteCheck)
sys.__stdout__.write(msg)
global DEBUG_STDOUT if DEBUG_STDOUT: sys.__stdout__.write(msg)
def write(self, msg): sys.__stdout__.write(msg) self.fp.write(msg) self.fp.flush()
if DEBUG: print 'In config.py. sys.argv[] = %s' % sys.argv
def close(): pass
if not os.path.isfile(SCHEDULE): log('no schedule, exiting') fd = open(SCHEDULE, 'w') fd.write(' fd.write(time.strftime('%Y-%m-%d %H:%M:%S')) fd.write('\n') fd.close() sys.exit()
schedule_init()
def main(): log('=' * 80) log('started at %s' % time.ctime()) # Is the schedule file present? if not os.path.isfile(SCHEDULE): log('no schedule, exiting') fd = open(SCHEDULE, 'w') fd.write('#TIMESTAMP ') fd.write(time.strftime('%Y-%m-%d %H:%M:%S')) fd.write('\n') fd.close() sys.exit() fd = open(SCHEDULE, 'r') schedul...
if event in (em.PLAY_END, em.USER_END, em.STOP) and em.context != 'menu':
if event in (em.PLAY_END, em.USER_END, em.STOP) and event.context != 'menu':
def eventhandler(self, event = None, menuw=None): """ eventhandler for the main menu. The menu must be regenerated when a disc in a rom drive changes """ if plugin.isevent(event): if not menuw: menuw = self.menuw
self.drawroundbox(x0 + r.x, content.y + r.y, r.width, r.height, r)
if r.x < 0: x0 -= r.x if r.y < 0: ty0 -= r.y self.drawroundbox(x0 + r.x, ty0 + r.y, r.width, r.height, r)
def update_content(self): """ update the listing area """
head_font, content, x=x0, y=content.y, width=x1-x0, height=-1)
head_font, content, x=x0, y=ty0, width=x1-x0, height=-1)
def update_content(self): """ update the listing area """
self.drawroundbox(content.x + r.x, y0 + r.y, r.width, r.height, r)
if r.x < 0: tx0 -= r.x if r.y < 0: ty0 -= r.y self.drawroundbox(tx0 + r.x, ty0 + r.y, r.width, r.height, r)
def update_content(self): """ update the listing area """
y=y0, width=label_width, height=-1)
x=tx0, y=ty0, width=label_width, height=font_h)
def update_content(self): """ update the listing area """
self.drawroundbox(tx0 + r.x, y0 + r.y, r.width, r.height, r)
if r.x < 0: tx0 -= r.x if r.y < 0: ty0 -= r.y self.drawroundbox(tx0+r.x, ty0+r.y, r.width, r.height, r)
def update_content(self): """ update the listing area """
y=y0, width=tx1-tx0, height=font_h, align_v='center', align_h = val.align)
y=ty0, width=tx1-tx0, height=font_h, align_v='center', align_h = val.align)
def update_content(self): """ update the listing area """
self.thread.play_mode = self.mode
def play(self, mode, file, playlist, repeat=0, start_time = 0):
osd.update()
def kill(self): # Use SIGINT instead of SIGKILL to make sure MPlayer shuts # down properly and releases all resources before it gets # reaped by childapp.kill().wait() childapp.ChildApp.kill(self, signal.SIGINT)
if osd.sdl_driver == 'dxr3':
if (osd.sdl_driver == 'dxr3' and self.play_mode == 'video'): if DEBUG: print "Stopping Display for Video Playback on DXR3"
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear()
elif self.mode == 'play':
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear()
if osd.sdl_driver == 'dxr3':
if osd.sdl_driver == 'dxr3' and self.play_mode == 'video':
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear()
self.app.kill()
osd.update() print "Display back online"
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear()
item_x0 = content.x item_y0 = content.y
if content.align == 'center': item_x0 = content.x + (content.width - cols * hspace) / 2 else: item_x0 = content.x if content.valign == 'center': item_y0 = content.y + (content.height - rows * vspace) / 2 else: item_y0 = content.y
def update_content(self): """ update the listing area """
if content.align == 'center': x0 = item_x0 + (hspace - val.width) / 2 else: x0 = item_x0 if content.valign == 'center': y0 = item_y0 + (vspace - val.height) / 2 else: y0 = item_y0
def update_content(self): """ update the listing area """
rec_h = val.height if content.type == 'image+text': rec_h += int(val.font.h * 1.1)
def update_content(self): """ update the listing area """
self.drawroundbox(x0 + hskip + r.x, y0 + vskip + r.y, r.width, r.height, r)
self.drawroundbox(x0 + r.x, y0 + r.y, r.width, r.height, r)
def update_content(self): """ update the listing area """
if content.align == 'center' and i_w < val.width:
if val.align == 'center' and i_w < val.width:
def update_content(self): """ update the listing area """
if content.align == 'right' and i_w < val.width:
if val.align == 'right' and i_w < val.width:
def update_content(self): """ update the listing area """
if content.valign == 'center' and i_h < val.height:
if val.valign == 'center' and i_h < val.height:
def update_content(self): """ update the listing area """
if content.valign == 'bottom' and i_h < val.height:
if val.valign == 'bottom' and i_h < val.height:
def update_content(self): """ update the listing area """
self.draw_image(image, (x0 + hskip + addx, y0 + vskip + addy))
self.draw_image(image, (x0 + addx, y0 + addy))
def update_content(self): """ update the listing area """
self.write_text(choice.name, val.font, content, x=x0 + hskip, y=y0 + vskip + val.height, width=val.width, height=-1,
self.write_text(choice.name, val.font, content, x=x0, y=y0 + val.height, width=val.width, height=-1,
def update_content(self): """ update the listing area """
item_x0 = content.x
if content.align == 'center': item_x0 = content.x + (content.width - cols * hspace) / 2 else: item_x0 = content.x
def update_content(self): """ update the listing area """
if menuw.menu_items[0] != menu.choices[0] and area.images['uparrow']: self.draw_image(area.images['uparrow'].filename, area.images['uparrow']) if menuw.menu_items[-1] != menu.choices[-1] and area.images['downarrow']: self.draw_image(area.images['downarrow'].filename, area.images['downarrow'])
try: if menuw.menu_items[0] != menu.choices[0] and area.images['uparrow']: self.draw_image(area.images['uparrow'].filename, area.images['uparrow']) if menuw.menu_items[-1] != menu.choices[-1] and area.images['downarrow']: self.draw_image(area.images['downarrow'].filename, area.images['downarrow']) except IndexError: p...
def update_content(self): """ update the listing area """
MenuApplication.show(self)
_debug_('show')
def show(self): """ show the guide """ MenuApplication.show(self) self.update_schedules(force=True) self.refresh() self.engine.show(config.OSD_FADE_STEPS)
self.engine.show(config.OSD_FADE_STEPS)
MenuApplication.show(self)
def show(self): """ show the guide """ MenuApplication.show(self) self.update_schedules(force=True) self.refresh() self.engine.show(config.OSD_FADE_STEPS)
self.engine.hide(config.OSD_FADE_STEPS)
def hide(self): """ hide the guide """ MenuApplication.hide(self) # self.engine.clear() self.engine.hide(config.OSD_FADE_STEPS)
def destroy(self): """ destroy the guide """ MenuApplication.destroy(self)
def hide(self): """ hide the guide """ MenuApplication.hide(self) # self.engine.clear() self.engine.hide(config.OSD_FADE_STEPS)
elif event == MENU_SUBMENU: pass
elif event == TV_SHOW_CHANNEL: _debug_('show channel') items = [] for prog in self.channel.epg.get(time.time(), time.time() + 10*24*60*60)[:-1]: items.append(ProgrammItem(self.parent, prog)) cmenu = menu.Menu(self.channel.name, items) self.menuw.pushmenu(cmenu)
def eventhandler(self, event): if MenuApplication.eventhandler(self, event): return True
skin.PopupBox('%s\nnot found!' % filename)
skin.PopupBox('%s\nnot found!' % os.path.basename(filename))
def play(self, mode, file, playlist, repeat=0):
elif os.path.ismount(os.path.dirname(file)): return " <file id=\"p%s\" media-id=\"%s\">%s</file>\n" % \ (part, getCDID(drive), str2XML(os.path.basename(file)))
def print_video(file, part): if file[:3]== 'dvd': return " <dvd id=\"p%s\" media-id=\"%s\">%s</dvd>\n" % \ (part, getCDID(drive), file[3:]) elif file[:3] == 'vcd': return " <vcd id=\"p%s\" media-id=\"%s\">%s</vcd>\n" % \ (part, getCDID(drive), file[3:]) elif os.path.ismount(os.path.dirname(file)): ret...
items = [ items[1], items[0], item[2] ]
items = [ items[1], items[0], items[2] ]
def actions(self): """ return a list of actions for this item """ if config.CONFIRM_SHUTDOWN: items = [ (self.confirm_freevo, _('Shutdown Freevo') ), (self.confirm_system, _('Shutdown system') ), (self.confirm_system_restart, _('Restart system') ) ] else: items = [ (self.shutdown_freevo, _('Shutdown Freevo') ), (self.s...
if next_word_size > (width - tmp_size): for j in range(next_word_size / (width-tmp_size)): pieces.append(tmp_pieces[i][(j-1)*(width-tmp_size):j*(width-tmp_size)])
if next_word_size > cache_wt: cache_rg = range(next_word_size / cache_wt) for j in cache_rg: cache_jwt = ( j - 1 ) * cache_wt pieces.append( tmp_pieces[i][ cache_jwt : cache_jwt + cache_wt ] )
def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
if (next_word_size + tmp_occupied_size) < (width - tmp_size) and occupied_height <= height:
if (next_word_size + tmp_occupied_size) < cache_wt:
def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
lines_size[line_number] += tmp_size + MINIMUM_SPACE_BETWEEN_WORDS lines.append([])
lines_size[line_number] += tmp_size lines.append( [] )
def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
else: line_number += 1 lines.append([]) lines[line_number].append(words[word_number]) lines_size.append(word_size) occupied_size = word_size + MINIMUM_SPACE_BETWEEN_WORDS occupied_height += line_height
def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
if len(lines[line_number]) > 1:
if len(lines[line_number]) > 1 and line_number + 1 < len( lines ):
def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
spacing = MINIMUM_SPACE_BETWEEN_WORDS
def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
for word_number in range(len(lines[line_number])):
rg_line = range( line_len ) for word_number in rg_line:
def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
x0 -= spacing x0 -= word_size
x0 -= spacing - word_size
def drawstringframedsoft(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
adj_secs = int(tz[1:3])*3600+ int(tz[3:5])*60
try: min = int(tz[3:5]) except ValueError: min = 0 adj_secs = int(tz[1:3])*3600+ min*60
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 # Is it the '+1' format? if tz[0] == '+' or tz[0] == '-': tmTuple = ( int(tval[0:4]), int(tval[4:6]), int(tval[6:8]), int(tval[8:10]), int(tva...
if pos or REPEAT_PLAYLIST:
if pos or self.repeat == REPEAT_PLAYLIST:
def play(self, next=False): """ play the playlist """ if not self.playlist: log.warning('empty playlist') return False
if pos or REPEAT_PLAYLIST:
if pos or self.repeat == REPEAT_PLAYLIST:
def eventhandler(self, event, menuw=None): """ Handle playlist specific events """ if event == PLAY_START and event.arg in self.playlist: # a new item started playing, set internal current one self.__current = event.arg pos = self.playlist.index(self.__current) pos = (pos+1) % len(self.playlist) if pos or REPEAT_PLAYLI...
if os.path.isfile(fullname): self.current_objects[filename] = (info, os.stat(fullname)[stat.ST_MTIME]) else: self.current_objects[filename] = (info, 0)
self.current_objects[filename] = (info, os.stat(fullname)[stat.ST_MTIME]) print 'set: %s' % filename print self.current_cachefile
def set(self, filename, dirname, fullname, info): """ set a variable """ if dirname != self.current_cachedir: self.load_cache(dirname) if os.path.isfile(fullname): self.current_objects[filename] = (info, os.stat(fullname)[stat.ST_MTIME]) else: self.current_objects[filename] = (info, 0) self.cache_modified = True
print 'OVERLAY_DIR not set, virtual filesystem won\'t work'
_debug_('OVERLAY_DIR not set, virtual filesystem won\'t work',1)
def normalize(name): """ remove OVERLAY_DIR if it's in the path """ if isoverlay(name): name = name[len(config.OVERLAY_DIR):] if name.startswith('disc-set'): # revert it, disc-sets have no real dir return os.path.join(config.OVERLAY_DIR, name) if name.startswith('disc'): name = name[5:] id = name[:name.find('/')] name ...
print 'Virtual filesystem activated'
_debug_('Virtual filesystem activated',1)
def normalize(name): """ remove OVERLAY_DIR if it's in the path """ if isoverlay(name): name = name[len(config.OVERLAY_DIR):] if name.startswith('disc-set'): # revert it, disc-sets have no real dir return os.path.join(config.OVERLAY_DIR, name) if name.startswith('disc'): name = name[5:] id = name[:name.find('/')] name ...
def comingup(items):
def comingup(items=None):
def comingup(items): import tv.record_client as ri import time result = '' cachefile = '%s/upsoon' % (config.FREEVO_CACHEDIR) if (os.path.exists(cachefile) and \ (abs(time.time() - os.path.getmtime(cachefile)) < 3600)): cache = open(cachefile,'r') for a in cache.readlines(): result = result + a cache.close() return r...
_debug_('MEDIA: Status=%s' % media.drive_status)
_debug_('MEDIA: Status=%s' % media.drive_status, 2)
def check_all(self): self.lock.acquire() for media in config.REMOVABLE_MEDIA: last_status = media.drive_status self.identify(media)
def play(self, menuw=None):
def play(self, arg=None, menuw=None):
def play(self, menuw=None): self.parent.current_item = self
log.info('>> %s' % line)
log.warning('>> %s' % line)
def stdout_cb(self, line): line.strip(' \t\n') if line: log.info('>> %s' % line)
log.info('>> %s' % line)
log.warning('>> %s' % line)
def stderr_cb(self, line): line.strip(' \t\n') if line: log.info('>> %s' % line)
def snapshot(videofile, imagefile=None, pos=None, update=True): """ make a snapshot of the videofile at position pos to imagefile """ global _runqueue if not imagefile: imagefile = os.path.splitext(videofile)[0] + '.jpg' if not update and os.path.isfile(imagefile) and \ os.stat(videofile)[ST_MTIME] <= os.stat(imagefil...
def snapshot(videofile, imagefile=None, pos=None, update=True): """ make a snapshot of the videofile at position pos to imagefile """ global _runqueue if not imagefile: imagefile = os.path.splitext(videofile)[0] + '.jpg' if not update and os.path.isfile(imagefile) and \ os.stat(videofile)[ST_MTIME] <= os.stat(imagefil...
def finished(self): global _runqueue _runqueue = _runqueue[1:]
log.info('generate %s' % imagefile) args = [ config.MPLAYER_CMD, videofile, imagefile ] if pos != None: args.append(str(pos)) job = (([os.environ['FREEVO_SCRIPT'], 'execute', os.path.abspath(__file__) ] + args), imagefile) _runqueue.append(job) if len(_runqueue) == 1: MplayerThumbnail(*_runqueue[0])
for r, r_image in _runqueue: if r_image == imagefile: return log.info('generate %s' % imagefile) args = [ config.MPLAYER_CMD, videofile, imagefile ] if pos != None: args.append(str(pos)) job = (([os.environ['FREEVO_SCRIPT'], 'execute', os.path.abspath(__file__) ] + args), imagefile) _runqueue.append(job) if len(_run...
def snapshot(videofile, imagefile=None, pos=None, update=True): """ make a snapshot of the videofile at position pos to imagefile """ global _runqueue if not imagefile: imagefile = os.path.splitext(videofile)[0] + '.jpg' if not update and os.path.isfile(imagefile) and \ os.stat(videofile)[ST_MTIME] <= os.stat(imagefil...
os.chdir('/tmp')
tmpdir = tempfile.mkdtemp('tmp', 'videothumb', '/tmp/') os.chdir(tmpdir)
def snapshot(videofile, imagefile=None, pos=None, update=True): """ make a snapshot of the videofile at position pos to imagefile """ global _runqueue if not imagefile: imagefile = os.path.splitext(videofile)[0] + '.jpg' if not update and os.path.isfile(imagefile) and \ os.stat(videofile)[ST_MTIME] <= os.stat(imagefil...