rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
menuw.init_page() | 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 | |
for dir in search_dirs: if os.path.exists(os.path.join(dir,name)): print os.path.join(dir,name) conf.__dict__[variable] = os.path.join(dir,name) | for dirname in search_dirs: filename = os.path.join(dirname, name) if os.path.exists(filename) and os.path.isfile(filename): print filename conf.__dict__[variable] = filename | def check_program(conf, name, variable, necessary): # Check for programs both in the path and the runtime apps dir search_dirs = os.environ['PATH'].split(':') search_dirs.append('./runtime/apps') search_dirs.append('./runtime/apps/mplayer') print 'checking for %-13s' % (name+'...'), for dir in search_dirs: if os.pat... |
matches = unique([f for f in all_files if match_suffix(f, suffix_list) ]) | matches = misc.unique([f for f in all_files if match_suffix(f, suffix_list) ]) | def match_files_recursively(dir, suffix_list): """ get all files matching suffix_list in the dir and in it's subdirectories """ all_files = [] os.path.walk(dir, match_files_recursively_helper, all_files) matches = unique([f for f in all_files if match_suffix(f, suffix_list) ]) matches.sort(lambda l, o: cmp(l.upper(),... |
command = mpl + ' "' + filename + '"' | command = mpl + " " + get_demuxer(filename) + ' "' + filename + '"' print command | def play(self, mode, filename, playlist, repeat=0, mplayer_options=""): |
log.info('different subtitles: %s - %s' % \ | log.debug('different subtitles: %s - %s' % \ | def sql_add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): now = time.time() title = self.__escape_value(title) subtitle = self.__escape_value(subtitle).strip(' \t-_') description = self.__escape_value(description).strip(' \t-_') episode = self.__escape_value(episode).strip(' \t... |
log.info('different descs: %s - %s' % \ | log.debug('different descs: %s - %s' % \ | def sql_add_program(self, channel_id, title, start, stop, subtitle='', description='', episode=''): now = time.time() title = self.__escape_value(title) subtitle = self.__escape_value(subtitle).strip(' \t-_') description = self.__escape_value(description).strip(' \t-_') episode = self.__escape_value(episode).strip(' \t... |
def __init__(self, prog, type): self.prog = prog self.type = type self.v_in = None self.v_out = None self.ivtv = None self.mode = 'idle' | def get_cmd(self, rec): channel = self.device.channels[rec.channel] frequency = get_frequency(channel, self.device.chanlist) | def __init__(self, prog, type): self.prog = prog self.type = type self.v_in = None self.v_out = None self.ivtv = None self.mode = 'idle' |
def poll(self): if self.mode == 'idle': pass elif self.mode == 'stop': self.v_in.close() self.v_out.close() self.ivtv.close() self.ivtv = None self.stop_time = 0 | duration = int(rec.stop - time.time()) | def poll(self): if self.mode == 'idle': pass elif self.mode == 'stop': self.v_in.close() self.v_out.close() self.ivtv.close() self.ivtv = None self.stop_time = 0 |
self.mode = 'over' | return [ config.IVTV_ENCODER, '-bmode', String(self.device.bitrate_mode), '-brate', String(self.device.bitrate), '-bpeak', String(self.device.bitrate_peak), '-audio', String(self.device.audio_bitmask), '-dnrmode', String(self.device.dnr_mode), '-dnrtype', String(self.device.dnr_type), '-dnrspat', String(... | def poll(self): if self.mode == 'idle': pass elif self.mode == 'stop': self.v_in.close() self.v_out.close() self.ivtv.close() self.ivtv = None self.stop_time = 0 |
eventhandler.post(Event('RECORD_STOP', arg=(self.prog, self.type))) if DEBUG: print('IVTV: finished recording') | def get_channel_list(self): return [ self.channels ] | def poll(self): if self.mode == 'idle': pass elif self.mode == 'stop': self.v_in.close() self.v_out.close() self.ivtv.close() self.ivtv = None self.stop_time = 0 |
elif self.mode == 'start': eventhandler.post(Event('RECORD_START', arg=(self.prog, self.type))) if DEBUG: print 'IVTV: started recording' self.ivtv = tv.ivtv.IVTV(self.type) self.ivtv.init_settings() chan = get_actual_channel(self.type, self.prog.channel_id) if self.ivtv.settings.input_name == 'tuner': passthrough_ch... | def poll(self): if self.mode == 'idle': pass elif self.mode == 'stop': self.v_in.close() self.v_out.close() self.ivtv.close() self.ivtv = None self.stop_time = 0 | |
return '', (0,0,0,0) | return '', (x,y,x,y) | def drawstringframed(self, string, x, y, width, height, font, fgcolor=None, bgcolor=None, align_h='left', align_v='top', mode='hard', layer=None, ellipses='...'): """ draws a string (text) in a frame. This tries to fit the string in lines, if it can't, it truncates the text, draw the part that fit and returns the other... |
return string, (0,0,0,0) | return string, (x,y,x,y) | def drawstringframed(self, string, x, y, width, height, font, fgcolor=None, bgcolor=None, align_h='left', align_v='top', mode='hard', layer=None, ellipses='...'): """ draws a string (text) in a frame. This tries to fit the string in lines, if it can't, it truncates the text, draw the part that fit and returns the other... |
name = name[:name.rfind('.'):] | name = name[:name.rfind('.')] | def getname(file): """ make a nicer display name from file """ if not os.path.exists(file): return file name = os.path.basename(file) name = name[:name.rfind('.'):] name = name[0].upper() + name[1:] while FILENAME_REGEXP.match(name): m = FILENAME_REGEXP.match(name) if m: name = m.group(1) + ' ' + m.group(2).upper() +... |
if DEBUG: print 'self.joyfd = %s' % self.joyfd | if DEBUG > 5: print 'self.joyfd = %s' % self.joyfd | def poll(self): command = '' if DEBUG: print 'self.joyfd = %s' % self.joyfd (r, w, e) = select.select([self.joyfd], [], [], 0) if DEBUG: print 'r,w,e = %s,%s,%s' % (r,w,e) if r: c = os.read(self.joyfd, 8) else: return |
if DEBUG: print 'r,w,e = %s,%s,%s' % (r,w,e) | if DEBUG > 5: print 'r,w,e = %s,%s,%s' % (r,w,e) | def poll(self): command = '' if DEBUG: print 'self.joyfd = %s' % self.joyfd (r, w, e) = select.select([self.joyfd], [], [], 0) if DEBUG: print 'r,w,e = %s,%s,%s' % (r,w,e) if r: c = os.read(self.joyfd, 8) else: return |
rc.post_event(command) | command = rc.key_event_mapper(command) if command: rc.post_event(command) | def poll(self): command = '' if DEBUG: print 'self.joyfd = %s' % self.joyfd (r, w, e) = select.select([self.joyfd], [], [], 0) if DEBUG: print 'r,w,e = %s,%s,%s' % (r,w,e) if r: c = os.read(self.joyfd, 8) else: return |
if self.cols == 1 and config.MENU_ARROW_NAVIGATION: if event == MENU_LEFT: event = MENU_BACK_ONE_MENU elif event == MENU_RIGHT: event = MENU_SELECT elif self.cols == 1: if event == MENU_LEFT: event = MENU_PAGEUP elif event == MENU_RIGHT: event = MENU_PAGEDOWN | if self.cols == 1 and isinstance(menu, Menu): if config.MENU_ARROW_NAVIGATION: if event == MENU_LEFT: event = MENU_BACK_ONE_MENU elif event == MENU_RIGHT: event = MENU_SELECT else: if event == MENU_LEFT: event = MENU_PAGEUP elif event == MENU_RIGHT: event = MENU_PAGEDOWN | def eventhandler(self, event): menu = self.menustack[-1] |
channel_pos = min(len(self.guide.chan_list)-2, max(0, i+value)) | channel_pos = min(len(self.guide.chan_list)-1, max(0, i+value)) | def event_change_channel(self, value): start_time = self.start_time stop_time = self.stop_time start_channel = self.start_channel last_prg = self.selected |
if value > 0 and channel_pos < len(self.guide.chan_list)-2 and \ | if value > 0 and channel_pos < len(self.guide.chan_list)-1 and \ | def event_change_channel(self, value): start_time = self.start_time stop_time = self.stop_time start_channel = self.start_channel last_prg = self.selected |
key = p.plugin_type + '_' + special, p | key = p.plugin_type + '_' + special | def __load_plugin(self, name, type, level, args): """ Load the plugin and add it to the lists """ # fallback module = name object = '%s.PluginInterface' % module special = None |
self.poll_interval = 100 | self.poll_interval = 1000 | def __init__(self): plugin.DaemonPlugin.__init__(self) self.devices = util.list_usb_devices() self.poll_interval = 100 |
return image_x, i_val, i_file | return max(0, image_x-val.items.default.selection.spacing), i_val, i_file | def DrawMenu_Cover(self, menuw, settings): image_x = 0 val = settings menu = menuw.menustack[-1] |
osd.drawbitmap(val.logo.image, val.logo.x, val.logo.y, layer=layer) | if val.logo.width and val.logo.height: osd.drawbitmap(util.resize(val.logo.image, val.logo.width, val.logo.height), val.logo.x, val.logo.y) else: osd.drawbitmap(val.logo.image, val.logo.x, val.logo.y, layer=layer) | def DrawMenu(self, menuw): if self.hold: print 'skin.drawmenu() hold!' return osd.clearscreen(osd.COL_BLACK) |
if str(saved_prog) == str(prog): | if String(saved_prog) == String(prog): | def removeScheduledRecording(self, prog=None): if not prog: return (FALSE, 'no prog') |
if p.description == u'': | if Unicode(p.description) == u'': | def render(self, request): fv = HTMLResource() form = request.query by_chan = None |
cell = p.description | cell = Unicode(p.description) | def render(self, request): fv = HTMLResource() form = request.query by_chan = None |
stop_osd = config.OSD_STOP_WHEN_PLAYING | stop_osd = 1 | def __init__(self, app, debugname=None, doeslogging=0, stop_osd=2): rc.register(self.poll, True, 10) rc.register(self.stop, True, rc.SHUTDOWN) self.is_video = 0 # Be more explicit if stop_osd == 2: self.is_video = 1 eventhandler.post(Event(VIDEO_START)) stop_osd = config.OSD_STOP_WHEN_PLAYING |
gui.display.stop() | gui.display.hide() | def __init__(self, app, debugname=None, doeslogging=0, stop_osd=2): rc.register(self.poll, True, 10) rc.register(self.stop, True, rc.SHUTDOWN) self.is_video = 0 # Be more explicit if stop_osd == 2: self.is_video = 1 eventhandler.post(Event(VIDEO_START)) stop_osd = config.OSD_STOP_WHEN_PLAYING |
gui.display.restart() | gui.display.show() | def stop(self, cmd=''): """ stop the child """ rc.unregister(self.poll) rc.unregister(self.stop) |
self.tuner_chidx = (self.tuner_chidx+1) % len(config.ch_idx) | self.tuner_chidx = (self.tuner_chidx+1) % len(config.TV_CHANNELS) | def TunerNextChannel(self): self.tuner_chidx = (self.tuner_chidx+1) % len(config.ch_idx) |
self.tuner_chidx = (self.tuner_chidx-1) % len(config.ch_idx) | self.tuner_chidx = (self.tuner_chidx-1) % len(config.TV_CHANNELS) | def TunerPrevChannel(self): self.tuner_chidx = (self.tuner_chidx-1) % len(config.ch_idx) |
self.RE_TIME = re.compile("^A: +([0-9]+)\.").match | self.RE_TIME = re.compile("^A: +([0-9]+)").match | def __init__(self, app, item): if config.MPLAYER_DEBUG: startdir = os.environ['FREEVO_STARTDIR'] fname_out = os.path.join(startdir, 'mplayer_stdout.log') fname_err = os.path.join(startdir, 'mplayer_stderr.log') try: self.log_stdout = open(fname_out, 'a') self.log_stderr = open(fname_err, 'a') except IOError: print prin... |
if (osd.sdl_driver == 'dxr3' and self.play_mode == 'video'): | if (osd.sdl_driver == 'dxr3' and self.play_mode != 'audio'): | def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() |
if osd.sdl_driver == 'dxr3' and self.play_mode == 'video': | if osd.sdl_driver == 'dxr3' and self.play_mode != 'audio': | def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() |
if len(sys.argv) > 2: | if (len(sys.argv) > 2) and ((sys.argv[2] == '-listing') or (sys.argv[2] == '-schedule')): | def make_schedule (b=None): if not b: return # Time stuff #start_time = time.mktime(time.strptime(b.start, '%Y-%m-%d %H:%M')) start_time = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(b.start)) len_secs = int(b.stop-b.start) temp = len_secs - 1 hour = int(temp/3600) minu = int(temp/60) seco = int(temp%60) timec... |
if REGEXP.match(b.title): | if REGEXP.match(b.title) and (b.start >= int(time.time())): | def make_schedule (b=None): if not b: return # Time stuff #start_time = time.mktime(time.strptime(b.start, '%Y-%m-%d %H:%M')) start_time = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(b.start)) len_secs = int(b.stop-b.start) temp = len_secs - 1 hour = int(temp/3600) minu = int(temp/60) seco = int(temp%60) timec... |
print os.getcwd() | def main_func(): # Parse the command-line arguments video = 'sim' for arg in sys.argv[1:]: if arg == '--videotools=real': video = 'real' # Run-time configuration settings config.ConfigInit(videotools = video) # Make sure there's no mpg123 process lying around. # XXX change, we don't want to kill any mpg123 that is n... | |
else: | def _node_to_programme(node): """ Create a programme dictionary from a qp_xml 'node' """ handler = _ProgrammeHandler() programme = _extractNodes(node, handler) for attr in (u'start', u'channel'): programme[attr.encode(locale, 'ignore')] = node.attrs[(u'', attr)] if (u'', u'stop') in node.attrs: programme[u'stop'.encod... | |
programme[u'stop'.encode(locale, 'ignore')] = node.attrs[(u'', u'start')] | def _node_to_programme(node): """ Create a programme dictionary from a qp_xml 'node' """ handler = _ProgrammeHandler() programme = _extractNodes(node, handler) for attr in (u'start', u'channel'): programme[attr.encode(locale, 'ignore')] = node.attrs[(u'', attr)] if (u'', u'stop') in node.attrs: programme[u'stop'.encod... | |
self.thread.start(MPlayerApp, (command, item)) | self.thread.start(MPlayerApp, (command, item, self.refresh)) | def play(self, item, playerGUI): """ play a audioitem with mplayer """ if item.url: filename = item.url else: filename = item.filename |
def __init__(self, (app, item)): | def __init__(self, (app, item, refresh)): | def __init__(self, (app, item)): if config.MPLAYER_DEBUG: fname_out = os.path.join(config.LOGDIR, 'mplayer_stdout.log') fname_err = os.path.join(config.LOGDIR, 'mplayer_stderr.log') try: self.log_stdout = open(fname_out, 'a') self.log_stderr = open(fname_err, 'a') except IOError: print print (('ERROR: Cannot open "%s" ... |
self.refresh = refresh | def __init__(self, (app, item)): if config.MPLAYER_DEBUG: fname_out = os.path.join(config.LOGDIR, 'mplayer_stdout.log') fname_err = os.path.join(config.LOGDIR, 'mplayer_stderr.log') try: self.log_stdout = open(fname_out, 'a') self.log_stderr = open(fname_err, 'a') except IOError: print print (('ERROR: Cannot open "%s" ... | |
mplayer = plugin.getbyname(plugin.AUDIO_PLAYER) mplayer.refresh() | self.refresh() | def stdout_cb(self, line): if config.MPLAYER_DEBUG: try: self.log_stdout.write(line + '\n') except ValueError: pass # File closed if line.startswith("A:"): # get current time m = self.RE_TIME_NEW(line) if m: |
elif self.layout and self.layout.visible: self.layout = None return TRUE return FALSE | return redraw | def init_vars(self, settings, display_type): """ check which layout is used and set variables for the object """ redraw = self.redraw if settings.menu.has_key(display_type): area = settings.menu[display_type][0] else: area = settings.menu['default'][0] |
url = "http://" + _supportedLocales[LOCALE][1] + "/onca/xml2?v=1.0&f=xml&t=webservices-20" | url = "http://" + _supportedLocales[LOCALE][1] + "/onca/xml3?f=xml&t=webservices-20" | def buildURL(search_type, keyword, product_line, type, page, license_key): url = "http://" + _supportedLocales[LOCALE][1] + "/onca/xml2?v=1.0&f=xml&t=webservices-20" url += "&dev-t=%s" % license_key.strip() url += "&type=%s" % type if _supportedLocales[LOCALE][0]: url += "&locale=%s" % _supportedLocales[LOCALE][0] if p... |
mi = ActionItem(_('No configuration values'), None | mi = ActionItem(_('No configuration values'), None, | def create_config_menu(self): """ Create a config menu for the given path """ configuration_values = [] |
play_items = [] | def browse(self, arg=None, menuw=None): """ show the playlist in the menu """ self.build() for item in self.playlist: if not callable(item): # element is a string, make a correct item play_items = [] | |
for i in p.get(self, [ item ]): play_items.append(i) if play_items: pos = self.playlist.index(item) self.playlist[pos] = play_items[0] | items += p.get(self, [ item ]) else: items.append(item) self.playlist = items | def browse(self, arg=None, menuw=None): """ show the playlist in the menu """ self.build() for item in self.playlist: if not callable(item): # element is a string, make a correct item play_items = [] |
return (width, string[:c]+ellipses, string[c:]) | return (width+ellipses_size, string[:c]+ellipses, string[c:]) | def __drawstringframed_line__(self, string, max_width, font, hard, ellipses, word_splitter): """ calculate _one_ line for drawstringframed """ c = 0 # num of chars fitting width = 0 # width needed ls = len(string) space = 0 # position of last space l... |
return r, (min_x, y, max_x, y+height_needed) | return r, (min_x, y, max_x, int(y+height_needed)) | def drawstringframed(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', mode='hard', layer=None, ellipses='...'): """ draws a string (text) in a frame. This tries to fit the string in lines, if it can't, it truncates the text, draw the part that fit and re... |
item_menu = menu.Menu(_('%s Main Menu') % title, self.main_menu_generate(), | item_menu = menu.Menu(menutitle, self.main_menu_generate(), | def main_menu(self, arg=None, menuw=None): """ display the (IMAGE|VIDEO|AUDIO|GAMES) main menu """ self.display_type, force_text_view = arg title = _('Media') |
return self.name[4] | return self.name[4:] | def sort(self, mode=None): """ Returns the string how to sort this item """ if mode == 'date' and os.path.isfile(self.filename): return '%s%s' % (os.stat(self.filename).st_ctime, self.filename) |
rc.set_context('tvmenu') | def refresh(self): rc.set_context('tvmenu') self.update_schedules(force=True) self.menuw.refresh() | |
self.menuw.refresh() | if not self.menuw.children: rc.set_context('tvmenu') self.menuw.refresh() | def refresh(self): rc.set_context('tvmenu') self.update_schedules(force=True) self.menuw.refresh() |
self.subtitle = info[i] | self.subtitle = Unicode(info[i]) | def __init__(self, id = -1, name = 'unknown', channel = 'unknown', priority = 0, start = 0, stop = 0, info = {}, status = 'scheduled' ): self.id = id self.name = name self.channel = channel self.priority = priority self.start = start self.stop = stop self.status = status self.info = {} |
self.info[i] = info[i] | self.info[i] = Unicode(info[i]) | def __init__(self, id = -1, name = 'unknown', channel = 'unknown', priority = 0, start = 0, stop = 0, info = {}, status = 'scheduled' ): self.id = id self.name = name self.channel = channel self.priority = priority self.start = start self.stop = stop self.status = status self.info = {} |
if status == 'scheduled': | if status == 'scheduled' and self.recorder: | def __str__(self): """ A simple string representation for a recording for debugging in the recordserver. """ channel = self.channel if len(channel) > 10: channel = channel[:10] diff = (self.stop - self.start) / 60 name = self.name if len(name) > 23: name = name[:20] + u'...' name = u'"' + name + u'"' status = self.stat... |
subnode = fxdparser.XMLnode(i, [], self.info[i] ) | subnode = fxdparser.XMLnode(i, [], Unicode(self.info[i]) ) | def __fxd__(self, fxd): """ Dump informations about the recording in a fxd file node. """ node = fxdparser.XMLnode('recording', [ ('id', self.id ) ] ) for var in ('name', 'channel', 'priority', 'url', 'status', 'subtitle', 'fxdname', 'episode'): if getattr(self, var): subnode = fxdparser.XMLnode(var, [], Unicode(getatt... |
for i in range(1, (255 / blend_speed)): blend_last_screen.set_alpha(255 - (i * blend_speed)) blend_next_screen.set_alpha(i * blend_speed) | blend_steps = 255 / blend_speed for i in range(1, blend_steps+1): if i == blend_steps: blend_last_screen.set_alpha(0) blend_next_screen.set_alpha(255) else: blend_last_screen.set_alpha(255 - (i * blend_speed)) blend_next_screen.set_alpha(i * blend_speed) | def update(self,rect=None, blend_surface=None, blend_speed=0): """ update the screen """ if blend_surface and blend_speed: blend_last_screen = self.screen.convert() blend_next_screen = blend_surface.convert() blend_surface = self.screen.convert() |
elif sys.argv[0].find('recordserver.py') != -1: | if sys.argv[0].find('recordserver.py') != -1: | def print_help(): """ print some help about config files """ print 'Freevo is not completely configured to start' print 'The configuration is based on three files. This may sound oversized, but this' print 'way it\'s easier to configure.' print print 'First Freevo loads a file called \'freevo.conf\'. This file will be ... |
if height == -1: height = line_height if width <= 0 or height < line_height: | if int(line_height) < line_height: line_height = int(line_height) + 1 if width <= 0 or height < font.height: | def drawstringframed(self, string, x, y, width, height, font, fgcolor=None, bgcolor=None, align_h='left', align_v='top', mode='hard', layer=None, ellipses='...'): """ draws a string (text) in a frame. This tries to fit the string in lines, if it can't, it truncates the text, draw the part that fit and returns the other... |
num_lines_left = int(height / line_height) | num_lines_left = int((height+line_height-font.height) / line_height) | def drawstringframed(self, string, x, y, width, height, font, fgcolor=None, bgcolor=None, align_h='left', align_v='top', mode='hard', layer=None, ellipses='...'): """ draws a string (text) in a frame. This tries to fit the string in lines, if it can't, it truncates the text, draw the part that fit and returns the other... |
height_needed = (int(height / line_height) - num_lines_left) * line_height | height_needed = (len(lines) - 1) * line_height + font.height | def drawstringframed(self, string, x, y, width, height, font, fgcolor=None, bgcolor=None, align_h='left', align_v='top', mode='hard', layer=None, ellipses='...'): """ draws a string (text) in a frame. This tries to fit the string in lines, if it can't, it truncates the text, draw the part that fit and returns the other... |
max_y = int(y+height_needed) if max_y < y+height_needed: max_y += 1 return r, (min_x, y, max_x, max_y) | return r, (min_x, y, max_x, y+height_needed) | def drawstringframed(self, string, x, y, width, height, font, fgcolor=None, bgcolor=None, align_h='left', align_v='top', mode='hard', layer=None, ellipses='...'): """ draws a string (text) in a frame. This tries to fit the string in lines, if it can't, it truncates the text, draw the part that fit and returns the other... |
items += [ MenuItem(title, function, item) ] | items += [ MenuItem(title, function) ] | def make_submenu(self, menu_name, actions, item): items = [] for function, title in actions: items += [ MenuItem(title, function, item) ] xml_file = None if hasattr(item, 'xml_file'): xml_file = item.xml_file |
self.current_item = None | self.__current = None self.__next = None | def __init__(self, name='', playlist=[], parent=None, display_type=None, random=False, build=False, autoplay=False, repeat=REPEAT_OFF): """ Init the playlist |
self.current_item = self.playlist[0] if not isinstance(self.current_item, Item): | self.__current = self.playlist[0] eventhandler.post(Event(PLAY_START, self)) if not isinstance(self.__current, Item): | def play(self, next=False): """ play the playlist """ if not self.playlist: log.warning('empty playlist') return False |
l = mediadb.FileListing([self.current_item]) | l = mediadb.FileListing([self.__current]) | def play(self, next=False): """ play the playlist """ if not self.playlist: log.warning('empty playlist') return False |
pos = self.playlist.index(self.current_item) self.current_item = play_items[0] | pos = self.playlist.index(self.__current) self.__current = play_items[0] | def play(self, next=False): """ play the playlist """ if not self.playlist: log.warning('empty playlist') return False |
if hasattr(self.current_item, 'play'): | pos = self.playlist.index(self.__current) pos = (pos+1) % len(self.playlist) if pos or REPEAT_PLAYLIST: self.__next = self.playlist[pos] else: self.__next = None if hasattr(self.__current, 'play'): | def play(self, next=False): """ play the playlist """ if not self.playlist: log.warning('empty playlist') return False |
self.current_item.play() | self.__current.play() | def play(self, next=False): """ play the playlist """ if not self.playlist: log.warning('empty playlist') return False |
pos = self.playlist.index(self.current_item) pos = (pos+1) % len(self.playlist) if pos: self.current_item = self.playlist[pos] Playlist.play(self, True) else: self.current_item = None | if self.__next: return Playlist.play(self, True) | def play(self, next=False): """ play the playlist """ if not self.playlist: log.warning('empty playlist') return False |
def cache_next(self): """ cache next item, usefull for image playlists """ pos = self.playlist.index(self.current_item) pos = (pos+1) % len(self.playlist) if pos and hasattr(self.playlist[pos], 'cache'): self.playlist[pos].cache() | def cache_next(self): """ cache next item, usefull for image playlists """ pos = self.playlist.index(self.current_item) pos = (pos+1) % len(self.playlist) if pos and hasattr(self.playlist[pos], 'cache'): self.playlist[pos].cache() | |
if self.current_item: self.current_item.parent = self.parent if hasattr(self.current_item, 'stop'): try: self.current_item.stop() except OSError: pass | self.background_playlist = None if self.__current: item = self.__current self.__current = None item.stop() | def stop(self): """ stop playling """ if self.background_playlist: self.background_playlist.stop() if self.current_item: self.current_item.parent = self.parent if hasattr(self.current_item, 'stop'): try: self.current_item.stop() except OSError: pass |
if event == PLAY_END: if self.current_item and self.current_item.type == 'audio': e = Event(AUDIO_LOG, arg=self.current_item.filename) eventhandler.post(e) if event in (INPUT_1, INPUT_2, INPUT_3, INPUT_4, INPUT_5) and \ event.arg and self.current_item and \ hasattr(self.current_item,'type'): if (self.current_item.type... | def eventhandler(self, event, menuw=None): """ Handle playlist specific events """ | |
if event in ( PLAY_END, USER_END ) and self.repeat == REPEAT_ITEM: self.current_item.play() | if event == PLAY_END: if self.repeat == REPEAT_ITEM: self.__current.play() elif self.__next: self.__current = self.__next Playlist.play(self, True) else: self.stop() eventhandler.post(Event(PLAY_END, self)) | def eventhandler(self, event, menuw=None): """ Handle playlist specific events """ |
if event in ( PLAYLIST_NEXT, PLAY_END, USER_END) \ and self.current_item and self.playlist: pos = self.playlist.index(self.current_item) pos = (pos+1) % len(self.playlist) if pos or self.repeat == REPEAT_PLAYLIST: if self.current_item: self.current_item.stop() self.current_item = self.playlist[pos] Playlist.play(self,... | if event == PLAYLIST_NEXT: if self.__next: self.__current.stop() | def eventhandler(self, event, menuw=None): """ Handle playlist specific events """ |
elif event == PLAYLIST_NEXT: | else: | def eventhandler(self, event, menuw=None): """ Handle playlist specific events """ |
if event in (PLAY_END, USER_END, STOP): if self.background_playlist: self.background_playlist.stop() self.current_item = None return True if event == PLAYLIST_PREV and self.current_item and self.playlist: pos = self.playlist.index(self.current_item) | if event == PLAYLIST_PREV: pos = self.playlist.index(self.__current) | def eventhandler(self, event, menuw=None): """ Handle playlist specific events """ |
if hasattr(self.current_item, 'stop'): try: self.current_item.stop() except OSError: log.info('ignore playlist event') return True pos = (pos-1) % len(self.playlist) self.current_item = self.playlist[pos] Playlist.play(self, True) | self.__next = self.playlist[pos-1] self.__current.stop() | def eventhandler(self, event, menuw=None): """ Handle playlist specific events """ |
return | return s, (0,0,0,0) | 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='...'): |
return string | return string, (0,0,0,0) | 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 not self.result: | if not self.result or not self.server_available: | def eventhandler(self, event, menuw=None): if not self.result: self.destroy() return |
xmltv_programs = xmltv.read_programmes(util.gzopen(config.XMLTV_FILE)) | f = util.gzopen(config.XMLTV_FILE) xmltv_programs = xmltv.read_programmes(f) f.close() | def load_guide(): # Create a new guide guide = epg_types.TvGuide() # Is there a file to read from? if os.path.isfile(config.XMLTV_FILE): gotfile = 1 if 0: # XXX Hack to fix a bug where qp_xml barfs on 8-bit chars. # Read the current file print 'XMLTV: XXX Hack to fix a bug where qp_xml barfs on 8-bit chars.' fd = op... |
tz='+2' | tz='+1' | 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='+2' # Is it the '+1' format? if tz[0] == '+' or tz[0] == '-': tmTuple = ( int(tval[0:4]), int(tval[4:6]), int(tval[6:8]), ... |
def get_bookmarkfile(filename): | def get_bookmarkfile(self, filename): | def get_bookmarkfile(filename): """ Get the bookmark file for the given filename. """ myfile = os.path.basename(filename) myfile = sysconfig.CACHEDIR + "/" + myfile + '.bookmark' return myfile |
def DrawTextFramed(text, settings, x=-1, y=-1, width=-1, height=-1, size=0, mode='hard'): | def DrawTextFramed(text, settings, x=-1, y=-1, width=None, height=None, size=0, mode='hard'): | def DrawTextFramed(text, settings, x=-1, y=-1, width=-1, height=-1, size=0, mode='hard'): if x == -1: x = settings.x if y == -1: y = settings.y if width == -1: width = settings.width if height == -1: height = settings.height if size == 0: size = settings.size if settings.shadow_visible: osd.drawstringframed(text, ... |
if width == -1: width = settings.width if height == -1: height = settings.height | if width == None: width = settings.width if height == None: height = settings.height | def DrawTextFramed(text, settings, x=-1, y=-1, width=-1, height=-1, size=0, mode='hard'): if x == -1: x = settings.x if y == -1: y = settings.y if width == -1: width = settings.width if height == -1: height = settings.height if size == 0: size = settings.size if settings.shadow_visible: osd.drawstringframed(text, ... |
line_length = 80 | if config.OVERSCAN_X: line_length = 55 else: line_length = 80 | def drawosd(self): |
osd.drawbox(0, osd.height - (25 + (len(prt_line) * 30)), | osd.drawbox(config.OVERSCAN_X, osd.height - (config.OVERSCAN_X + 25 + (len(prt_line) * 30)), | def drawosd(self): |
h=osd.height - (50 + ( (len(prt_line) - line - 1) * 30)) osd.drawstring(prt_line[line], 10, h, fgcolor=osd.COL_ORANGE) | h=osd.height - (40 + config.OVERSCAN_Y + ((len(prt_line) - line - 1) * 30)) osd.drawstring(prt_line[line], 15 + config.OVERSCAN_X, h, fgcolor=osd.COL_ORANGE) | def drawosd(self): |
class XML_menuitems: def __init__(self): self.x = self.y = self.height = self.width = 0 self.default = XML_menuitem() self.dir = XML_menuitem() self.pl = XML_menuitem() | def parse(self, node, scale = 0.0, c_dir=''): XML_data.parse(self, node, scale, c_dir) | def __init__(self): XML_data.__init__(self) self.selection = XML_data() |
class XML_menu: def __init__(self): self.background = XML_background() self.logo = XML_data() self.title = XML_data() self.items = XML_menuitems() self.cover_movie = XML_cover() self.cover_music = XML_cover() self.cover_image = XML_cover() self.submenu = XML_menuitem() class XML_mp3: def __init__(self): self.backgrou... | class XML_menuitems: def __init__(self): self.x = self.y = self.height = self.width = 0 self.default = XML_menuitem() self.dir = XML_menuitem() self.pl = XML_menuitem() def parse(self, node, scale = 0.0, c_dir=''): self.x = attr_int(node, "x", self.x, scale) self.y = attr_int(node, "y", self.y, scale) self.height = at... | def parse(self, node, scale = 0.0, c_dir=''): XML_data.parse(self, node, scale, c_dir) for subnode in node.children: if subnode.name == u'mask': self.mask = [] for masknode in subnode.children: if masknode.name == u'rectangle': rect = XML_data() rect.parse(masknode, scale) self.mask += [ rect ] |
def attr_int(node, attr, default, scale=0.0): try: if node.attrs.has_key(('', attr)): val = int(node.attrs[('', attr)]) if scale: val = scale*val return int(val) except ValueError: pass return default def attr_float(node, attr, default): try: if node.attrs.has_key(('', attr)): return float(node.attrs[('', attr)]) exce... | class XML_menu: def __init__(self): self.background = XML_background() self.logo = XML_data() self.title = XML_data() self.items = XML_menuitems() self.cover_movie = XML_cover() self.cover_music = XML_cover() self.cover_image = XML_cover() self.submenu = XML_menuitem() def parse(self, menu_node, scale = 0.0, c_dir='')... | def parse(self, node, scale = 0.0, c_dir=''): self.image = attr_file(node, "image", self.image, c_dir) tmp = attr_file(node, "mask", None, c_dir) if not tmp == None: self.mask = tmp for subnode in node.children: if subnode.name == u'mask': for masknode in subnode.children: if masknode.name == u'rectangle': rect = XML_d... |
self.scale = 0.0 | def __init__(self): self.menu_default = XML_menu() self.menu_main = XML_menu() self.mp3 = XML_mp3() self.popup = XML_popup() | |
def parseItems(self, node, data): data.x = attr_int(node, "x", data.x, self.scale) data.y = attr_int(node, "y", data.y, self.scale) data.height = attr_int(node, "height", data.height, self.scale) data.width = attr_int(node, "width", data.width, self.scale) for subnode in node.children: if subnode.name == u'item': typ... | def parse(self, freevo_type, scale, c_dir, copy_content): for node in freevo_type.children: if node.name == u'menu': type = attr_str(node, "type", "all") | def __init__(self): self.menu_default = XML_menu() self.menu_main = XML_menu() self.mp3 = XML_mp3() self.popup = XML_popup() |
data.default.parse(subnode, self.scale) data.dir.parse(subnode, self.scale) data.pl.parse(subnode, self.scale) elif type == 'dir': data.dir.parse(subnode, self.scale) elif type == 'playlist': data.pl.parse(subnode, self.scale) | if copy_content: self.menu_default = copy.deepcopy(self.menu_default) self.menu_main = copy.deepcopy(self.menu_main) self.menu_default.parse(node, scale, c_dir) self.menu_main.parse(node, scale, c_dir) if type == "main": self.menu_main.parse(node, scale, c_dir) if node.name == u'mp3': if copy_content: self.mp3 = copy... | def parseItems(self, node, data): data.x = attr_int(node, "x", data.x, self.scale) data.y = attr_int(node, "y", data.y, self.scale) data.height = attr_int(node, "height", data.height, self.scale) data.width = attr_int(node, "width", data.width, self.scale) |
def read_menu(self, file, menu_node, menu): for node in menu_node.children: if node.name == u'background': menu.background.parse(node, self.scale, os.path.dirname(file)) if node.name == u'logo': menu.logo.parse(node, self.scale, os.path.dirname(file)) elif node.name == u'title': menu.title.parse(node, self.scale) el... | def parseItems(self, node, data): data.x = attr_int(node, "x", data.x, self.scale) data.y = attr_int(node, "y", data.y, self.scale) data.height = attr_int(node, "height", data.height, self.scale) data.width = attr_int(node, "width", data.width, self.scale) | |
def load(self, file, copy_content = 0): | def load(self, file, copy_content = 0, scale=0.0): | def load(self, file, copy_content = 0): if not os.path.isfile(file): return 0 try: parser = qp_xml.Parser() box = parser.parse(open(file).read()) for freevo_type in box.children: if freevo_type.name == 'skin': |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.