rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
return cmds_sdl[event.key]
elif event.key == K_z: pygame.display.toggle_fullscreen() elif event.key == K_F10: pygame.image.save(self.screen, '/tmp/freevo_ss%s.bmp' % self._screenshotnum) self._screenshotnum += 1 elif event.key in cmds_sdl.keys(): if self._help: self._helpscreen() return cmds_sdl[event.key]
def _cb(self):
if DEBUG: print 'Entry: >%s<' % text
def DrawMenu_Selection(self, menuw, settings, x0, y0, width, height): val = settings menu = menuw.menustack[-1]
if DEBUG: print 'Entry (2): >%s<' % text
def DrawMenu_Selection(self, menuw, settings, x0, y0, width, height): val = settings menu = menuw.menustack[-1]
if name != 'freevo.pot':
if dirname.find('i18n') == -1 or (name.find('pot') == -1 and \ name.find('update.py') == -1):
def data_finder(result, dirname, names): files = [] for name in names: if os.path.isfile(os.path.join(dirname, name)): if name != 'freevo.pot': files.append(os.path.join(dirname, name)) if files and dirname.find('/CVS') == -1: result.append((dirname.replace('./share', 'share/freevo'). replace('./src/www', 'share/freev...
self.poll_interval = 300
self.poll_interval = 3000
def __init__(self): """ init the idlebar """ plugin.DaemonPlugin.__init__(self) plugin.register(self, 'idlebar') eventhandler.register(self, SCREEN_CONTENT_CHANGE) eventhandler.register(self, THEME_CHANGE) self.poll_interval = 300 self.poll_menu_only = False self.plugins = None self.visible = False self....
if (len(sys.argv) > 2) and ((sys.argv[2] == '-listing') or (sys.argv[2] == '-schedule')):
if (len(sys.argv) > 2) and ((sys.argv[1] == '-listing') or (sys.argv[1] == '-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 not rc.app():
if not rc.app() or not skin.get_singleton().force_redraw:
def eventhandler(self, event, menuw=None): """ catch OSD_MESSAGE and display it, return False, maybe someone else is watching for the event. """ if event == OSD_MESSAGE: self.poll_counter = 1 self.message = event.arg if not rc.app(): skin.get_singleton().redraw() elif hasattr(rc.app(), 'im_self') and hasattr(rc.app().i...
'vcd', 'dvd', None ]
'vcd', 'dvd', 'empty_cdrom' ]
def main_menu_generate(self): """ generate the items for the main menu. This is needed when first generating the menu and if something changes by pressing the EJECT button """ items = copy.copy(self.normal_items)
dirname = os.path.dirname(filename)
dirname = os.path.dirname(filename)[len(config.OVERLAY_DIR):]
def delete_old_files_2(): """ delete cachfiles/entries for files which don't exists anymore """ print 'deleting old cachefiles...............................', sys.__stdout__.flush() num = 0 for file in util.match_files_recursively(config.OVERLAY_DIR, ['raw']): if not vfs.isfile(file[len(config.OVERLAY_DIR):-4]): os.un...
util.save_pickle(self.tree, vfs.getoverlay(filename + '.raw'))
f = vfs.open(filename) self.tree = self.parse(f) f.close() if self.tree: util.save_pickle(self.tree, vfs.getoverlay(filename + '.raw'))
def save(self, filename=None): """ Save the tree """ if not filename: filename = self.filename if vfs.isfile(filename): vfs.unlink(filename) f = vfs.codecs_open(filename, 'w', encoding='utf-8') f.write('<?xml version="1.0" ?>\n') self._dump_recurse(f, self.tree) f.write('\n') f.close()
'chanlist=us-cable:width=640:height=480' % tuner_channel) command = ('../apps/mplayer -vo %s -fs %s' %
'chanlist=us-cable:width=640:height=480:outfmt=yuy2' % tuner_channel) command = ('../apps/mplayer -vo %s -fs %s -cache 3000' %
def Play(self, mode, tuner_channel=None):
from util.fxdimdb import FxdImdb, makeVideo
from util.fxdimdb import FxdImdb, makeVideo, str2XML
def create_fxd(self,rec_prog): from util.fxdimdb import FxdImdb, makeVideo fxd = FxdImdb() fxd.setFxdFile(config.TV_RECORD_DIR + '/' + rec_prog.filename) video = makeVideo('file', 'f1', os.path.basename(rec_prog.filename) + '.mpeg') fxd.setVideo(video) fxd.info['tagline'] = rec_prog.sub_title fxd.info['plot'] = rec_pro...
fxd.title = rec_prog.title
fxd.title = str2XML(rec_prog.title)
def create_fxd(self,rec_prog): from util.fxdimdb import FxdImdb, makeVideo fxd = FxdImdb() fxd.setFxdFile(config.TV_RECORD_DIR + '/' + rec_prog.filename) video = makeVideo('file', 'f1', os.path.basename(rec_prog.filename) + '.mpeg') fxd.setVideo(video) fxd.info['tagline'] = rec_prog.sub_title fxd.info['plot'] = rec_pro...
_debug_('Loading font "%s"' % filename)
_debug_('Loading font "%s"' % filename,2)
def __getfont__(self, filename, ptsize): ptsize = int(ptsize / 0.7) # XXX pygame multiplies by 0.7 for some reason
_debug_(self.sdl_driver)
_debug_('SDL Driver: %s' % (str(self.sdl_driver)),2)
def __init__(self): """ init the osd """ self.fullscreen = 0 # Keep track of fullscreen state self.app_list = []
filename_array = { 'progname': prog.title, 'title' : prog.sub_title }
filename_array = { 'progname': String(prog.title), 'title' : String(prog.sub_title) }
def getProgFilename(prog=None): if not prog: return 'ERROR: no prog' mask = config.TV_RECORDFILE_MASK # '%%m-%%d %%H:%%M %(progname)s - %(title)s' filename_array = { 'progname': prog.title, 'title' : prog.sub_title } filemask = mask % filename_array filemask = time.strftime(filemask, time.localtime(prog.start)) f...
if not config.VIDEO_ONLY_SCAN_DATADIR: if len(config.VIDEO_ITEMS) == 2: for name,dir in config.VIDEO_ITEMS: files += util.recursefolders(dir,1,'*.fxd',1)
discset = config.OVERLAY_DIR + '/disc-set' if os.path.isdir(discset): listing = Listing(discset) if listing.num_changes: listing.update() files += listing.match_suffix(['fxd'])
def update(): """ hash fxd movie files in some directories. This is used e.g. by the rom drive plugin, but also for a directory and a videoitem. """ global tv_shows global discset global fxd # import fxditem here, we may get in trouble doing it at the # beginning (maybe, maybe not). FIXME! import fxditem fxd['id'] ...
for info in fxditem.mimetype.parse(None, listing.match_suffix(['fxd']), [], display_type='video'): if info.type != 'video': continue k = os.path.splitext(os.path.basename(info.files.fxd_file))[0] tv_shows[k] = (info.image, info.info, info.mplayer_options, info.skin_fxd) if hasattr(info, '__fxd_rom_info__'): for fo in i...
files += listing.match_suffix(['fxd']) for info in fxditem.mimetype.parse(None, files, [], display_type='video'): if info.type != 'video': continue k = os.path.splitext(os.path.basename(info.files.fxd_file))[0] tv_shows[k] = (info.image, info.info, info.mplayer_options, info.skin_fxd) if hasattr(info, '__fxd_rom_info_...
def update(): """ hash fxd movie files in some directories. This is used e.g. by the rom drive plugin, but also for a directory and a videoitem. """ global tv_shows global discset global fxd # import fxditem here, we may get in trouble doing it at the # beginning (maybe, maybe not). FIXME! import fxditem fxd['id'] ...
eventhandler.post_event(Event(OSD_MESSAGE, arg=osd_message))
eventhandler.post(Event(OSD_MESSAGE, arg=osd_message))
def delete_submenu(self, refresh=True, reload=False, osd_message=''): """ Delete the last menu if it is a submenu. Also refresh or reload the new menu if the attributes are set to True. If osd_message is set, this message will be send if the current menu is no submenu """ if len(self.menustack) > 1 and self.menustack[-...
eventhandler.post_event(Event(OSD_MESSAGE, arg=msg))
eventhandler.post(Event(OSD_MESSAGE, arg=msg))
def eventhandler(self, event): """ Eventhandler for menu control """ menu = self.menustack[-1]
a(menu.selected, self)
a()
def eventhandler(self, event): """ Eventhandler for menu control """ menu = self.menustack[-1]
url = 'http://us.imdb.com/Tsearch?title=%s&restrict=Movies+and+TV' % name
url = 'http://us.imdb.com/Tsearch?title=%s&restrict=Movies+and+TV' % urllib.quote(name)
def search(name): """ search imdb title database for the given name """ results = [] url = 'http://us.imdb.com/Tsearch?title=%s&restrict=Movies+and+TV' % name req = urllib2.Request(url, txdata, txheaders) try: response = urllib2.urlopen(req) except urllib2.HTTPError, error: print error return results regexp_title =...
self.surface = pygame.Surface(self.get_size(), 0, 32)
self.surface = pygame.Surface(int(self.get_size()), 0, 32)
def _draw(self): """ The actual internal draw function.
if os.path.isfile(self.dir + '/.password'):
if os.path.isfile(self.dir + '/.password') and config.NEW_SKIN:
def cwd(self, arg=None, menuw=None): """ make a menu item for each file in the directory """ # are we on a ROM_DRIVE and have to mount it first? for media in config.REMOVABLE_MEDIA: if string.find(self.dir, media.mountdir) == 0: util.mount(self.dir) self.media = media
if image_x and val.items.x + val.items.width > image_x:
if image_x and val.items.x + val.items.width > image_x and \ val.items.x < image_x:
def DrawMenu(self, menuw): if self.hold: print 'skin.drawmenu() hold!' return osd.clearscreen(osd.COL_BLACK)
log.info('running %s' % self.binary)
def __init__( self, app, debugname = None): """ Init the child process 'app'. This can either be a string or a list of arguments (similar to popen2). If debugname is given, the stdout and stderr will also be written. To get the stdout and stderr, you need to inherit from this class and override stdout_cb and stderr_cb....
if self.__processes.has_key():
if self.__processes.has_key( proc ):
def remove( self, proc ): if self.__processes.has_key(): del self.__processes[ proc ]
if p in self.__processes:
if p in copy.copy(self.__processes):
def step( self ): remove_proc = [] for p in copy.copy( self.__processes ): try: if isinstance( p.child, popen2.Popen3 ): pid, status = os.waitpid( p.child.pid, os.WNOHANG ) else: pid, status = os.waitpid( p.pid, os.WNOHANG ) except OSError: remove_proc.append( p ) continue if not pid: continue log.info('DEAD CHILD: %s ...
del self.__processes[ p ]
self.remove( p )
def step( self ): remove_proc = [] for p in copy.copy( self.__processes ): try: if isinstance( p.child, popen2.Popen3 ): pid, status = os.waitpid( p.child.pid, os.WNOHANG ) else: pid, status = os.waitpid( p.pid, os.WNOHANG ) except OSError: remove_proc.append( p ) continue if not pid: continue log.info('DEAD CHILD: %s ...
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['runtime']))
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']))
def info_showdata(self, arg=None, menuw=None): """ show info for this item """
i.set_url(self.url + title, False)
i.set_url(self.url + str(title), False)
def dvd_vcd_title_menu(self, arg=None, menuw=None): """ Generate special menu for DVD/VCD/SVCD content """ if not self.menuw: self.menuw = menuw
if ((occupied_size + char_size) < width) and (char != '\n'):
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='...'):
>= width:
> 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='...'):
def __init__(self): TVPlayer.__init__(self, 'mplayer') def rate(self, channel, device, uri): """ for now, just handle ivtv """ log.info('MPlayer.rate(): channel=[%s] device=[%s] uri=[%s]' % (channel, device, uri)) if device.startswith('ivtv'): log.info('MPlayer.rate(): Returning 2: MPlayer handles this!') return 2 re...
def __init__(self): TVPlayer.__init__(self, 'mplayer') def rate(self, channel, device, uri): """ for now, just handle ivtv """ log.info('MPlayer.rate(): channel=[%s] device=[%s] uri=[%s]' % (channel, device, uri)) if device.startswith('ivtv'): log.info('MPlayer.rate(): Returning 2: MPlayer handles this!') return 2 re...
def __init__(self):
update = self.screen.subsurface(rect)
try: update = self.screen.subsurface(rect) except Exception, e: print e print rect, self.screen return
def update(self, rect=None): if not rect: if self.x0 > self.x1: return rect = self.x0, self.y0, self.x1 - self.x0, self.y1 - self.y0 self.x0, self.y0, self.x1, self.y1 = self.width, self.height, 0, 0 update = self.screen.subsurface(rect)
self._type = 'mplayer_video'
self._type = 'mplayer_video' self.status = 'waiting'
def __init__(self): """ normal plugin init, but sets _type to 'mplayer_video' """ print print 'Activating video.bmovl plugin' print 'Warning: this plugin is only an example and not working in any' print 'cases. If Freevo crashes, deactivate this plugin. Don\'t send' print 'bug reports for this plugin, we know it\'s bro...
if self.bmovl:
if self.bmovl and self.status == 'playing': self.status = 'waiting'
def stop(self): """ stop bmovl """ if self.bmovl: self.bmovl.close() self.bmovl = None
except:
except Exception, e:
def stdout(self, line): """ get information from mplayer stdout """ try: if line.find('SwScaler:') ==0 and line.find(' -> ') > 0 and \ line[line.find(' -> '):].find('x') > 0: width, height = line[line.find(' -> ')+4:].split('x') if self.height < int(height): self.width = int(width) self.height = int(height)
if not self.bmovl:
if not self.bmovl and self.status == 'playing' and self.height and self.width:
def elapsed(self, timer, update=True): """ update osd """ if not self.bmovl: self.bmovl = OSDbmovl(self.width, self.height) if self.osd_visible: start = self.start end = self.start + self.length
_debug_('%s: No data, stopping (pid %s)!' % (self.name, os.getpid()),2) self.fp.close() break
time.sleep(1) data = self.fp.readline(300) if not data: _debug_('%s: No data, stopping (pid %s)!' % (self.name, os.getpid()),2) self.fp.close() break
def _handle_input(self): saved = '' while 1:
from util import vfs import __builtin__ __builtin__.__dict__['vfs'] = vfs
def mkalldir(d): cd = '' for p in d.split('/'): cd = os.path.join(cd, p) if not os.path.isdir(cd): os.mkdir(cd)
self.menu = {}
self._menu = {}
def parse(self, freevo_type, scale, c_dir, copy_content): for node in freevo_type.children: if node.name == u'main': self._mainmenu.parse(node, scale, c_dir)
if record.client.server:
if record.client.recordings.server:
def _render(self, request): fv = HTMLResource() fv.printHeader(_('Welcome'), 'styles/main.css',selected=_('Home')) fv.res += '<div id="contentmain">\n' fv.res += '<br/><br/><h2>'+( _('Freevo Web Status as of %s') % \ time.strftime('%B %d ' + config.TV_TIMEFORMAT, time.localtime()) ) +'</h2>'
f = re.compile(r'&amp;
f = re.compile(r'&
def inttochar( match ): """Return the hex string for a decimal number""" f = re.compile(r'&amp;#(\d+);') k = f.sub(r'\1', match.group()) return chr(int(k))
s = replace(s,'&amp; p = re.compile(r'&amp;
s = replace(s,'& p = re.compile(r'&
def escape(s): """Replace special HTML chars""" s = replace(s,'&amp;#146;','\x27') p = re.compile(r'&amp;#(\d+);') s = p.sub(inttochar,s) s = replace(s,' &amp; ',' &amp;#38; ') return s
s = replace(s,' &amp; ',' &amp;
s = replace(s,' & ',' &
def escape(s): """Replace special HTML chars""" s = replace(s,'&amp;#146;','\x27') p = re.compile(r'&amp;#(\d+);') s = p.sub(inttochar,s) s = replace(s,' &amp; ',' &amp;#38; ') return s
for l in block: if state == 0: r = re.search("&lt;td class='tvnucontent' valign='top'&gt;(.+)\.(.+)&lt;/td&gt;",l) if r != None: self.start_h = r.group(1) self.start_m = r.group(2) state = 1
for l in block: if state == 0: r = re.search("<td class='tvnucontent' valign='top'>(.+)\.(.+)</td>",l) if r != None: self.start_h = r.group(1) self.start_m = r.group(2) state = 1
def __init__(self,block,line,today,tomorrow):
r = re.search("&lt;td class='tvnucontent' valign='top'&gt;(.+)\.(.+)&lt;/td&gt;",l) if r != None: self.end_h = r.group(1) self.end_m = r.group(2)
r = re.search("<td class='tvnucontent' valign='top'>(.+)\.(.+)</td>",l) if r != None: self.end_h = r.group(1) self.end_m = r.group(2)
def __init__(self,block,line,today,tomorrow):
r = re.search(".+ class=tvnu&gt;(.+)&lt;/a&gt;",l) if r != None: self.title = escape(r.group(1)) state = 3
r = re.search(".+ class=tvnu>(.+)</a>",l) if r != None: self.title = escape(r.group(1)) state = 3
def __init__(self,block,line,today,tomorrow):
r = re.search("&lt;td class='tvnuthema' align=right valign='top' nowrap&gt;(.+)&lt;/td&gt;",l) if r != None: self.category = escape(r.group(1))
r = re.search("<td class='tvnuthema' align=right valign='top' nowrap>(.+)</td>",l) if r != None: self.category = escape(r.group(1))
def __init__(self,block,line,today,tomorrow):
r = re.search("&lt;td width= '100%' valign='top' colspan=2 class=programmabeschrijving&gt;(.+)&lt;br&gt;",l) if r != None: self.description = escape(r.group(1))
r = re.search("<td width= '100%' valign='top' colspan=2 class=programmabeschrijving>(.+)<br>",l) if r != None: self.description = escape(r.group(1))
def __init__(self,block,line,today,tomorrow):
if self.start_h &lt; '06': print " &lt;programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\"&gt;" % (self.tomorrow, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_id)
if self.start_h < '06': print " <programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\">" % (self.tomorrow, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_id)
def xml(self,channel_id): if self.title != '': #veranderd terug nr zes, sommig proggies op ketnet beginne om 7u if self.start_h &lt; '06': print " &lt;programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\"&gt;" % (self.tomorrow, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_...
if self.end_h &lt; self.start_h: print " &lt;programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\"&gt;" % (self.today, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_id)
if self.end_h < self.start_h: print " <programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\">" % (self.today, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_id)
def xml(self,channel_id): if self.title != '': #veranderd terug nr zes, sommig proggies op ketnet beginne om 7u if self.start_h &lt; '06': print " &lt;programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\"&gt;" % (self.tomorrow, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_...
print " &lt;programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\"&gt;" % (self.today, self.start_h, self.start_m, self.today, self.end_h, self.end_m, channel_id) print " &lt;title lang=\"nl\"&gt;%s&lt;/title&gt;" % self.title
print " <programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\">" % (self.today, self.start_h, self.start_m, self.today, self.end_h, self.end_m, channel_id) print " <title lang=\"nl\">%s</title>" % self.title
def xml(self,channel_id): if self.title != '': #veranderd terug nr zes, sommig proggies op ketnet beginne om 7u if self.start_h &lt; '06': print " &lt;programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\"&gt;" % (self.tomorrow, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_...
print " &lt;category lang=\"nl\"&gt;%s&lt;/category&gt;" % self.category
print " <category lang=\"nl\">%s</category>" % self.category
def xml(self,channel_id): if self.title != '': #veranderd terug nr zes, sommig proggies op ketnet beginne om 7u if self.start_h &lt; '06': print " &lt;programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\"&gt;" % (self.tomorrow, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_...
print " &lt;desc lang=\"nl\"&gt;%s&lt;/desc&gt;" % self.description print " &lt;/programme&gt;"
print " <desc lang=\"nl\">%s</desc>" % self.description print " </programme>"
def xml(self,channel_id): if self.title != '': #veranderd terug nr zes, sommig proggies op ketnet beginne om 7u if self.start_h &lt; '06': print " &lt;programme start=\"%s%s%s +0000\" stop=\"%s%s%s +0000\" channel=\"%s\"&gt;" % (self.tomorrow, self.start_h, self.start_m, self.tomorrow, self.end_h, self.end_m, channel_...
f=urllib.urlopen("http://www.tvsite.be/ndl/zender.asp?move=full&amp;channel=%s&amp;dag=%s"%(title,date))
f=urllib.urlopen("http://www.tvsite.be/ndl/zender.asp?move=full&channel=%s&dag=%s"%(title,date))
def __init__(self,id,title,days): self.id=id self.title=title
if state==0: r = re.search("&lt;td class='tvnucontent' valign='top'&gt;.+&lt;/td&gt;",l) if r != None: block.append(l) state = 1
if state==0: r = re.search("<td class='tvnucontent' valign='top'>.+</td>",l) if r != None: block.append(l) state = 1
def __init__(self,id,title,days): self.id=id self.title=title
elif state == 1: r = re.search("&lt;td class='tvnucontent' valign='top' rowspan=2&gt;.+",l) if r != None:
elif state == 1: r = re.search("<td class='tvnucontent' valign='top' rowspan=2>.+",l) if r != None:
def __init__(self,id,title,days): self.id=id self.title=title
print " &lt;channel id=\"%s\"&gt;" % self.id print " &lt;display-name lang=\"nl\"&gt;%s&lt;/display-name&gt;" % self.title print " &lt;icon&gt;http://www.tvsite.be/gfx/logos/%s.gif&lt;/icon&gt;" % self.title print " &lt;/channel&gt;"
print " <channel id=\"%s\">" % self.id print " <display-name lang=\"nl\">%s</display-name>" % self.title print " <icon>http://www.tvsite.be/gfx/logos/%s.gif</icon>" % self.title print " </channel>"
def xml(self,today = strftime("%Y/%m/%d",localtime(time())),tomorrow = strftime("%Y/%m/%d",localtime(time()+86400))):
print "&lt;?xml version=\"1.0\" encoding=\"ISO-8859-1\"?&gt;" print "&lt;tv generator-info-name=\"Script by Bart Heremans, fixes,testing and debuging by den_RDC\"&gt;"
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" print "<tv generator-info-name=\"Script by Bart Heremans, fixes,testing and debuging by den_RDC\">"
def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "days="]) except getopt.GetoptError: # print help information and exit: usage() sys.exit(2) dagen = 2 for o, a in opts: if o in ("-h", "--help"): print "help" usage() sys.exit() if o in ("-d", "--days"): dagen = int(a) print "&lt;?xml version=\"...
print "&lt;/tv&gt;"
print "</tv>"
def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hd:", ["help", "days="]) except getopt.GetoptError: # print help information and exit: usage() sys.exit(2) dagen = 2 for o, a in opts: if o in ("-h", "--help"): print "help" usage() sys.exit() if o in ("-d", "--days"): dagen = int(a) print "&lt;?xml version=\"...
self.event_PageUp()
def eventhandler(self, event): _debug_('TVGUIDE EVENT is %s' % event, 2)
r.x = item_w + int(r.x[4:])
r.x = item_w + int(r.x[3:])
def get_item_rectangle(self, rectangle, item_w, item_h): """ calculates the values for a rectangle inside the item tag """ r = copy.copy(rectangle) if not r.width: r.width = item_w
r.width = item_w + int(r.width[4:])
r.width = item_w + int(r.width[3:])
def get_item_rectangle(self, rectangle, item_w, item_h): """ calculates the values for a rectangle inside the item tag """ r = copy.copy(rectangle) if not r.width: r.width = item_w
r.y = item_h + int(r.y[4:])
r.y = item_h + int(r.y[3:])
def get_item_rectangle(self, rectangle, item_w, item_h): """ calculates the values for a rectangle inside the item tag """ r = copy.copy(rectangle) if not r.width: r.width = item_w
r.height = item_h + int(r.height[4:])
r.height = item_h + int(r.height[3:])
def get_item_rectangle(self, rectangle, item_w, item_h): """ calculates the values for a rectangle inside the item tag """ r = copy.copy(rectangle) if not r.width: r.width = item_w
if 'audio' in self.DIRECTORY_ADD_RANDOM_PLAYLIST and len(play_items) > 1:
if 'audio' in config.DIRECTORY_ADD_RANDOM_PLAYLIST and len(play_items) > 1:
def cwd(self, arg=None, menuw=None): """ make a menu item for each file in the directory """ play_items = [] number = len(self.info['tracks']) if hasattr(self.info, 'mixed'): number -= 1 for i in range(0, number): title=self.info['tracks'][i]['title'] item = AudioItem('cdda://%d' % (i+1), self, title, scan=False)
if prg.title == Unicode(_('This channel has no data loaded')): val = copy.copy(val) val.align='center'
try: if prg.title == _('This channel has no data loaded'): val = copy.copy(val) val.align='center' except UnicodeError: pass
def update_content(self): """ update the listing area """
if artist: tag.setArtist(artist) if album: tag.setAlbum(album) if title: tag.setTitle(title)
if artist: tag.setArtist(String(artist)) if album: tag.setAlbum(String(album)) if title: tag.setTitle(String(title))
def tagmp3 (filename, title=None, artist=None, album=None, track=None, tracktotal=None, year=None): """ use eyeD3 directly from inside mmpython to set the tag. We default to 2.3 since even though 2.4 is the accepted standard now, more players support 2.3 """ import mmpython.audio.eyeD3 as eyeD3 # Until mmpython has a...
x = time.time()
def _handle_input(self): saved = '' while 1:
print time.time() - x
def _handle_input(self): saved = '' while 1:
self.update(fullname, obj)
info = self.update(fullname, obj)
def get(self, filename, create=True): """ get info about a file """ fullname = filename
if video.has_key(variable):
if video.has_key(variable) and not \ (info.has_key(variable) and info['variable']):
def create(self, filename): info = mmpython.Factory().create(filename) if info: info = self.simplify(info) info['title:filename'] = Unicode(util.getname(filename)) if info.has_key('video'): for video in info['video']: for variable in ('width', 'height', 'length', 'aspect'): if video.has_key(variable): info[variable] = ...
'Freevo.\n\nLogfile: %s') % \ (event, sysconfig.syslogfile)
'Freevo.') % event
def handle(self, event): """ event handling function """ log.debug('handling event %s' % str(event))
fxd.title = fxd.str2XML(rec_prog.title)
fxd.title = rec_prog.title
def create_fxd(self,rec_prog): from util.fxdimdb import FxdImdb, makeVideo fxd = FxdImdb() fxd.setFxdFile(config.TV_RECORD_DIR + '/' + rec_prog.filename, overwrite = True)
self.current_subitem.play(menuw=self.menuw)
self.current_subitem.play(menuw=menuw)
def eventhandler(self, event, menuw=None): """ eventhandler for this item """
self.settings(menuw=self.menuw) self.menuw.show()
self.settings(menuw=menuw) menuw.show()
def eventhandler(self, event, menuw=None): """ eventhandler for this item """
return Item.eventhandler(self, event, self.menuw)
return Item.eventhandler(self, event, menuw)
def eventhandler(self, event, menuw=None): """ eventhandler for this item """
config.AUDIO_ITEMS.append( ('Playlists',self.playlist_folder))
config.AUDIO_ITEMS.append((_('Playlists'), self.playlist_folder))
def __init__(self,playlist_folder=None, naming='Freevo Playlist - %m%d-%I%M'): if playlist_folder == None: self.playlist_folder = ('%s/playlists' % config.FREEVO_CACHEDIR) else: self.playlist_folder = playlist_folder if not os.path.isdir(self.playlist_folder): os.mkdir(self.playlist_folder)
self.playlist_handle.write('%s\n' % f)
if os.path.isdir(f): for file in os.listdir(f): self.playlist_handle.write('%s\n' % os.path.join(f, file)) else: self.playlist_handle.write('%s\n' % f)
def queue_file(self,arg=None, menuw=None): if not self.playlist_handle: self.playlist_handle = open(('%s/%s.m3u' % (self.playlist_folder, time.strftime(self.naming))),'w+') for f in self.item.files.get(): self.playlist_handle.write('%s\n' % f) self.playlist_handle.flush() rc.post_event(Event(OSD_MESSAGE, arg='Queued Tr...
if wakeup < 30:
if self.wakeuptime and wakeup < 30:
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)
def __init__(self, imagelib):
def __init__(self, display, imagelib):
def __init__(self, imagelib): self.layer = [] # add 3 layer for drawing (based on how ofter they change): for i in range(3): c = mevas.CanvasContainer() self.layer.append(c) self.imagelib = imagelib self.visible = False self.width = 0 self.height = 0 self.frames_per_fade = 3
self.visible = False self.width = 0 self.height = 0
self.visible = True self.display = display self.width = display.width self.height = display.height
def __init__(self, imagelib): self.layer = [] # add 3 layer for drawing (based on how ofter they change): for i in range(3): c = mevas.CanvasContainer() self.layer.append(c) self.imagelib = imagelib self.visible = False self.width = 0 self.height = 0 self.frames_per_fade = 3
def show(self, canvas):
def show(self):
def show(self, canvas): """ show the layer on the display """ for l in self.layer: canvas.add_child(l) l.set_alpha(255) self.visible = True self.canvas = canvas self.width = canvas.width self.height = canvas.height
canvas.add_child(l)
def show(self, canvas): """ show the layer on the display """ for l in self.layer: canvas.add_child(l) l.set_alpha(255) self.visible = True self.canvas = canvas self.width = canvas.width self.height = canvas.height
self.canvas = canvas self.width = canvas.width self.height = canvas.height
def show(self, canvas): """ show the layer on the display """ for l in self.layer: canvas.add_child(l) l.set_alpha(255) self.visible = True self.canvas = canvas self.width = canvas.width self.height = canvas.height
self.visible = False self.canvas = None self.width = 0 self.height = 0
def hide(self): """ hide all layers """ for l in self.layer: l.unparent() self.visible = False self.canvas = None self.width = 0 self.height = 0
self.hide()
def fade_out(self): """ fade out layer and hide them """ if not self.visible: return a = animation.Fade(self.layer, self.frames_per_fade, 255, 0) a.start() a.wait() self.hide()
pass self.show(canvas)
return
def fade_in(self, canvas): """ show layers again and fade them in """ if not self.visible: pass self.show(canvas) a = animation.Fade(self.layer, self.frames_per_fade, 0, 255) a.start() a.wait()
self.screen = AreaScreen(imagelib) self.screen.show(self.canvas)
self.screen = AreaScreen(screen, imagelib)
def __init__(self, type, areas, settings, screen, imagelib): """ init the skin engine """ self.type = type self.settings = settings self.display_style = { 'menu' : 0 } self.areas = [] self.visible = True
self.screen.hide()
self.screen.destroy()
def __del__(self): """ delete an area handler """ _debug_('delete AreaHandler for %s' % self.type) while self.areas: self.areas[0].clear_all() del self.areas[0] self.screen.hide() self.container = None
def clear(self): """ clean the screen """ _debug_('clear skin (%s)' % self.type) self.screen.hide() def hide(self):
def hide(self, fade=True):
def clear(self): """ clean the screen """ _debug_('clear skin (%s)' % self.type) self.screen.hide()
self.screen.fade_out()
if fade: self.screen.fade_out() self.screen.hide()
def hide(self): """ hide the screen """ if self.visible: self.screen.fade_out() self.visible = False
def show(self):
def show(self, fade=True):
def show(self): """ hide the screen """ if not self.visible: self.screen.fade_in(self.canvas) self.visible = True
self.screen.fade_in(self.canvas)
self.screen.show() if fade: self.screen.fade_in(self.canvas)
def show(self): """ hide the screen """ if not self.visible: self.screen.fade_in(self.canvas) self.visible = True
if not self.screen.visible and self.visible: self.screen.show(self.canvas)
def draw(self, object): """ draw the object. object may be a menu, a table for the tv menu are an audio item for the audio player """ settings = self.settings if not self.screen.visible and self.visible: self.screen.show(self.canvas) if self.type == 'menu': if object.skin_settings: settings = object.skin_settings sty...
for type in 'VIDEO', 'AUDIO', 'IMAGE': for d in copy.copy(getattr(config, '%s_ITEMS' % type)): if not isinstance(d, str): d = d[1] if d == '/': print '%s_ITEMS contains root directory, skipped.' % type setattr(config, '%s_ITEMS' % type, [])
def create_tv_pickle(): print 'caching xmltv database................................', sys.__stdout__.flush() import tv.epg_xmltv tv.epg_xmltv.get_guide(verbose=False) print 'done'