rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
for ch in guide.chan_list: for prog in ch.programs:
for ch in get_channels().get_all(): for prog in ch.epg.programs:
def when_listings_expire(): guide = get_guide() last = 0 left = 0 for ch in guide.chan_list: for prog in ch.programs: if prog.start > last: last = prog.start if last > 0: now = time.time() if last > now: left = int(last - now) # convert to hours left /= 3600 return left
_cached_guide = None def get_guide(): global _cached_guide source = config.XMLTV_FILE pickle = os.path.join(config.FREEVO_CACHEDIR, 'epg') if(_cached_guide == None or (os.path.isfile(source) and _cached_guide.timestamp != os.path.getmtime(source))): got_cached_guide = False if (os.path.isfile(source) and os.path.is...
def when_listings_expire(): guide = get_guide() last = 0 left = 0 for ch in guide.chan_list: for prog in ch.programs: if prog.start > last: last = prog.start if last > 0: now = time.time() if last > now: left = int(last - now) # convert to hours left /= 3600 return left
osd.drawroundbox(0, 0, osd.width, osd.y + 60, (0x80000000, 0, 0, 0))
osd.drawroundbox(0, 0, osd.width + 2 * osd.x, osd.y + 60, (0x80000000, 0, 0, 0))
def draw(self, (type, object), osd): osd.drawroundbox(0, 0, osd.width, osd.y + 60, (0x80000000, 0, 0, 0)) if not self.plugins: self.plugins = plugin.get('idlebar') x = osd.x + 10 for p in self.plugins: add_x = p.draw((type, object), x, osd) if add_x: x += add_x + 20
if len(self.chan_dict[program.channel_id].programs) and \ self.chan_dict[program.channel_id].programs[-1].stop > program.start:
p = self.chan_dict[program.channel_id].programs if len(p) and p[-1].start < program.stop and p[-1].stop > program.start:
def AddProgram(self, program): # The channel must be present, or the program is # silently dropped if self.chan_dict.has_key(program.channel_id): if len(self.chan_dict[program.channel_id].programs) and \ self.chan_dict[program.channel_id].programs[-1].stop > program.start: # the tv guide is corrupt, the last entry has ...
movies = parse_disc_set(freevo_child, file, parent, duplicate_check)
movies += parse_disc_set(freevo_child, file, parent, duplicate_check)
def parseMovieFile(file, parent=None, duplicate_check=[]): """ parse a XML movie file Returns: a list of VideoItems, each VideoItem possibly contains a list of VideoItems """ try: movies = [] parser = qp_xml.Parser() # Let's name node variables after their XML names f = open(file) freevo = parser.parse(f.read()) f.cl...
movies = parse_movie(freevo_child, file, parent, duplicate_check)
movies += parse_movie(freevo_child, file, parent, duplicate_check)
def parseMovieFile(file, parent=None, duplicate_check=[]): """ parse a XML movie file Returns: a list of VideoItems, each VideoItem possibly contains a list of VideoItems """ try: movies = [] parser = qp_xml.Parser() # Let's name node variables after their XML names f = open(file) freevo = parser.parse(f.read()) f.cl...
self.lirc.connect('/dev/lircd')
while 1: try: self.lirc.connect('/dev/lircd') break except: print "Couldn't open /dev/lircd, trying again in 10 seconds..." time.sleep(10)
def __init__(self): self.lirc = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
if attr == 'runtime': length = None if self.info['runtime'] and self.info['runtime'] != 'None': length = self.info['runtime'] elif self.info['length'] and self.info['length'] != 'None': length = self.info['length'] if not length and hasattr(self, 'length'): length = self.length if not length: return '' if isinstance(...
def __getitem__(self, attr): """ return the specific attribute """ if attr == 'runtime': length = None
rating -= 5 * (len(scan(d.rec, True)) - len(scan(d.rec, False)))
rating += rate_conflict(scan(d.rec, True)) - \ rate_conflict(scan(d.rec, False))
def rate(devices, best_rating): rating = 0 for d in devices[:-1]: for r in d.rec: rating += r.priority * d.rating # overlapping padding gives minus points rating -= 5 * (len(scan(d.rec, True)) - len(scan(d.rec, False))) if rating > best_rating: # remember best_rating = rating for d in devices[:-1]: for r in d.rec: if ...
AlertBox(text=error).show() rc.post_event(PLAY_END)
AlertBox(text=error, handler=self.error_handler).show() def error_handler(self): """ error handler if play doesn't work to send the end event and stop the player """ rc.post_event(PLAY_END) self.stop()
def play(self, arg=None, menuw=None): """ play the item. """ if not self.possible_player: for p in plugin.getbyname(plugin.VIDEO_PLAYER, True): rating = p.rate(self) * 10 if config.VIDEO_PREFERED_PLAYER == p.name: rating += 1 if hasattr(self, 'force_player') and p.name == self.force_player: rating += 100 self.possible_...
self.cached = False
self.locked = False
def __init__(self, mountdir='', devicename='', drivename=''): # This is read-only stuff for the drive itself vfs.Mountpoint.__init__(self, mountdir, devicename, 'empty_cdrom') self.drivename = drivename rom_drives.append(self) # Dynamic stuff self.tray_open = 0 self.drive_status = None # return code from ioctl for DR...
print 2
def move_tray(self, dir='toggle', notify=1): """ Move the tray. dir can be toggle/open/close """ if dir == 'toggle': if self.is_tray_open(): dir = 'close' else: dir = 'open'
def mount(self): """ Mount the media """ log.debug('Mounting disc in drive %s' % self.drivename) util.mount(self.mountdir, force=True) return def umount(self): """ Mount the media """ log.debug('Unmounting disc in drive %s' % self.drivename) util.umount(self.mountdir) return def is_mounted(self): """ Check if the m...
def check_status(self): """ Return True if the status has changed (new disc / removed disc).
def mount(self): """ Mount the media """ log.debug('Mounting disc in drive %s' % self.drivename) util.mount(self.mountdir, force=True) return
fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK)
fd = os.open(self.devicename, os.O_RDONLY | os.O_NONBLOCK)
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
media.drive_status = None return
self.drive_status = None return False
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
if s == media.drive_status:
if s == self.drive_status:
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
return media.drive_status = s media.set_id('') media.label = '' media.type = 'empty_cdrom' media.item = None media.videoitem = None media.cached = False
return False self.drive_status = s self.set_id('') self.label = '' self.type = 'empty_cdrom' self.item = None self.videoitem = None
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
return
return False
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
media.tray_open = False disc_info = util.fthread.call(mediadb.get, media) if not disc_info: os.close(fd) return disc_info = disc_info if config.ROM_SPEED and disc_info and not \ disc_info['mime'] == 'video/dvd':
self.tray_open = False return True def scan(self): """ Scan the disc (running in a thread) """ self.info = mediadb.get(self) if config.ROM_SPEED and not self.info['mime'] == 'video/dvd': fd = os.open(self.devicename, os.O_RDONLY | os.O_NONBLOCK)
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
if disc_info and disc_info['mime'] == 'audio/cd':
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
return os.close(fd)
self.unlock_and_send_update(media)
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
util.mount(media.mountdir)
media.mount()
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
util.umount(media.mountdir)
media.umount()
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
return
self.unlock_and_send_update(media) return True
def identify(self, media): """ magic! Try to find out as much as possible about the disc in the rom drive: title, image, play options, ... """ # Check drive status (tray pos, disc ready) try: CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) ) fd = os.open(media.devicename, os.O_RDONLY | os.O_NONBLOCK) if os.uname()[0] == 'FreeBSD'...
self.identify(media)
if last_status == None: first_scan = True else: first_scan = False if media.check_status(): util.fthread.Thread(self.identify, media.scan).start() continue media.locked = False
def check_all(self): """ check all drives """ if not eventhandler.is_menu(): # Some app is running, do not scan, it's not necessary return
log.debug('MEDIA: Status=%s' % media.drive_status) log.debug('Posting IDENTIFY_MEDIA event') if last_status == None: eventhandler.post(plugin.event('IDENTIFY_MEDIA', arg=(media, True))) else: eventhandler.post(plugin.event('IDENTIFY_MEDIA', arg=(media, False)))
self.unlock_and_send_update(media)
def check_all(self): """ check all drives """ if not eventhandler.is_menu(): # Some app is running, do not scan, it's not necessary return
if not self.child:
if hasattr(self,'child'):
def kill(self, signal=15): global __all_childapps__
regexp_plot = re.compile('.*<B CLASS="ch">Plot Outline.*?</B>(.*?)<', re.I)
regexp_plot1 = re.compile('.*<B CLASS="ch">Plot Outline.*?</B>(.*?)<', re.I) regexp_plot2 = re.compile('.*<B CLASS="ch">Plot Summary.*?</B>(.*?)<', re.I)
def get_data(id): """ get imdb data about the movie with the given id """ title = '' info = {} for t in imdb_info_tags: info[t] = "" image_urls = [] dvd = 0 regexp_title = re.compile('.*STRONG CLASS="title">(.*?)<', re.I) regexp_year = re.compile('.*<A HREF="/Sections/Years/.*?([0-9]*)<', re.I) regexp_genre ...
m = regexp_tagline.match(line)
m = regexp_tagline.match('%s<' % line)
def get_data(id): """ get imdb data about the movie with the given id """ title = '' info = {} for t in imdb_info_tags: info[t] = "" image_urls = [] dvd = 0 regexp_title = re.compile('.*STRONG CLASS="title">(.*?)<', re.I) regexp_year = re.compile('.*<A HREF="/Sections/Years/.*?([0-9]*)<', re.I) regexp_genre ...
m = regexp_plot.match(line)
m = regexp_plot1.match('%s<' % line) if m: info['plot'] = str2XML(re.compile('[\t ]+').sub(" ", ' ' + m.group(1))[1:]) m = regexp_plot2.match('%s<' % line)
def get_data(id): """ get imdb data about the movie with the given id """ title = '' info = {} for t in imdb_info_tags: info[t] = "" image_urls = [] dvd = 0 regexp_title = re.compile('.*STRONG CLASS="title">(.*?)<', re.I) regexp_year = re.compile('.*<A HREF="/Sections/Years/.*?([0-9]*)<', re.I) regexp_genre ...
" Please visit http://www.imdb.com for more informations.\n" +
" Please visit http://www.imdb.com for more informations.\n") i.write(" <source url=\"http://www.imdb.com/Title?%s\"/>\n" % imdb_number +
def write_fxd(imdb_number, filename, drive, image_url, type, files, cdid, imdb_data): """ write the infos to the xml file """ title, info, None = imdb_data i = codecs.open('%s.fxd' % filename, 'w', encoding='utf-8') i.write("<?xml version=\"1.0\" ?>\n<freevo>\n") i.write(" <copyright>\n" + " The information in th...
print popup
def __init__(self, name, action=None, arg=None, icon=None, scale=1,popup=0): self.name = name self.action = action self.arg = arg
c.displayname = id.split()[1] c.tunerid = id.split()[0]
if ' ' in id: c.displayname = id.split()[1] c.tunerid = id.split()[0] else: c.displayname = '%s REPLACE WITH CHANNEL NAME' % id c.tunerid = '%s REPLACE WITH TUNERID' % id
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...
def play(self, arg=None, menuw=None):
def play(self, arg=None, menuw=None, alternateplayer=False):
def play(self, arg=None, menuw=None): """ play the item. """ if not self.possible_player: for p in plugin.getbyname(plugin.VIDEO_PLAYER, True): rating = p.rate(self) * 10 if config.VIDEO_PREFERED_PLAYER == p.name: rating += 1 if hasattr(self, 'force_player') and p.name == self.force_player: rating += 100 self.possible_...
self.view(self.filename, self.number, self.mode, self.playlist, zoom=self.zoom, rotation = self.rotation)
self.view(self.filename, self.number, self.playlist, self.mode, zoom=self.zoom, rotation = self.rotation)
def eventhandler(self, event):
self.progressbar = Progressbar(full=full, width=self.width-20)
self.progressbar = Progressbar(full=full, width=self.content.width-20)
def __init__(self, text, x=None, y=None, width=0, height=0, icon=None, vertical_expansion=1, text_prop=None, full=0, parent='osd'):
tw = self.font.font.stringsize(text) + self.h_margin*2
print text tw = self.font.stringsize(text) + self.h_margin*2
def __init__(self, parent='osd', text=' ', handler=None, left=None, top=None, width=0, height=0, bg_color=None, fg_color=None, icon=None, border=None, bd_color=None, bd_width=None, vertical_expansion=1, text_prop=None):
if self.disable: return
def __init__( self ): """ init the lcd """ plugin.DaemonPlugin.__init__( self ) try: self.lcd = pylcd.client() cm = self.lcd.connect() except: print "ERROR: LCD plugin will not load! " + \ "Maybe you don't have LCDd (lcdproc daemon) running?" self.disable = 1 return if DEBUG > 0: print "Connecting to LCD: %s" % cm pri...
self.screens = screens = layouts[ l ][ c ]
try: self.screens = screens = layouts[ l ][ c ] except KeyError: if DEBUG > 0: print "WARNING: Could not find screens for %d lines and %d columns LCD!" % ( self.height, self.width ) print "ERROR: No screens found!" self.disable = 1 return
def generate_screens( self ): screens = None l = self.height c = self.width # Find a screen # find a display with 'l' lines while not screens: try: screens = layouts[ l ] except KeyError: if DEBUG > 0: print "WARNING: Could not find screens for %d lines LCD!" % l l -= 1 if l < 1: print "ERROR: No screens found!" self.d...
self.cpu = self.sensor(case, '@', self.hotstack)
self.case = self.sensor(case, '@', self.hotstack)
def __init__(self, cpu='temp3', case='temp2' , ram='MemTotal'): IdleBarPlugin.__init__(self) self.hotstack = 0 self.case = None if isinstance (cpu,types.StringType): self.cpu = self.sensor(cpu, '@', self.hotstack) else: self.cpu = self.sensor(cpu[0], cpu[1], self.hotstack) if case: if isinstance (case,types.StringT...
self.cpu = self.sensor(case[0], case[1], self.hotstack)
self.case = self.sensor(case[0], case[1], self.hotstack)
def __init__(self, cpu='temp3', case='temp2' , ram='MemTotal'): IdleBarPlugin.__init__(self) self.hotstack = 0 self.case = None if isinstance (cpu,types.StringType): self.cpu = self.sensor(cpu, '@', self.hotstack) else: self.cpu = self.sensor(cpu[0], cpu[1], self.hotstack) if case: if isinstance (case,types.StringT...
_debug_('Deleting %s' % self.item.url)
def delete_file(self): _debug_('Deleting %s' % self.item.url) self.item.files.delete() if self.menuw: self.menuw.back_one_menu(arg='reload')
_debug_('Deleting info for %s' % self.item.url)
def delete_info(self): _debug_('Deleting info for %s' % self.item.url) self.safe_unlink(self.item.files.image) self.safe_unlink(self.item.files.fxd_file) if self.menuw: self.menuw.back_one_menu(arg='reload')
self.display_type = [ 'image' ]
self.display_type = [ 'games' ]
def __init__(self): plugin.MimetypePlugin.__init__(self) self.display_type = [ 'image' ]
plugin.activate('mediamenu', level=plugin.is_active('image')[2], args='image')
plugin.activate('mediamenu', level=plugin.is_active('games')[2], args='games')
def __init__(self): plugin.MimetypePlugin.__init__(self) self.display_type = [ 'image' ]
curr_selected = self.all_items.index(menu.selected)
curr_selected+=self.cols
def eventhandler(self, event): menu = self.menustack[-1]
(self.cols > 1 or config.NEW_SKIN):
(self.cols > 1 or config.NEW_SKIN) and \ menu.page_start + len(self.all_items) < len(menu.choices):
def eventhandler(self, event): menu = self.menustack[-1]
curr_selected = self.all_items.index(menu.selected)
curr_selected-=self.cols
def eventhandler(self, event): menu = self.menustack[-1]
if not self.name or self.name == '\0':
if not self.name:
def set_url(self, url, info=True, search_image=True): """ Set a new url to the item and adjust all attributes depending on the url. """ self.network_play = True # network url, like http self.url = url # the url itself self.filename = '' # filename if it's a file:// url
self.player = None
def __init__(self): plugin.MainMenuPlugin.__init__(self) config.EVENTS['audio']['DISPLAY'] = Event(FUNCTION_CALL, arg=self.detach) self.player = None self.show_item = menu.MenuItem(_('Show player'), action=self.show)
gui = plugin.getbyname(plugin.AUDIO_PLAYER).playerGUI
gui = audio.player.get()
def detach(self): gui = plugin.getbyname(plugin.AUDIO_PLAYER).playerGUI
self.player = gui.player
def detach(self): gui = plugin.getbyname(plugin.AUDIO_PLAYER).playerGUI
if self.player and self.player.is_playing():
gui = audio.player.get() if gui and gui.player.is_playing():
def items(self, parent): if self.player and self.player.is_playing(): self.show_item.parent = parent return [ self.show_item ] return ()
return ()
return []
def items(self, parent): if self.player and self.player.is_playing(): self.show_item.parent = parent return [ self.show_item ] return ()
gui = self.player.playerGUI
gui = audio.player.get()
def show(self, arg=None, menuw=None): gui = self.player.playerGUI
if config.DEBUG > 1: o.bg_image = o.bg_surface.convert() iname = '/tmp/bg1-%s.bmp' % xx pygame.image.save( o.bg_image, iname )
def update_show(self, object): """ Updates all affected objects when there is a show. Notify objects above the calling object to do a redraw. Does anyone have a better idea for a name for this function? """
if DEBUG > 0: where = traceback.extract_stack(limit = 2)[0] s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s) if DEBUG >= level: print s elif DEBUG == 0 and level == 1: if isinstance(sys.stderr, Logger): sys.stderr.log(s+'\n')
if DEBUG < level: return where = traceback.extract_stack(limit = 2)[0] s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s) print s
def _debug_function_(s, level=1): if DEBUG > 0: # add the current trace to the string where = traceback.extract_stack(limit = 2)[0] s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s) if DEBUG >= level: print s elif DEBUG == 0 and level == 1: if isinstance(sys.stderr, Logger): sys.stderr.log(s+'\n')
print "Render failed, skipping..."
print 'Render failed, skipping \'%s\'...' % l
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...
if not self.osd_timer.active():
if not self.osd_timer.active() and self.area_handler:
def eventhandler(self, event): """ eventhandler for mplayer control. If an event is not bound in this function it will be passed over to the items eventhandler """ mplayer.Application.eventhandler(self, event)
debug_name = app[:app.find(' ')]
def __init__(self, app): global __all_childapps__ __all_childapps__.append(self)
self.t1 = Read_Thread('stdout', self.outfile, self.stdout_cb)
self.t1 = Read_Thread('stdout', self.outfile, self.stdout_cb, debug_name)
def __init__(self, app): global __all_childapps__ __all_childapps__.append(self)
self.t2 = Read_Thread('stderr', self.errfile, self.stderr_cb)
self.t2 = Read_Thread('stderr', self.errfile, self.stderr_cb, debug_name)
def __init__(self, app): global __all_childapps__ __all_childapps__.append(self)
def __init__(self, name, fp, callback):
def __init__(self, name, fp, callback, logger=None):
def __init__(self, name, fp, callback): threading.Thread.__init__(self) self.name = name self.fp = fp self.callback = callback
self.logger = None if logger and config.CHILDAPP_DEBUG: logger = os.path.join(config.LOGDIR, '%s-%s.log' % (logger, name)) try: try: os.unlink(logger) except: pass self.logger = open(logger, 'w') print _( 'logging child to "%s"' ) % logger except IOError: print print _('ERROR') + ': ' + _( 'Cannot open "%s" for logging...
def __init__(self, name, fp, callback): threading.Thread.__init__(self) self.name = name self.fp = fp self.callback = callback
pos = self.playlist.index(self.filename) last_file = (pos == len(self.playlist)-1) if self.playlist == [] or (last_file and not self.repeat):
if self.playlist == []:
def eventhandler(self, event): if event == rc.STOP or event == rc.SELECT: if self.mode == 'dvdnav': self.thread.app.write('S') else: self.stop() rc.app = None menuwidget.refresh() elif event == rc.MENU: self.thread.app.write('M') elif event == rc.DISPLAY: self.thread.cmd('info') elif event == rc.PAUSE or event == rc.PL...
pos = (pos+1) % len(self.playlist) filename = self.playlist[pos] self.play(self.mode, filename, self.playlist)
pos = self.playlist.index(self.filename) last_file = (pos == len(self.playlist)-1) if self.playlist == [] or (last_file and not self.repeat): rc.app = None menuwidget.refresh() else: pos = (pos+1) % len(self.playlist) filename = self.playlist[pos] self.play(self.mode, filename, self.playlist)
def eventhandler(self, event): if event == rc.STOP or event == rc.SELECT: if self.mode == 'dvdnav': self.thread.app.write('S') else: self.stop() rc.app = None menuwidget.refresh() elif event == rc.MENU: self.thread.app.write('M') elif event == rc.DISPLAY: self.thread.cmd('info') elif event == rc.PAUSE or event == rc.PL...
if DEBUG: sys.stdout.write('.') sys.stdout.flush()
def main(): global data global save_file global URL record_forever = False if len(sys.argv) < 3: print 'Usage: url_record <URL> <save file> <seconds to record>' print ' If <seconds to record> is ommitted it will record ' print ' until interrupted.' sys.exit(0) URL = sys.argv[1] SAVE_FILE = sys.argv[2] try...
if DEBUG: print
def finish(signum=None, frame=None): global data global save_file global URL if DEBUG: print print 'Finished recording %s with signal %s.' % (URL, signum) data.close() save_file.close() sys.exit(0)
if prog.start <= now and prog.stop >= now and recording:
if recording:
def removeScheduledRecording(self, prog=None): if not prog: return (FALSE, 'no prog')
scheduledRecordings = self.getScheduledRecordings() progs = scheduledRecordings.getProgramList() now = time.time()
delay_recording = FALSE total_padding = 0 sr = self.getScheduledRecordings() progs = sr.getProgramList() currently_recording = None
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None scheduledRecordings = self.getScheduledRecordings()
if DEBUG: log.debug('checkToRecord: progloop = %s' % prog)
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None scheduledRecordings = self.getScheduledRecordings()
if prog.start <= now and prog.stop >= now and recording == FALSE:
if recording: currently_recording = prog now = time.time() for prog in progs.values(): if DEBUG: log.debug('checkToRecord: progloop = %s' % prog) try: recording = prog.isRecording except: recording = FALSE if (prog.start - config.RECORD_PADDING) <= now \ and (prog.stop + config.RECORD_PADDING) >= now \ and recording...
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None scheduledRecordings = self.getScheduledRecordings()
duration = int(prog.stop - now - 10)
duration = int((prog.stop + config.RECORD_PADDING ) - now - 10)
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None scheduledRecordings = self.getScheduledRecordings()
if DEBUG: log.debug('going to record: %s' % prog) prog.isRecording = TRUE prog.rec_duration = duration prog.filename = tv_util.getProgFilename(prog) rec_prog = prog
if currently_recording: if prog.start - 10 <= now: sr.removeProgram(currently_recording, tv_util.getKey(currently_recording)) plugin.getbyname('RECORD').Stop() time.sleep(5) log.debug('CALLED RECORD STOP 1') else: if currently_recording.stop - 10 <= now: overlap = (currently_recording.stop + \ config.RECORD_PADD...
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None scheduledRecordings = self.getScheduledRecordings()
if prog.stop < now:
if ( prog.stop + config.RECORD_PADDING) < now:
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None scheduledRecordings = self.getScheduledRecordings()
scheduledRecordings.setProgramList(progs) self.saveScheduledRecordings(scheduledRecordings)
sr.setProgramList(progs) self.saveScheduledRecordings(sr)
def checkToRecord(self): if DEBUG: log.debug('in checkToRecord') rec_cmd = None rec_prog = None cleaned = None scheduledRecordings = self.getScheduledRecordings()
try: ret = [] for r in self.recordings: ret.append(r.short_list()) for c in self.clients: print 'send update', c self.mbus_instance.send_event(c, 'record.list.update', ret) except: log.exception('send_update')
ret = [] for r in self.recordings: ret.append(r.short_list()) for c in self.clients: print 'send update', c self.mbus_instance.send_event(c, 'record.list.update', ret)
def send_update(self): # send and updated list to the clients try: ret = [] for r in self.recordings: ret.append(r.short_list()) for c in self.clients: print 'send update', c self.mbus_instance.send_event(c, 'record.list.update', ret) except: log.exception('send_update')
self.client.remove(entity)
self.clients.remove(entity)
def __entity_update(self, entity): if not entity.present and entity in self.clients: log.info('lost client %s' % entity) self.client.remove(entity)
cmd = ('%s -ao null -nolirc -vo null -frames 0 -dvd 1 ' + '1> /dev/null 2> /tmp/mplayer_dvd.log') os.system((cmd % config.MPLAYER_CMD) + ' ; touch /tmp/mplayer_dvd_done')
cmd = ('%s -ao null -nolirc -vo null -frames 0 -dvd 1 -cdrom-device %s ' + '1 2>&1 > /tmp/mplayer_dvd.log') print cmd % (config.MPLAYER_CMD, media.devicename) os.system((cmd % (config.MPLAYER_CMD, media.devicename)) + ' ; touch /tmp/mplayer_dvd_done')
def dvd_menu_generate(media, menuw): # Figure out the number of titles on this disc osd.popup_box('Scanning DVD, be patient...') osd.update() os.system('rm /tmp/mplayer_dvd.log /tmp/mplayer_dvd_done') # XXX Add an option for DVD device to use in case theres more than one! cmd = ('%s -ao null -nolirc -vo null -frames 0...
m = menu.MenuItem('Play Title %s' % title, play_dvd, title,
m = menu.MenuItem('Play Title %s' % title, play_dvd, '%s -cdrom-device %s' % (title, media.devicename),
def dvd_menu_generate(media, menuw): # Figure out the number of titles on this disc osd.popup_box('Scanning DVD, be patient...') osd.update() os.system('rm /tmp/mplayer_dvd.log /tmp/mplayer_dvd_done') # XXX Add an option for DVD device to use in case theres more than one! cmd = ('%s -ao null -nolirc -vo null -frames 0...
label = media.info[2] moviemenu = menu.Menu('DVD Titles for disc %s' % label, items, umount_all = 1)
label = media.info[1] moviemenu = menu.Menu(label, items, umount_all = 1)
def dvd_menu_generate(media, menuw): # Figure out the number of titles on this disc osd.popup_box('Scanning DVD, be patient...') osd.update() os.system('rm /tmp/mplayer_dvd.log /tmp/mplayer_dvd_done') # XXX Add an option for DVD device to use in case theres more than one! cmd = ('%s -ao null -nolirc -vo null -frames 0...
re_automount = re.compile( '^none[ \t]+([^ \t]+) supermount dev=([^,]+)', re.I )
re_automount = re.compile( '^none[ \t]+([^ \t]+).*supermount.*dev=([^,]+).*', re.I )
def _debug_function_(s, level=1): if DEBUG < level: return # add the current trace to the string where = traceback.extract_stack(limit = 2)[0] s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s) # print debug message print s
try:
r = None if self.info and self.info.has_key(attr[4:-1]):
def __getitem__(self, attr): """ return the specific attribute as string or an empty string """ if attr == 'length': try: length = int(self.info['length']) except ValueError: return self.info['length'] except: try: length = int(self.length) except: return '' if length == 0: return '' if length / 3600: return '%d:%02d:%...
except: try: r = getattr(self,attr[4:-1]) except: return 0
if not r and hasattr(self, attr[4:-1]): r = getattr(self,attr[4:-1])
def __getitem__(self, attr): """ return the specific attribute as string or an empty string """ if attr == 'length': try: length = int(self.info['length']) except ValueError: return self.info['length'] except: try: length = int(self.length) except: return '' if length == 0: return '' if length / 3600: return '%d:%02d:%...
item.type in ( 'audio', 'image' )) and not item.media:
item.type in ( 'audio', 'image','playlist' )) and not item.media:
def actions(self, item): """ create list of possible actions """ items = [] if ((item.type == 'video' and item.mode == 'file') or \ item.type in ( 'audio', 'image' )) and not item.media: self.item = item items.append((self.confirm_delete, _('Delete file'), 'delete')) if item.type == 'video' and hasattr(item, 'fxd_file'...
def call(function, *args, **kargs):
def call(function, *args, **kwargs):
def call(function, *args, **kargs): """ Run function(*args, **kargs) in a thread and return the result. Keep the main loop alive during that time. """ thread = Thread(function, *args, **kargs) thread.start() while not thread.finished: # step notifier notifier.step() if thread.exception: raise thread.exception return th...
thread = Thread(function, *args, **kargs)
thread = Thread(function, *args, **kwargs)
def call(function, *args, **kargs): """ Run function(*args, **kargs) in a thread and return the result. Keep the main loop alive during that time. """ thread = Thread(function, *args, **kargs) thread.start() while not thread.finished: # step notifier notifier.step() if thread.exception: raise thread.exception return th...
def call_from_main(function, *args, **kargs):
def call_from_main(function, *args, **kwargs):
def call_from_main(function, *args, **kargs): """ Call a function from the main loop. The function isn't called when this function is called, it is called when the watcher in the main loop is called by the notifier. """ _lock.acquire() _callbacks.append(function, args, kwargs) _lock.release()
_callbacks.append(function, args, kwargs)
_callbacks.append((function, args, kwargs))
def call_from_main(function, *args, **kargs): """ Call a function from the main loop. The function isn't called when this function is called, it is called when the watcher in the main loop is called by the notifier. """ _lock.acquire() _callbacks.append(function, args, kwargs) _lock.release()
request.setHeader('Connection', 'close')
def render(self, request): username = request.getUser() password = request.getPassword()
self.res += '<script language="JavaScript" src="'+script+'" />\n'
self.res += '<script language="JavaScript" src="'+script+'"></script>\n'
def printHeader(self, title='unknown page', style=None, script=None): self.res += '<html><head>\n' self.res += '<title>'+title+'</title>\n' if style != None: self.res += '<link rel="stylesheet" href="styles/main.css" type="text/css" />\n' if script != None: self.res += '<script language="JavaScript" src="'+script+'" />...
for p in plugin.getbyname(plugin.TV, True):
tvp = plugin.getbyname(plugin.TV, True) if not tvp or len(tvp) == 0: return None for p in tvp:
def player(channel): for u in channel.uri: device, uri = u.split(':') # try all internal URIs for p in plugin.getbyname(plugin.TV, True): # FIXME: better handling for rate == 1 or 2 if p.rate(channel, device, uri): return p, device, uri return None
_debug_('handling event %s' % str(event), 1)
_debug_('handling event %s' % str(event), 2)
def handle(self, event=None): """ event handling function """ # search for events in the queue if not event and not len(self.queue): return
reload = menu.reload_func() if reload: self.menustack[-1] = reload
menu = self.menustack[-1] if menu.reload_func: reload = menu.reload_func() if reload: self.menustack[-1] = reload self.init_page()
def refresh(self, reload=0): if self.menustack[-1].umount_all == 1: for media in config.REMOVABLE_MEDIA: util.umount(media.mountdir)
def __init__(self, parent=None, text=" ", handler=None, default_choice=0,
def __init__(self, parent='osd', text=" ", handler=None, default_choice=0,
def __init__(self, parent=None, text=" ", handler=None, default_choice=0, left=None, top=None, width=300, height=110, bg_color=None, fg_color=None, icon=None, border=None, bd_color=None, bd_width=None):
if vfs.isfile(directory+'/folder.fxd'):
if vfs.isfile(self.folder_fxd):
def __init__(self, directory, parent, name = '', display_type = None, add_args = None, create_metainfo=True): self.autovars = [ ('num_dir_items', 0) ] Playlist.__init__(self, parent=parent, display_type=display_type) self.type = 'dir' self.menu = None
if self.menu.selected.image != self.watermark[4]:
if hasattr(self.menu.selected,'image') and self.menu.selected.image != self.watermark[4]:
def draw_background(self): """ draw the <background> of the area """ area = self.area_val
self.rect = None
def __init__(self): threading.Thread.__init__(self) self.setDaemon(1) self.mode_flag = threading.Event() threading.Thread.start(self) self.timer = 0 self.active = False self.icon = os.path.join(config.SHARE_DIR, 'icons/popup/popup_wait.png') self.lock = thread.allocate_lock()
screen.blit(osd.screen, (0,0), (x,y,width,height))
screen.blit(osd.screen, (0,0), self.rect)
def run(self): while (1): self.mode_flag.clear() self.mode_flag.wait() while self.active and self.timer > 0.01: self.timer -= 0.01 time.sleep(0.01) if self.active: self.lock.acquire() osd = get_singleton() image = osd.loadbitmap(self.icon) width = image.get_width() height = image.get_height() x = osd.width - config....
osd.update(stop_busyicon=False)
osd.update(rect=self.rect, stop_busyicon=False)
def run(self): while (1): self.mode_flag.clear() self.mode_flag.wait() while self.active and self.timer > 0.01: self.timer -= 0.01 time.sleep(0.01) if self.active: self.lock.acquire() osd = get_singleton() image = osd.loadbitmap(self.icon) width = image.get_width() height = image.get_height() x = osd.width - config....