rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
import config import vfs
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...
print 'saving image', e
print 'error saving image %s: %s' % (imagefile, e)
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...
out = misc.stdout([os.environ['FREEVO_SCRIPT'], 'execute', os.path.abspath(__file__) ] + args)
out = stdout([os.environ['FREEVO_SCRIPT'], 'execute', os.path.abspath(__file__) ] + args)
def snapshot(videofile, imagefile=None, pos=None, update=True, popup=None): """ make a snapshot of the videofile at position pos to imagefile """ import config import misc import Image import util import vfs import gui if not imagefile: imagefile = vfs.getoverlay(videofile + '.raw') if not update and os.path.isfile(i...
import popen2
def snapshot(videofile, imagefile=None, pos=None, update=True, popup=None): """ make a snapshot of the videofile at position pos to imagefile """ import config import misc import Image import util import vfs import gui if not imagefile: imagefile = vfs.getoverlay(videofile + '.raw') if not update and os.path.isfile(i...
print 'Cannot open file "%s"' % list
print 'Cannot open file "%s"' % plsname
def read_m3u(self, plsname): """ This is the (m3u) playlist reading function.
playlist_lines_dos = map(lambda l: l.strip(), lines) playlist_lines = filter(lambda l: l[0] != '
try: playlist_lines_dos = map(lambda l: l.strip(), lines) playlist_lines = filter(lambda l: l[0] != ' except IndexError: print 'Bad m3u playlist file "%s"' % plsname return 0
def read_m3u(self, plsname): """ This is the (m3u) playlist reading function.
print 'Error: Item is not an AudioCD'
_debug_('[Error] - Item is not an AudioCD')
def actions(self, item): self.item = item try: if (self.item.type == 'audiocd'): if self.rip_thread: return [ ( self.show_status, 'Show CD ripping status') ] else: self.device = self.item.devicename _debug_('devicename = %s' %self.device) return [ ( self.create_backup_menu, _('Rip the CD to the hard drive'), _('Get CD...
print 'Error: No CDDB data returned from MMPYTHON'
_debug_('[Warning] - No CDDB data available to mmpython',2)
def get_formatted_cd_info(self, device): cd_info = mmpython.parse(device) # Check if getting CDDB data failed -is there a better way to do this? # Give some defaults with a timestamp to uniqueify artist and album names. # So that subsequent CDs with no CDDB data found don't overwrite each other. if ((cd_info.title == ...
print 'The current time is: %s' %current_time
def get_formatted_cd_info(self, device): cd_info = mmpython.parse(device) # Check if getting CDDB data failed -is there a better way to do this? # Give some defaults with a timestamp to uniqueify artist and album names. # So that subsequent CDs with no CDDB data found don't overwrite each other. if ((cd_info.title == ...
time.sleep(0.5)
print 'self.t1.isAlive()=%s, self.t2.isAlive()=%s' % (self.t1.isAlive(), self.t2.isAlive()) time.sleep(0.1)
def __init__(self, app): # Start the child app through 'runapp' which will unblock signals self.child = popen2.Popen3('./runapp ' + app, 1, 100) self.outfile = self.child.fromchild self.errfile = self.child.childerr self.infile = self.child.tochild self.t1 = Read_Thread('stdout', self.outfile, self.stdout_cb) self.t1....
os.kill(self.child.pid, signal)
try: if signal: if DEBUG: print 'childapp: killing pid %s' % self.child.pid os.kill(self.child.pid, signal)
def kill(self, signal=9): os.kill(self.child.pid, signal) # Wait for the child to exit try: self.child.wait() except: pass
print '%s: No data, stopping!' % self.name
print '%s: No data, stopping (pid %s)!' % (self.name, os.getpid())
def _handle_input(self): saved = '' while 1:
def view_image(menuw=None, arg=None):
def view_image(arg=None, menuw=None):
def view_image(menuw=None, arg=None): osd.clearscreen(color=osd.COL_BLACK) osd.drawstring('please wait...', osd.width/2 - 60, osd.height/2 - 10, fgcolor=osd.COL_ORANGE, bgcolor=osd.COL_BLACK) osd.update() file = arg[0] number = arg[1] playlist = arg[2] iview.view(file, number, playlist)
add_args = ''
def play(self, item, playerGUI): """ play an audio file with xine """
command = '%s "%s"' % (self.command, filename)
if filename.startswith('cdda://'): filename = filename.replace('//', '/') add_args += ' cfg:/input.cdda_device:%s' % item.media.devicename command = '%s %s "%s"' % (self.command, add_args, filename)
def play(self, item, playerGUI): """ play an audio file with xine """
os.environ['LD_PRELOAD'] = ''
os.system('ls') sys.exit()
def main_func(): # Add the drives to the config.removable_media list. There doesn't have # to be any drives defined. if config.ROM_DRIVES != None: for i in range(len(config.ROM_DRIVES)): (dir, device, name) = config.ROM_DRIVES[i] media = RemovableMedia(mountdir=dir, devicename=device, drivename=name) # close the tray ...
min = int(sec/60)
min = int((sec-(hour*3600))/60)
def bookmark_menu(self,arg=None, menuw=None): """ Bookmark list """ bookmarkfile = self.bookmarkfile items = [] for line in util.readfile(bookmarkfile): file = copy.copy(self) sec = int(line) hour = int(sec/3600) min = int(sec/60) sec = int(sec%60) time = '%0.2d:%0.2d:%0.2d' % (hour,min,sec) file.name = 'Jump to %s' % ...
add_uri(channel, '%s:%s' % (s, uri))
add_uri(channel, '%s:%s' % (s, uri[uri.find(':')+1:]))
def add_uri(channel, uri): """ Add a URI to the internal list where to find that channel. Also save the access_id because many people, mostly North Americans, like to use it (usually in the display). """ if uri.find(':') == -1: channel.access_id = uri defaults = [] if isinstance(config.TV_DEFAULT_DEVICE, list) or \ isi...
for f in copy.copy(files): if vfs.basename(f) in ('CVS', '.xvpics', '.thumbnails', '.pics', '.', '..'): files.remove(f)
def listdir(directory, handle_exception=True): """ get a directory listing (including OVERLAY_DIR) """ try: files = ([ os.path.join(directory, fname) for fname in os.listdir(directory) ]) overlay = getoverlay(directory) if overlay and os.path.isdir(overlay): for f in ([ os.path.join(overlay, fname) for fname in os.list...
cPickle.dump(data, f, PICKLE_PROTOCOL)
if version: cPickle.dump((version, data), f, PICKLE_PROTOCOL) else: cPickle.dump(data, f, PICKLE_PROTOCOL)
def save(file, data, version=None): """ Save the data to the given file. If version is given, this information will also be stored in the cachefile. Notice: when using a version here, the version parameter must also be used when loading the data again. """ try: if _isfile(file): _unlink(file) f = _open(file, 'w') cPick...
display_type=self.display_type, random=True,
type=self.display_type, random=True,
def random_play(self): """ play the playlist in random order """ Playlist(playlist=self.playlist, parent=self.parent, display_type=self.display_type, random=True, repeat=self.repeat).play()
display_type=display_type, build=True))
type=display_type, build=True))
def get(self, parent, listing): """ return a list of items based on the files """ items = [] if parent and hasattr(parent, 'display_type'): display_type = parent.display_type else: display_type = None
display_type=fxd.getattr(None, 'display_type'),
type=fxd.getattr(None, 'display_type'),
def fxdhandler(self, fxd, node): """ parse audio specific stuff from fxd files
print r
print String(unicode(r))
def print_result(result): if isinstance(result, (list, tuple)): for r in result: print r else: print result
if self.variants:
if self.variants and len(self.variants) > 1:
def actions(self): """ return a list of possible actions on this item. """ items = [ (self.play, 'Play'), ] if not self.filename or self.filename == '0': if self.mode == 'dvd': if plugin.getbyname(plugin.DVD_PLAYER): items = [ (self.play, 'Play DVD'), ( self.dvd_vcd_title_menu, 'DVD title list' ) ] else: items = [ ( se...
if self.variants: self.variants[0].play(arg, menuw) return
def play(self, arg=None, menuw=None): """ play the item. """ self.parent.current_item = self
osd.drawbitmap(thumb, val.cover_image.x, val.cover_image.y)
if thumb: osd.drawbitmap(thumb, val.cover_image.x, val.cover_image.y)
def DrawMenu(self, menuw): osd.clearscreen(osd.COL_WHITE)
Playlist.__init__(self, parent=parent)
Playlist.__init__(self, parent=parent, display_type=display_type)
def __init__(self, directory, parent, name = '', display_type = None, add_args = None): Playlist.__init__(self, parent=parent) self.type = 'dir' self.menuw = None self.menu = None self.name = os.path.basename(directory)
self.menuw = None
def __init__(self, directory, parent, name = '', display_type = None, add_args = None): Playlist.__init__(self, parent=parent) self.type = 'dir' self.menuw = None self.menu = None self.name = os.path.basename(directory)
self.name = os.path.basename(directory)
def __init__(self, directory, parent, name = '', display_type = None, add_args = None): Playlist.__init__(self, parent=parent) self.type = 'dir' self.menuw = None self.menu = None self.name = os.path.basename(directory)
self.dir = os.path.abspath(directory) self.display_type = display_type self.info = mediainfo.get(directory) self.mountpoint = None
else: self.name = os.path.basename(directory) self.dir = os.path.abspath(directory) self.info = mediainfo.get(directory)
def __init__(self, directory, parent, name = '', display_type = None, add_args = None): Playlist.__init__(self, parent=parent) self.type = 'dir' self.menuw = None self.menu = None self.name = os.path.basename(directory)
self.folder_fxd = self.folder_fxd
self.skin_fxd = self.folder_fxd
def read_folder_fxd(self, fxd, node): ''' parse the xml file for directory settings
if self.mountpoint: util.mount(self.mountpoint)
def check_password_and_build(self, arg=None, menuw=None): """ password checker """ if not self.menuw: self.menuw = menuw
if self.menu.selected:
if self.menu.selected and selected_pos != -1:
def build(self, arg=None, menuw=None): """ build the items for the directory """ self.playlist = [] self.play_items = [] self.dir_items = [] self.pl_items = []
print 'TV %s' % event
def eventhandler(event): print 'TV %s' % event if event == rc.EXIT or event == rc.MENU: rc.app = None menuwidget.refresh() elif event == rc.SELECT or event == rc.PLAY: start_tv('tv', em.listing.last_to_listing[3].channel_id) else: em.eventhandler(event)
i = self.drawimage(table_text[i], (table_x + x_mod, y + vskip)) gui_objects.append(i)
img = self.drawimage(table_text[i], (table_x + x_mod, y + vskip)) gui_objects.append(img)
def __draw_text_listing_item(self, choice, (x,y), settings, val, hspace, vspace, gui_objects, width, hskip, vskip): """ Draw an item for the text menu. This function is called from update and is only used once to split the huge update function into smaller once. """ icon_x = 0 icon = None align = val.align or settin...
try: recording = prog.isRecording except: recording = FALSE
def removeScheduledRecording(self, prog=None): if not prog: return (FALSE, 'no prog')
if DEBUG: print 'addProgram: key is "%s"' % key
if config.DEBUG: print 'addProgram: key is "%s"' % key
def addProgram(self, prog, key=None): if not key: # key = rec_interface.getKey(prog) pass
if DEBUG: print 'addProgram: actually adding "%s"' % prog
if config.DEBUG: print 'addProgram: actually adding "%s"' % prog
def addProgram(self, prog, key=None): if not key: # key = rec_interface.getKey(prog) pass
if DEBUG: print 'We already know about this recording.' if DEBUG: print 'addProgram: len is "%s"' % len(self.programList)
if config.DEBUG: print 'We already know about this recording.' if config.DEBUG: print 'addProgram: len is "%s"' % len(self.programList)
def addProgram(self, prog, key=None): if not key: # key = rec_interface.getKey(prog) pass
if DEBUG: print 'removed recording: %s' % prog else: if DEBUG: print 'We do not know about this recording.'
if config.DEBUG: print 'removed recording: %s' % prog else: if config.DEBUG: print 'We do not know about this recording.'
def removeProgram(self, prog, key=None): if not key: # key = rec_interface.getKey(prog) pass
if DEBUG: print 'addFavorites: actually adding "%s"' % fav.name
if config.DEBUG: print 'addFavorites: actually adding "%s"' % fav.name
def addFavorite(self, fav): if not self.favorites.has_key(fav.name): if DEBUG: print 'addFavorites: actually adding "%s"' % fav.name self.favorites[fav.name] = fav else: if DEBUG: print 'We already have a favorite called "%s".' % fav.name
if DEBUG: print 'We already have a favorite called "%s".' % fav.name
if config.DEBUG: print 'We already have a favorite called "%s".' % fav.name
def addFavorite(self, fav): if not self.favorites.has_key(fav.name): if DEBUG: print 'addFavorites: actually adding "%s"' % fav.name self.favorites[fav.name] = fav else: if DEBUG: print 'We already have a favorite called "%s".' % fav.name
if DEBUG: print 'removed favorite: %s' % name else: if DEBUG: print 'We do not have a favorite called "%s".' % name
if config.DEBUG: print 'removed favorite: %s' % name else: if config.DEBUG: print 'We do not have a favorite called "%s".' % name
def removeFavorite(self, name): if self.favorites.has_key(name): del self.favorites[name] if DEBUG: print 'removed favorite: %s' % name else: if DEBUG: print 'We do not have a favorite called "%s".' % name
self.pid = os.spawnv(os.P_NOWAIT, self.application, self.app_args)
self.pid = os.spawnvp(os.P_NOWAIT, self.application, self.app_args)
def __init__(self, app_args): self.appname = app_args.app_name self.application = app_args.exec_name self.app_args = [self.application] + app_args.exec_args self.pid = os.spawnv(os.P_NOWAIT, self.application, self.app_args) #print 'Spawned "%s", pid %s' % (' '.join(self.app_args), self.pid) print 'Spawned "%s", pid %s'...
remote_xterm = ('remote', '/usr/X11R6/bin/xterm',
remote_xterm = ('remote', 'xterm',
def __init__(self, app_name, exec_name, exec_args = [], exec_args_dict = {}): self.app_name = app_name self.exec_name = exec_name for i in range(len(exec_args)): processed_arg = exec_args[i] % exec_args_dict exec_args[i] = processed_arg self.exec_args = exec_args
remote_quiet = ('remote', '/bin/sh',
remote_quiet = ('remote', 'sh',
def __init__(self, app_name, exec_name, exec_args = [], exec_args_dict = {}): self.app_name = app_name self.exec_name = exec_name for i in range(len(exec_args)): processed_arg = exec_args[i] % exec_args_dict exec_args[i] = processed_arg self.exec_args = exec_args
'/usr/local/bin/python ./rc_client/remote.py --remote=lirc > /dev/null', ])
'python ./rc_client/remote.py --remote=lirc > /dev/null', ])
def __init__(self, app_name, exec_name, exec_args = [], exec_args_dict = {}): self.app_name = app_name self.exec_name = exec_name for i in range(len(exec_args)): processed_arg = exec_args[i] % exec_args_dict exec_args[i] = processed_arg self.exec_args = exec_args
osd_fb_quiet = ('osd_fb', '/bin/sh', ['-c', './osd_server/osd_fb/osd_fb > /dev/null'])
osd_fb_quiet = ('osd_fb', 'sh', ['-c', './osd_server/osd_fb/osd_fb > /dev/null'])
def __init__(self, app_name, exec_name, exec_args = [], exec_args_dict = {}): self.app_name = app_name self.exec_name = exec_name for i in range(len(exec_args)): processed_arg = exec_args[i] % exec_args_dict exec_args[i] = processed_arg self.exec_args = exec_args
osd_x11 = ('osd_x11', '/bin/sh', ['-c', './osd_server/osd_fb/osd_x11 > /dev/null'])
osd_x11 = ('osd_x11', 'sh', ['-c', './osd_server/osd_fb/osd_x11 > /dev/null'])
def __init__(self, app_name, exec_name, exec_args = [], exec_args_dict = {}): self.app_name = app_name self.exec_name = exec_name for i in range(len(exec_args)): processed_arg = exec_args[i] % exec_args_dict exec_args[i] = processed_arg self.exec_args = exec_args
freevo_main_xterm = ('freevo', '/usr/X11R6/bin/xterm',
freevo_main_xterm = ('freevo', 'xterm',
def __init__(self, app_name, exec_name, exec_args = [], exec_args_dict = {}): self.app_name = app_name self.exec_name = exec_name for i in range(len(exec_args)): processed_arg = exec_args[i] % exec_args_dict exec_args[i] = processed_arg self.exec_args = exec_args
'-e', '/usr/local/bin/python',
'-e', 'python',
def __init__(self, app_name, exec_name, exec_args = [], exec_args_dict = {}): self.app_name = app_name self.exec_name = exec_name for i in range(len(exec_args)): processed_arg = exec_args[i] % exec_args_dict exec_args[i] = processed_arg self.exec_args = exec_args
freevo_main_quiet = ('freevo', '/bin/sh', [ '-c', '/usr/local/bin/python ./main.py '
freevo_main_quiet = ('freevo', 'sh', [ '-c', 'python ./main.py '
def __init__(self, app_name, exec_name, exec_args = [], exec_args_dict = {}): self.app_name = app_name self.exec_name = exec_name for i in range(len(exec_args)): processed_arg = exec_args[i] % exec_args_dict exec_args[i] = processed_arg self.exec_args = exec_args
if idle < USER_IDLETIME: log.info('user idle time: %s minutes' % idle) return idle >= USER_IDLETIME
return idle
def check_login(self): """ Check /var/run/utmp using 'who' to get the uder idle time Note: This is bad, reading /var/run/utmp would be a better idea """ idle = 1000 child = popen2.Popen3(['who', '-u']) while True: line = child.fromchild.readline().replace('\n', ' ') if not line: break while line.find(' ') != -1: line ...
log.info('Entity idletime is %s, waiting %s minutes' % \ (self.idletime, 30 - self.idletime))
log.info('Entity idletime is %s' % self.idletime)
def check_shutdown(self): """ Check if shutdown is possible and shutdown the system. """ if self.wakeuptime != self.__last_wakeuptime: # there is a new wakeup time log.info('set wakeup time: %s' % self.wakeuptime) self.__last_wakeuptime = self.wakeuptime util.popen.Process(config.SHUTDOWN_WAKEUP_CMD % self.wakeuptime)
else: log.info('Minimum idletime is %s, continue' % self.idletime)
elif self.idletime < 1000: log.info('Entity idletime is %s, continue' % self.idletime)
def check_shutdown(self): """ Check if shutdown is possible and shutdown the system. """ if self.wakeuptime != self.__last_wakeuptime: # there is a new wakeup time log.info('set wakeup time: %s' % self.wakeuptime) self.__last_wakeuptime = self.wakeuptime util.popen.Process(config.SHUTDOWN_WAKEUP_CMD % self.wakeuptime)
possible = True
def check_shutdown(self): """ Check if shutdown is possible and shutdown the system. """ if self.wakeuptime != self.__last_wakeuptime: # there is a new wakeup time log.info('set wakeup time: %s' % self.wakeuptime) self.__last_wakeuptime = self.wakeuptime util.popen.Process(config.SHUTDOWN_WAKEUP_CMD % self.wakeuptime)
possible = False else: try: if not self.check_login(): possible = False except: log.exception('who checking, please report this trace') if not possible:
log.info('Next check in 5 minutes')
def check_shutdown(self): """ Check if shutdown is possible and shutdown the system. """ if self.wakeuptime != self.__last_wakeuptime: # there is a new wakeup time log.info('set wakeup time: %s' % self.wakeuptime) self.__last_wakeuptime = self.wakeuptime util.popen.Process(config.SHUTDOWN_WAKEUP_CMD % self.wakeuptime)
self.timer = notifier.addTimer(POLL_INTERVALL, self.check_mbus)
self.timer = notifier.addTimer(5 * POLL_INTERVALL, self.check_mbus)
def check_shutdown(self): """ Check if shutdown is possible and shutdown the system. """ if self.wakeuptime != self.__last_wakeuptime: # there is a new wakeup time log.info('set wakeup time: %s' % self.wakeuptime) self.__last_wakeuptime = self.wakeuptime util.popen.Process(config.SHUTDOWN_WAKEUP_CMD % self.wakeuptime)
return id, String('%s://%s' % (mode, filename)), media_id, options, player, playlist
return id, String('%s://%s' % (String(mode), String(filename))), \ media_id, options, player, playlist
def parse_video_child(fxd, node, dirname): """ parse a subitem from <video> """ filename = String(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') pl...
if hasattr(media.info,'handle_type'): if not media.info.handle_type:
if hasattr(media.info,'type') and hasattr(media.info,'handle_type'): if not media.info.handle_type and media.info.type:
def draw(self, (type, object)): image = self.cdimages['empty_cdrom'] for media in config.REMOVABLE_MEDIA: if hasattr(media.info,'handle_type'): if not media.info.handle_type: # mixed CD image = self.cdimages['mixed'] else: image = self.cdimages[media.info.handle_type] osd.drawbitmap(image,220,30)
else:
elif media.info.handle_type:
def draw(self, (type, object)): image = self.cdimages['empty_cdrom'] for media in config.REMOVABLE_MEDIA: if hasattr(media.info,'handle_type'): if not media.info.handle_type: # mixed CD image = self.cdimages['mixed'] else: image = self.cdimages[media.info.handle_type] osd.drawbitmap(image,220,30)
print info.image box = AlertBox(icon=info.image, width=550, height=400, text=' %s\n \n %s\n \n Year: %s\n Genre: %s\n Rating: %s\n Runtime: %s' % (info.name,info.info['plot'],info.info['year'],info.info['genre'],info.info['rating'],info.info['length']))
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['year'],info.info['genre'],info.info['rating'],info.info['length']))
def info_showdata(self, arg=None, menuw=None): """ show info for this item """
self.handler(self.lbg.get_word())
self.handler(txt)
def eventhandler(self, event): if self.lbg.eventhandler(event): self.draw() return True if event == INPUT_ENTER: self.destroy() if self.handler: self.handler(self.lbg.get_word()) return True
os.umask(config.UMASK)
os.umask(UMASK)
def _debug_function_(s, level=1): if DEBUG < level: return # add the current trace to the string where = traceback.extract_stack(limit = 2)[0] if isinstance( s, unicode ): s = s.encode(encoding, 'replace') s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s) # print debug message print s
tmp_pieces = words[word_number].replace('a','a ') tmp_pieces = tmp_pieces.replace('e','e ') tmp_pieces = tmp_pieces.replace('i','i ') tmp_pieces = tmp_pieces.replace('o','o ') tmp_pieces = tmp_pieces.replace('u','u ')
tmp_pieces = words[word_number] tmp_pieces = re.sub(r'(?P<str>[aeiou!@ tmp_pieces = tmp_pieces.replace(' ',' ')
def drawstringframed(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top'):
if tmp < len_words: rest_words
if tmp < len_words: rest_words += ' '
def drawstringframed(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top'):
import traceback traceback.print_exc()
def kill(self, signal=9): # killed already if not self.child: return
print String(_( 'ERROR' )) + ': ' + String(self.exit_type) + \ String(_( 'unknow error while playing file' ))
def stop_event(self): """ return the stop event send through the eventhandler """ if self.exit_type == "End of file": return PLAY_END elif self.exit_type == "Quit": return USER_END else: print String(_( 'ERROR' )) + ': ' + String(self.exit_type) + \ String(_( 'unknow error while playing file' )) return PLAY_END
mp3Match = re.compile(".*\.mp3$");
mp3Match = re.compile(".*\.[Mm][Pp]3$");
def __init__(self, fileName, tagVersion = ID3_ANY): self.playTime = None; self.fileName = fileName; mp3Match = re.compile(".*\.mp3$");
data = re.search( "^MPlayer (?P<version>\S+)", data ) if data:
res = re.search( "^MPlayer (?P<version>\S+)", data ) if res: data = res
def __init__(self): mplayer_version = 0
command = '%s -vo null -ao %s %s %s' % \
command = '%s -vo null -ao %s %s' % \
def play(self, item, player): """ Play a AudioItem with mplayer """ filename = item.filename
elif type != 'games':
elif type == 'games': abs = [] for d in x: pos = d[1].find(':') if pos == -1: abs.append((d[0], os.path.abspath(d[1]), d[2])) else: if pos > d[1].find('/'): abs.append((d[0], os.path.abspath(d[1]), d[2])) else: abs.append((d[0], d[1][0:pos+1] + os.path.abspath(d[1][pos+1:]), d[2])) exec ('%s = abs' % n) else:
def _debug_function_(s, level=1): if DEBUG < level: return # add the current trace to the string where = traceback.extract_stack(limit = 2)[0] if isinstance( s, unicode ): s = s.encode(encoding, 'replace') s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s) # print debug message print s
Call a function later from the mail loop. If a function is added more
Call a function later from the main loop. If a function is added more
def call_later(*args, **kwargs): """ Call a function later from the mail loop. If a function is added more than once, the timer will be removed and reset. The callback will only be called once and removed after that. Usage: [ timer ] [ name ] function [ args ] If timer is given, the callback will be called from the ma...
(status, me) = getFavorite(favname)
(status, me) = self.getFavorite(favname)
def adjustPriority(self, favname, mod=0): save = [] mod = int(mod) (status, me) = getFavorite(favname) oldprio = int(me.priority) newprio = oldprio + mod _debug_('ap: mod=%s\n' % mod) sr = self.getScheduledRecordings() favs = sr.getFavorites().values() sys.stderr.write('adjusting prio of '+favname+'\n') for fav in f...
items += [ menu.MenuItem("play chapter %s" % c, play_movie,
items += [ menu.MenuItem("play chapter %s" % c, chapter_selection,
def chapter_selection_menu(arg=None, menuw=None): items = [] for c in range(1, arg.available_chapters+1): items += [ menu.MenuItem("play chapter %s" % c, play_movie, (arg, ' -chapter %s' % c)) ] moviemenu = menu.Menu('CHAPTER MENU', items) menuw.pushmenu(moviemenu)
if image != None:
if image:
def DrawMenu(self, menuw): osd.clearscreen(osd.COL_WHITE)
conf.norm = a
conf.tv = a
def main(): # Default opts # XXX Make this OO and also use the Optik lib conf = Struct() conf.geometry = '800x600' conf.display = 'x11' conf.tv = 'ntsc' conf.chanlist = 'us-cable' # Parse commandline options try: long_opts = 'help geometry= display= tv= chanlist='.split() opts, args = getopt.getopt(sys.argv[1:], 'h',...
print 'Couldnt load font "%s"' % filename
_debug_('Couldnt load font "%s"' % filename)
def __getfont__(self, filename, ptsize): ptsize = int(ptsize / 0.7) # XXX pygame multiplies by 0.7 for some reason
print 'trying alternate: %s' % alt_fname
_debug_('trying alternate: %s' % alt_fname)
def __getfont__(self, filename, ptsize): ptsize = int(ptsize / 0.7) # XXX pygame multiplies by 0.7 for some reason
print 'Deleting %s' % self.filename
print 'Deleting %s' % self.item.filename
def delete_file(self): if config.DEBUG: print 'Deleting %s' % self.filename
rc.app(self) command = self.command
def play(self, item): """ play a dvd with xine """
font = self.__loadfont__(fname.replace('_bold', 'bd'), ptsize) if font: break
def __getfont__(self, filename, ptsize): ptsize = int(ptsize / 0.7) # XXX pygame multiplies by 0.7 for some reason
(self.cols > 1 or config.NEW_SKIN):
(self.cols > 1 or config.NEW_SKIN) and \ menu.selected != menu.choices[0]:
def eventhandler(self, event): menu = self.menustack[-1]
pass
info = {}
def cache_dir(self, directory, callback): """ cache every file in the directory for future use """ if not self.__need_update__(directory): return 0
last_tvs = ('', 0) all_tvs = True
last_tvs = ('', 0) all_tvs = True tvs_shortname = True
def update_content(self): """ update the listing area """
for c in menuw.menu_items:
for c in menu.choices:
def update_content(self): """ update the listing area """
if all_tvs and choice.image:
if all_tvs and not tvs_shortname and len(menu.choices) > 5: tvs_shortname = True if all_tvs and tvs_shortname:
def update_content(self): """ update the listing area """
if all_tvs and choice.image:
if all_tvs and tvs_shortname:
def update_content(self): """ update the listing area """
print cachefile
def comingup(items): # XXX We should cache this information and update it hourly/daily # import tv.record_client as ri import time result = '' cachefile = '%s/upsoon' % (config.FREEVO_CACHEDIR) print cachefile if (os.path.exists(cachefile) and \ (abs(time.time() - os.path.getmtime(cachefile)) < 3600)): cache = open(c...
if s1.replace(' ', '').lower() == s2.replace(' ', '').lower():
if s1.replace(u' ', u'').lower() == s2.replace(u' ', u'').lower():
def strcmp(self, s1, s2): s1 = Unicode(s1) s2 = Unicode(s2) if not s1 or not s2: return s1 or s2 if s1 == various or s2 == various: return various
new.display_type = old.display_type
if hasattr(old, 'display_type'): new.display_type = old.display_type
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 new.display_type = old.display_type menuw.menustack[-1].choices[pos] = new menu...
self.zoom_btns = { em.IMAGE_NO_ZOOM.name:0, em.IMAGE_ZOOM_GRID1.name:1, em.IMAGE_ZOOM_GRID2.name:2, em.IMAGE_ZOOM_GRID3.name:3, em.IMAGE_ZOOM_GRID4.name:4, em.IMAGE_ZOOM_GRID5.name:5, em.IMAGE_ZOOM_GRID6.name:6, em.IMAGE_ZOOM_GRID7.name:7, em.IMAGE_ZOOM_GRID8.name:8, em.IMAGE_ZOOM_GRID9.name:9 }
self.zoom_btns = { str(em.IMAGE_NO_ZOOM):0, str(em.IMAGE_ZOOM_GRID1):1, str(em.IMAGE_ZOOM_GRID2):2, str(em.IMAGE_ZOOM_GRID3):3, str(em.IMAGE_ZOOM_GRID4):4, str(em.IMAGE_ZOOM_GRID5):5, str(em.IMAGE_ZOOM_GRID6):6, str(em.IMAGE_ZOOM_GRID7):7, str(em.IMAGE_ZOOM_GRID8):8, str(em.IMAGE_ZOOM_GRID9):9 }
def __init__(self): GUIObject.__init__(self) self.osd_mode = 0 # Draw file info on the image self.zoom = 0 # Image zoom self.zoom_btns = { em.IMAGE_NO_ZOOM.name:0, em.IMAGE_ZOOM_GRID1.name:1, em.IMAGE_ZOOM_GRID2.name:2, em.IMAGE_ZOOM_GRID3.name:3, em.IMAGE_ZOOM_GRID4.name:4, em.IMAGE_ZOOM_GRID5.name:5, em.IMAGE_ZO...
elif event in self.zoom_btns: self.zoom = self.zoom_btns[event]
elif str(event) in self.zoom_btns: self.zoom = self.zoom_btns[str(event)]
def eventhandler(self, event): #if event == rc.SELECT and self.alertbox: # self.alertbox.destroy() # self.alertbox = None # return TRUE if event == em.PAUSE or event == em.PLAY: if self.slideshow: self.slideshow = FALSE signal.alarm(0) else: self.slideshow = TRUE signal.alarm(1) return TRUE elif event == em....
words[word_number] = ' '
words[word_number] = plain_tab
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='...'):
char_size, char_height = self.charsize(char, font, ptsize) if ((occupied_size + char_size) <= width) and (char != '\n'):
char_size, char_height = self.stringsize(char, font, ptsize) if ((occupied_size + char_size) < width) and (char != '\n'):
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
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', layer=None, ellipses='...'):
if (occupied_size + ellipses_size) <= width:
if (occupied_size + ellipses_size) < width:
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
while ellipses and ellipses_size >= width: ellipses = ellipses[:-1] ellipses_size = self.stringsize(ellipses, font, ptsize)[0]
while ellipses and \ (occupied_size + self.stringsize(ellipses, font, ptsize)[0]) \ >= width: ellipses = ellipses[:-1]
def drawstringframedhard(self, string, x, y, width, height, fgcolor=None, bgcolor=None, font=None, ptsize=0, align_h='left', align_v='top', layer=None, ellipses='...'):
start_time = self.last_start_time - 60 * col_time
if self.last_start_time: start_time = self.last_start_time else: t = list(time.localtime()) t[4] = t[5] = 0 start_time = int(time.mktime(t))
def update(self): """ update the listing area """ menu = self.menu settings = self.settings