rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
osc.Message(widget.split_path[0][0], widget.split_path[0][1:len(widget.split_path)]).sendlocal(widget.port[0])
widget.split_path[0][widget.sub_index[0]] = widget.get_value() osc.Message(widget.split_path[0][0], widget.split_path[0][1:len(widget.split_path[0])]).sendlocal(widget.port[0]) print 'osc.Message(', widget.split_path[0][0], widget.split_path[0][1:len(widget.split_path[0])], ').sendlocal(', widget.port[0], ')'
def osc_send_cb(self,widget):
if self.audio_file: d, f = util.resolve_media_mountdir(self.audio_file)
if item.audio_file: d, f = util.resolve_media_mountdir(item.audio_file)
def play(self, options, item): """ play a videoitem with mplayer """ self.parameter = (options, item) mode = item.mode network_play = item.network_play url = item.url self.item = item
self.lebgth = 0
self.length = 0
def play(self, command, player): """ called before playing is started to add some stuff to the command line """ self.item = player.item self.player = player self.osd_visible = False self.bmovl = None
cf_norm.upper(),
s_norm,
def Play(self, mode, tuner_channel=None, channel_change=0):
cf_clist,
s_clist,
def Play(self, mode, tuner_channel=None, channel_change=0):
if 0: norm = 'norm=%s' % cf_norm.upper() tmp = { 'television':0, 'composite1':1, 'composite2':2, 's-video':3}[cf_input.lower()] input = 'input=%s' % tmp chanlist = 'chanlist=%s' % cf_clist device = 'device=%s' % cf_device w, h = config.TV_VIEW_SIZE outfmt = 'outfmt=%s' % config.TV_VIEW_OUTFMT tvcmd = ('-tv on:drive...
else: command += ' -M'
def Play(self, mode, tuner_channel=None, channel_change=0):
menuw.pushmenu(menu.Menu(_('TV Main Menu'), items, item_types = 'tv main menu'))
m = menu.Menu(_('TV Main Menu'), items, item_types = 'tv main menu') m.infoitem = Info() menuw.pushmenu(m)
def main_menu(self, arg, menuw): items = [] if True: # FIXME: change the tvguide into a plugin items.append(menu.MenuItem(_('TV Guide'), action=self.start_tvguide))
return TRUE
return FALSE
def eventhandler(self, event): print '%s: %s app got %s event' % (time.time(), self.mode, event) if event == em.STOP or event == em.PLAY_END: self.Stop() rc.post_event(em.PLAY_END) return TRUE elif event == em.TV_CHANNEL_UP or event == em.TV_CHANNEL_DOWN: if self.mode == 'vcr': return # Go to the prev/next channel in...
self.item.__dirwatcher_last_time__ = self.last_time
self.item.__dirwatcher_last_time__ = self.last_time self.item.__dirwatcher_last_files__ = self.files
def cwd(self, menuw, item, item_menu, dir): self.menuw = menuw self.item = item self.item_menu = item_menu self.dir = dir try: self.last_time = item.__dirwatcher_last_time__ self.files = item.__dirwatcher_last_files__ except AttributeError: self.last_time = vfs.mtime(self.dir) self.files = self.l...
season = max(season, val.font.stringsize(c.show_name[1])) episode = max(episode, val.font.stringsize(c.show_name[2]))
stringsize = val.font.font.stringsize season = max(season, stringsize(c.show_name[1])) episode = max(episode, stringsize(c.show_name[2]))
def update_content(self): """ update the listing area """
self.fc.chanSet(tuner_channel)
self.fc.chanSet(tuner_channel, app='mplayer')
def Play(self, mode, tuner_channel=None, channel_change=0):
tuner_freq = self.fc.chanSet(app='mplayer')
tuner_freq = self.fc.chanSet(tuner_channel, app='mplayer')
def Play(self, mode, tuner_channel=None, channel_change=0):
tvcmd = ('tv://%s -tv driver=%s:freq=%s:%s:%s:%s:'
tvcmd = ('tv://%s -tv driver=%s:%s:%s:%s:'
def Play(self, mode, tuner_channel=None, channel_change=0):
(tuner_channel, config.TV_DRIVER, tuner_freq, device,
(tuner_channel, config.TV_DRIVER, device,
def Play(self, mode, tuner_channel=None, channel_change=0):
self.send_header("WWW-Authenticate", 'Basic realm="Freevo')
self.send_header("WWW-Authenticate", 'Basic realm="Freevo"')
def handle_request_line(self, socket): """ Called when the http request line and headers have been received """ # prepare attributes needed in parse_request() self.raw_requestline=self.rfile.readline() self.parse_request()
item.name.startswith(item.parent.name):
Unicode(item.name).startswith(Unicode(item.parent.name)):
def update_content(self): """ update the content """ menu = self.menu layout = self.layout area = self.area_val content = self.calc_geometry(layout.content, copy_object=True)
else: if DEBUG: print "Video Opened at %s" % device
def basic_info(self, device): self.devfd = os.open(device, os.O_TRUNC) if self.devfd < 0: sys.exit("Error: %d\n" %self.devfd) else: if DEBUG: print "Video Opened at %s" % device
print 'DirwatcherThread: unable to read directory %s' % self.dir
_debug_('DirwatcherThread: unable to read directory %s' % self.dir,1)
def scan(self): self.lock.acquire()
self._started = 1 self._help = 0 self._help_saved = pygame.Surface((width, height), 0, 32) self._help_last = 0 def _cb(self): event = pygame.event.poll() if event.type == NOEVENT: return None if event.type == KEYDOWN: if event.key in cmds_sdl: return cmds_sdl[event.key]
def __init__(self, width=768, height=576):
pass
self._getbitmap(filename)
def loadbitmap(self, filename): pass # XXX Fix later
try: image = pygame.image.load(filename).convert_alpha() except: print 'SDL image load problem!' return
image = self._getbitmap(filename) if not image: return if bbx or bby: imbb = pygame.Surface((bbw, bbh), 0, 32) imbb.blit(image, (0, 0), (bbx, bby, bbw, bbh)) image = imbb
def drawbitmap(self, filename, x=0, y=0, scaling=None, # XXX scale, zoom, tile not supported yet! bbx=0, bby=0, bbw=0, bbh=0):
print 'drawbox: %s 0x%08x %s' % (width, color, fill)
if color == None: color = self.default_fg_color
def drawbox(self, x0, y0, x1, y1, width=None, color=None, fill=0): print 'drawbox: %s 0x%08x %s' % (width, color, fill) if width == None: width = 1
if width == -1: fill = 1 width = 4 if color == None: color = self.default_fg_color r = (x0, y0, x1-x0, y1-y0) c = (0, 0, 255, 5) if fill:
if width == -1 or fill: r,g,b,a = self._sdlcol(color) w = x1 - x0 h = y1 - y0 box = pygame.Surface((w, h), 0, 32) box.fill((r,g,b)) box.set_alpha(a) self.screen.blit(box, (x0, y0)) else: r = (x0, y0, x1-x0, y1-y0) c = self._sdlcol(color)
def drawbox(self, x0, y0, x1, y1, width=None, color=None, fill=0): print 'drawbox: %s 0x%08x %s' % (width, color, fill) if width == None: width = 1
except ValuError:
except ValueError:
def sort(self, mode=None): """ Returns the string how to sort this item """ if mode == 'date': if self.filename: return u'%s%s' % (os.stat(self.filename).st_ctime, Unicode(self.filename)) if mode == 'advanced': # sort by track number try: return '%0.3i-%s' % (int(self['trackno']), Unicode(self.url)) except ValuError: r...
return chr(event.key)
if event.unicode != u'': return event.unicode
def _cb(self, map=True): """ callback for SDL event (not Freevo events) """ if not pygame.display.get_init(): return None
for i in range( 1 ):
for i in range( 10 ):
def do_tryagain(): # TODO: force to identify media instead of wait box = PopupBox( text="Wait while detecting media..." ) box.show() l=1 for i in range( 1 ): # 10 times for media in config.REMOVABLE_MEDIA: # media has no id? maybe identifying... wait if not media.id: time.sleep( 2 ) if media.id == self.media_id: # we ...
except:
except Exception, e: print e traceback.print_exc()
def addEditedFavorite(name, title, chan, dow, mod, priority): try: (status, message) = \ server.addEditedFavorite(jellyToXML(name), \ jellyToXML(title), chan, dow, mod, priority) except: return (FALSE, 'record_client: '+_('connection error')) return (status, message)
log.warning('Could not find screens for %d lines and %d columns LCD!' ) % ( self.height, self.width ))
log.warning('Could not find screens for %d lines and %d columns LCD!' % ( self.height, self.width ))
def generate_screens( self ): screens = None l = self.height # FIXME: please don't use l as a name! c = self.width # Find a screen # find a display with 'l' lines while not screens: try: screens = layouts[ l ] except KeyError: log.warning( 'Could not find screens for %d lines LCD!' % l ) l -= 1 if l < 1: print String(_...
if parent and parent.type == 'dir' and \
if parent and parent.type == 'dir' and hasattr(parent,'VIDEO_DIRECTORY_AUTOBUILD_THUMBNAILS') and \
def get(self, parent, files): """ return a list of items based on the files """ items = []
a = AudioInfo(fname) if a.artist and artist == None: artist = a.artist elif a.artist and artist != a.artist: artist = '' alist += [a]
if os.path.exists(fname) or fname.find("://"): a = AudioInfo(fname) if a.artist and artist == None: artist = a.artist elif a.artist and artist != a.artist: artist = '' alist += [a] else: print 'music: %s is missing, removing from playlist' % fname
def parse_entry(arg=None, menuw=None): """ The music module change directory handling function formerly known as cwd Arguments: Array of arguments - Since that's the way it is done. Todo: Should do a test on dir to see if it is a playlist I open for it in main_menu, but it shouldn't be a problem. Got crash on pla...
print 'Local database not found. Please download movies.list.gz' % imdb_title_list
print 'Local database not found. Please download movies.list.gz'
def usage(): print 'imdb.py -s string: search imdb for string' print print 'imdb.py [--rom-drive=/path/to/rom/drive] nr output files' print ' Generate output.fxd for the movie.' print ' Files is a list of files that belongs to this movie.' print ' Use [dvd|vcd] to add the whole disc or use [dvd|vcd][title]' print ...
self.type = 'detached_player'
self.show_item.type = 'detached_player'
def __init__(self): plugin.MainMenuPlugin.__init__(self) config.EVENTS['audio']['DISPLAY'] = Event(FUNCTION_CALL, arg=self.detach) self.show_item = menu.MenuItem(_('Show player'), action=self.show) self.type = 'detached_player'
font = osd.getFontInfo(val.font.name, val.font.size)
font = val.font.font
def update_content(self): """ update the listing area """
total_slides = 0 slide_num = 0 def view(self, info, zoom=0, rotation=0): filename = info.file caption = info.name self.fileinfo = info
slideshow = TRUE def view(self, item, zoom=0, rotation=0): filename = item.file self.fileitem = item
def get_singleton(): global _singleton # One-time init if _singleton == None: _singleton = ImageViewer() return _singleton
self.caption = caption
def view(self, info, zoom=0, rotation=0): filename = info.file caption = info.name
def cache(self, fileinfo):
if self.fileitem.duration: signal.signal(signal.SIGALRM, self.signalhandler) signal.alarm(self.fileitem.duration) def cache(self, fileitem):
def view(self, info, zoom=0, rotation=0): filename = info.file caption = info.name
osd.bitmapsize(fileinfo.file)
osd.bitmapsize(fileitem.file) def signalhandler(self, signum, frame): if rc.app == self.eventhandler and self.slideshow: rc.app = None self.eventhandler(rc.PLAY_END)
def cache(self, fileinfo): # cache the next image (most likely we need this) osd.bitmapsize(fileinfo.file)
if event == rc.PAUSE: signal.alarm(0) elif event == rc.PLAY: signal.alarm(1) elif event == rc.STOP or event == rc.EXIT or event == rc.MENU:
if event == rc.PAUSE or event == rc.PLAY: if self.slideshow: self.slideshow = FALSE signal.alarm(0) else: self.slideshow = TRUE signal.alarm(1) elif event == rc.STOP or event == rc.EXIT:
def eventhandler(self, event):
self.view(self.fileinfo, zoom=self.zoom, rotation = self.rotation)
self.view(self.fileitem, zoom=self.zoom, rotation = self.rotation)
def eventhandler(self, event):
self.view(self.fileinfo, zoom=0, rotation = self.rotation)
self.view(self.fileitem, zoom=0, rotation = self.rotation)
def eventhandler(self, event):
self.fileinfo.eventhandler(event)
self.fileitem.eventhandler(event)
def eventhandler(self, event):
if self.fileinfo.binsdesc.has_key('title'): osdstring.append('Title: ' + self.fileinfo.binsdesc['title']) elif self.caption: osdstring = [self.caption]
if self.fileitem.binsdesc.has_key('title'): osdstring.append('Title: ' + self.fileitem.binsdesc['title']) elif self.fileitem.name: osdstring = [self.fileitem.name]
def drawosd(self):
if self.fileinfo.binsdesc.has_key('description'): osdstring.append('Description: ' + self.fileinfo.binsdesc['description'])
if self.fileitem.binsdesc.has_key('description'): osdstring.append('Description: ' + self.fileitem.binsdesc['description'])
def drawosd(self):
osd.drawstring(osdstring[line], 10, h, fgcolor=osd.COL_ORANGE, bgcolor=osd.COL_BLACK)
osd.drawstring(osdstring[line], 10, h, fgcolor=osd.COL_ORANGE)
def drawosd(self):
if DEBUG: print('Record_Thread::run: finished recording') self.mode = 'idle' self.save_flag.set()
def run(self): while 1: if DEBUG: print('Record_Thread::run: mode=%s' % self.mode) if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'record': if DEBUG: print 'Record_Thread::run: started recording'
if DEBUG: print('Record_Thread::run: finished recording') self.mode = 'idle'
def run(self): while 1: if DEBUG: print('Record_Thread::run: mode=%s' % self.mode) if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'record': if DEBUG: print 'Record_Thread::run: started recording'
data = child.fromchild.readline() if data: data = re.search( "^MPlayer (?P<version>\S+)", data ) if data: _debug_("MPlayer version is: %s" % data.group( "version" )) data = data.group( "version" ) if data[ 0 ] == "1": config.MPLAYER_VERSION = 1.0 elif data[ 0 ] == "0": config.MPLAYER_VERSION = 0.9 elif data[ 0 : 7 ] ==...
data = True while data: data = child.fromchild.readline() if data: data = re.search( "^MPlayer (?P<version>\S+)", data ) if data: break if data: _debug_("MPlayer version is: %s" % data.group( "version" )) data = data.group( "version" ) if data[ 0 ] == "1": config.MPLAYER_VERSION = 1.0 elif data[ 0 ] == "0": config.MP...
def __init__(self): mplayer_version = 0
for t in self.menu_types: self.menu[t] = copy.deepcopy(self.menu[t])
self.menu = copy.deepcopy(self.menu)
def parse(self, freevo_type, scale, c_dir, copy_content): for node in freevo_type.children: if node.name == u'menu': type = attr_str(node, "type", "all") if type == "all": if copy_content: for t in self.menu_types: self.menu[t] = copy.deepcopy(self.menu[t]) for t in self.menu_types: self.menu[t].parse(node, scale, c_di...
if self.out_buffer.getvalue():
if self.out_buffer.getvalue() and not self.__write_nf:
def close(self): if self.closed: return self.closed = True if self.out_buffer.getvalue(): # if need no more sending: self.__close()
if DEBUG: log.debug('GET: reading cached file (%s)' % config.TV_RECORD_SCHEDULE) scheduledRecordings = marmalade.unjellyFromXML(open(config.TV_RECORD_SCHEDULE, 'r'))
if DEBUG: log.debug('GET: reading cached file (%s)' % config.TV_RECORD_SCHEDULE) f = open(config.TV_RECORD_SCHEDULE, 'r') scheduledRecordings = marmalade.unjellyFromXML(f) f.close()
def getScheduledRecordings(self): file_ver = None scheduledRecordings = None
if DEBUG: log.debug('SAVE: saving cached file (%s)' % config.TV_RECORD_SCHEDULE) if DEBUG: log.debug("SAVE: ScheduledRecordings has %s items." % len(scheduledRecordings.programList)) marmalade.jellyToXML(scheduledRecordings, open(config.TV_RECORD_SCHEDULE, 'w'))
if DEBUG: log.debug('SAVE: saving cached file (%s)' % config.TV_RECORD_SCHEDULE) if DEBUG: log.debug("SAVE: ScheduledRecordings has %s items." % \ len(scheduledRecordings.programList)) f = open(config.TV_RECORD_SCHEDULE, 'w') marmalade.jellyToXML(scheduledRecordings, f) f.close()
def saveScheduledRecordings(self, scheduledRecordings=None): if not scheduledRecordings: if DEBUG: print 'SAVE: making a new ScheduledRecordings' scheduledRecordings = ScheduledRecordings() if DEBUG: log.debug('SAVE: saving cached file (%s)' % config.TV_RECORD_SCHEDULE) if DEBUG: log.debug("SAVE: ScheduledRecordings ...
return (TRUE, prog)
return (TRUE, prog.decode())
def findProg(self, chan=None, start=None): global guide
if DEBUG: log.debug('PROGRAM MATCH: %s' % prog) matches.append(prog)
if DEBUG: log.debug('PROGRAM MATCH: %s' % prog) matches.append(prog.decode()) if DEBUG: log.debug('return: %s' % str(matches))
def findMatches(self, find=None): global guide
if item.playlist:
if 1:
def DrawMenu_Cover(self, menuw, settings): image_x = 0 val = settings menu = menuw.menustack[-1] artist,album,year,length = None, None, None, None
return '%s-%s' % (self['trackno'], self.url)
return '%s-%s' % (String(self['trackno']), String(self.url))
def sort(self, mode=None): """ Returns the string how to sort this item """ if mode == 'date': if self.filename: return '%s%s' % (os.stat(self.filename).st_ctime, self.filename) if mode == 'advanced': # sort by track number return '%s-%s' % (self['trackno'], self.url) return self.url
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)
print " <programme start=\"%s%s%s %s\" stop=\"%s%s%s %s\" channel=\"%s\">" % (self.tomorrow, self.start_h, self.start_m, localtz(), self.tomorrow, self.end_h, self.end_m, localtz(), 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 < '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) else:...
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)
if self.end_h < self.start_h: print " <programme start=\"%s%s%s %s\" stop=\"%s%s%s %s\" channel=\"%s\">" % (self.today, self.start_h, self.start_m, localtz(), self.tomorrow, self.end_h, self.end_m, localtz(), 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 < '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) else:...
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 " <programme start=\"%s%s%s %s\" stop=\"%s%s%s %s\" channel=\"%s\">" % (self.today, self.start_h, self.start_m, localtz(), self.today, self.end_h, self.end_m, localtz(), 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 < '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) else:...
f=urllib.urlopen("http://www.tvsite.be/ndl/zender.asp?move=full&channel=%s&dag=%s"%(title,date))
f=urllib.urlopen("http://www.teveblad.be/ndl/zender.asp?move=full&channel=%s&dag=%s"%(title,date))
def __init__(self,id,title,days): self.id=id self.title=title self.events = []
print " <icon>http://www.tvsite.be/gfx/logos/%s.gif</icon>" % self.title
print " <icon>http://www.teveblad.be/gfx/logos/%s.gif</icon>" % self.title
def xml(self,today = strftime("%Y/%m/%d",localtime(time())),tomorrow = strftime("%Y/%m/%d",localtime(time()+86400))):
print "<tv generator-info-name=\"Script by Bart Heremans, fixes,testing and debuging by den_RDC\">"
print "<tv generator-info-name=\"Script by Bart Heremans and 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 "<?xml version=\"1.0...
cChannel(14,'Eurosport',dagen).xml()
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 "<?xml version=\"1.0...
a = to_str(a)
a = unicode_to_str(a)
def replace(obj, l): try: r = eval(obj.group()[2:-2], l) if r == None: return '' return str(r) except (SystemExit, KeyboardInterrupt): raise SystemExit except Exception, e: return ''
return None
return []
def get_items(self): items = []
self.function(arg=self.arg, menuw=menuw)
if self.function: self.function(arg=self.arg, menuw=menuw)
def select(self, arg=None, menuw=None): self.function(arg=self.arg, menuw=menuw)
print 'x'
def update_content(self): """ update the listing area """
print _( 'ERROR' ) + ': ' + self.exit_type + \
print _( 'ERROR' ) + ': ' + str(self.exit_type) + \
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 _( 'ERROR' ) + ': ' + self.exit_type + \ _( 'unknow error while playing file' ) return PLAY_END
def set_info_mp3( self, file ):
def set_info_mp3(self, filename):
def set_info_mp3( self, file ): """ Sets the info variables with info from the mp3
id3 = eyed3.Mp3AudioFile( file )
id3 = eyed3.Mp3AudioFile(filename)
def set_info_mp3( self, file ): """ Sets the info variables with info from the mp3
id3 = eyed3.Mp3AudioFile( file, 1)
id3 = eyed3.Mp3AudioFile(filename, 1)
def set_info_mp3( self, file ): """ Sets the info variables with info from the mp3
if id3.tag: self.album = id3.tag.getAlbum() self.artist = id3.tag.getArtist() self.title = id3.tag.getTitle() self.track,self.trackof = id3.tag.getTrackNum() self.year = id3.tag.getYear() self.length = id3.getPlayTime()
except: print 'music: oops, mp3 tag parsing failed!' print 'music: filename = "%s"' % filename traceback.print_exc() if id3: if id3.tag: self.album = id3.tag.getAlbum() self.artist = id3.tag.getArtist() self.title = id3.tag.getTitle() self.track,self.trackof = id3.tag.getTrackNum() self.year = id3.tag.getYear(...
def set_info_mp3( self, file ): """ Sets the info variables with info from the mp3
self.title = os.path.splitext(os.path.basename(file))[0]
self.title = os.path.splitext(os.path.basename(filename))[0]
def set_info_mp3( self, file ): """ Sets the info variables with info from the mp3
if( self.elapsed > self.length ):
if not self.length: return 0 if self.elapsed > self.length:
def get_remain(self): if( self.elapsed > self.length ): self.elapsed = self.length return (self.length - self.elapsed)
self.app = MPlayerApp(command) self.app.stop_osd = True
self.app = childapp.ChildApp2(command)
def Play(self, mode, tuner_channel=None):
class MPlayerApp(childapp.ChildApp2): """ class controlling the in and output from the mplayer process """ def __init__(self, app): childapp.ChildApp2.__init__(self, app) def stop_event(self): """ return the stop event send through the eventhandler """ if self.exit_type == "End of file": return PLAY_END elif self.exi...
def eventhandler(self, event, menuw=None): s_event = '%s' % event
media.item.info.mmdata = data
media.item.info = disc_info
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'...
list[ i ].text = exp
list[ i ].text = str( exp )
def eval_expressions( self, list, index = [ ] ): """ travesse the list evaluating the expressions, return a flat list with valid elements indexes only (false 'if' expressions eliminated). Also, text elements are in the list too in a tuple: ( index, 'text value' ) so you can check if it changed just comparing two lists ...
self.encoderthread.app.write( 'SPAWN mp1e -m3 -c%s -p%s -r14,100\n' % ('/dev/video0','/dev/dsp2') )
self.encoderthread.app.write( 'SPAWN %s\n' % config.TIMESHIFT_ENCODE_CMD )
def StartEncoder(self):
else: self.TunerNextChannel()
def EventHandler(self,event): print '%s: %s app got %s event' % (time.time(), self.mode, event) if (event == remote.MENU or event == remote.STOP or event == remote.EXIT or event == remote.SELECT or event == remote.PLAY_END): self.Play('stop') remote.app = tv.eventhandler tv.refresh() return TRUE elif event == remote.CH...
os.spawnlp(os.P_WAIT, 'chchan','%s %s %s' % (new_channel, self.cf_norm, self.cf_clist)) self.encoderthread.app.write('reset\n')
self.TunerSetChannel(new_channel)
def EventHandler(self,event): print '%s: %s app got %s event' % (time.time(), self.mode, event) if (event == remote.MENU or event == remote.STOP or event == remote.EXIT or event == remote.SELECT or event == remote.PLAY_END): self.Play('stop') remote.app = tv.eventhandler tv.refresh() return TRUE elif event == remote.CH...
self.audiodev = '/dev/dsp2' self.timeshiftfile = '/media/Recording/buffer/tsmaster.mpg' self.timeshiftsize = 1024*1024*32
self.audiodev = config.AUDIO_INPUT_DEVICE self.timeshiftfile = config.TIMESHIFT_BUFFER self.timeshiftsize = 1024*1024*config.TIMESHIFT_BUFFER_SIZE
def __init__(self): threading.Thread.__init__(self)
height -= border_radius
height -= border_radius * 2
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 layer: fgcolor = self._sdlcol(fgcolor) if border_color != None: border_color = self._sdlcol(border_color)
fgcolor = self._sdlcol(fgcolor) if border_color != None: border_color = self._sdlcol(border_color)
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...
def replex_stop(self, source, dest, exit_code):
def replex_stop(self, exit_code, source, dest):
def replex_stop(self, source, dest, exit_code): """ The replex program has stopped, check the result. """ # get length of both files srcinfo = kaa.metadata.parse(source) if not srcinfo: # this shoudln't happen log.error('unable to parse %s' % source) # set slen to something unrealistic slen = -1000 else: slen = srcinfo...
len_secs = b.stop-b.start
start_time = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(b.start)) len_secs = int(b.stop-b.start)
def make_schedule (b=None): if not b: return # Time stuff len_secs = b.stop-b.start temp = len_secs - 1 hour = int(temp/3600) minu = int(temp/60) seco = int(temp%60) timecode_format = '%0.2i:%0.2i:%0.2i' % (hour,minu,seco) # Channel tunerid = get_tunerid(b.channel_id) rec_name = b.title if b.sub_title: rec_name += ...
return config.VCR_CMD % cl_options
scheduleline = start_time + "," + str(len_secs) + "," + config.VCR_CMD % cl_options + "," + b.channel_id return scheduleline
def make_schedule (b=None): if not b: return # Time stuff len_secs = b.stop-b.start temp = len_secs - 1 hour = int(temp/3600) minu = int(temp/60) seco = int(temp%60) timecode_format = '%0.2i:%0.2i:%0.2i' % (hour,minu,seco) # Channel tunerid = get_tunerid(b.channel_id) rec_name = b.title if b.sub_title: rec_name += ...
if config.DEBUG: print 'addProgram: key is "%s"' % key
if config.DEBUG: print 'addProgram: key is "%s"' % String(key)
def addProgram(self, prog, key=None): if not key: # key = rec_interface.getKey(prog) pass
if config.DEBUG: print 'addProgram: actually adding "%s"' % prog
if config.DEBUG: print 'addProgram: actually adding "%s"' % String(prog)
def addProgram(self, prog, key=None): if not key: # key = rec_interface.getKey(prog) pass
if config.DEBUG: print 'removed recording: %s' % prog else: if config.DEBUG: print 'We do not know about this recording.'
if config.DEBUG: print 'removed recording: %s' % String(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 config.DEBUG: print 'addFavorites: actually adding "%s"' % fav.name
if config.DEBUG: print 'addFavorites: actually adding "%s"' % String(fav.name)
def addFavorite(self, fav): if not self.favorites.has_key(fav.name): if config.DEBUG: print 'addFavorites: actually adding "%s"' % fav.name self.favorites[fav.name] = fav else: if config.DEBUG: print 'We already have a favorite called "%s".' % fav.name
if config.DEBUG: print 'We already have a favorite called "%s".' % fav.name
if config.DEBUG: print 'We already have a favorite called "%s".' % String(fav.name)
def addFavorite(self, fav): if not self.favorites.has_key(fav.name): if config.DEBUG: print 'addFavorites: actually adding "%s"' % fav.name self.favorites[fav.name] = fav else: if config.DEBUG: print 'We already have a favorite called "%s".' % fav.name
if config.DEBUG: print 'removed favorite: %s' % name else: if config.DEBUG: print 'We do not have a favorite called "%s".' % name
if config.DEBUG: print 'removed favorite: %s' % String(name) else: if config.DEBUG: print 'We do not have a favorite called "%s".' % String(name)
def removeFavorite(self, name): if self.favorites.has_key(name): del self.favorites[name] if config.DEBUG: print 'removed favorite: %s' % name else: if config.DEBUG: print 'We do not have a favorite called "%s".' % name
if os.path.exists('/tmp/bmovl'):
if os.path.exists('/tmp/bmovl') and config.MPLAYER_SOFTWARE_SCALER:
def play(self, filename, options, item, mode = None): """ play a videoitem with mplayer """
rc.app(self)
def play(self, filename, options, item, mode = None): """ play a videoitem with mplayer """
pos = osd.drawstringframed('%d:%02d:%02d' % ( length / 3600, (length % 3600) / 60, length % 60), 10, 10, osd.width / 2, -1, self.osd_font.font, self.osd_font.color, layer=s)
txt = '%d:%02d:%02d' % ( length / 3600, (length % 3600) / 60, length % 60)
def update_osd(self): """ bmovl: update elapsed time and current time """ s = self.osd_bg.convert() length = self.item.elapsed pos = osd.drawstringframed('%d:%02d:%02d' % ( length / 3600, (length % 3600) / 60, length % 60), 10, 10, osd.width / 2, -1, self.osd_font.font, self.osd_font.color, layer=s)
pos = osd.drawstringframed(length, 10, pos[1][3]+5, osd.width / 2, -1, self.osd_font.font, self.osd_font.color, layer=s)
txt = '%s / %s' % (txt, length) osd.drawstringframed(txt, 10, 10, osd.width / 2, -1, self.osd_font.font, self.osd_font.color, layer=s)
def update_osd(self): """ bmovl: update elapsed time and current time """ s = self.osd_bg.convert() length = self.item.elapsed pos = osd.drawstringframed('%d:%02d:%02d' % ( length / 3600, (length % 3600) / 60, length % 60), 10, 10, osd.width / 2, -1, self.osd_font.font, self.osd_font.color, layer=s)
os.write(self.bmovl, 'RGBA32 %d %d %d %d %d %d\n' % \ (s.get_width(), s.get_height(), 0, osd.height-s.get_height(), 0, 0)) os.write(self.bmovl, pygame.image.tostring(s, 'RGBA'))
bottom_space = (osd.height - self.thread.app.height) / 2 if bottom_space > s.get_height(): _debug_('enough space to draw on screen via osd.py') osd.screen.blit(s, (0, osd.height-s.get_height())) osd.update() else: _debug_('write on mplayer via bmovl (%s)' % bottom_space) os.write(self.bmovl, 'RGBA32 %d %d %d %d %d %d\n...
def update_osd(self): """ bmovl: update elapsed time and current time """ s = self.osd_bg.convert() length = self.item.elapsed pos = osd.drawstringframed('%d:%02d:%02d' % ( length / 3600, (length % 3600) / 60, length % 60), 10, 10, osd.width / 2, -1, self.osd_font.font, self.osd_font.color, layer=s)
try: if line.find('SwScaler:') ==0 and line.find(' -> ') > 0 and \ line[line.find(' -> '):].find('x') > 0 and not self.width: self.width, self.height = line[line.find(' -> ')+4:].split('x') self.width = int(self.width) self.height = int(self.height) if line.find('Expand: ') == 0: self.width, self.height = line[7:line....
def stdout_cb(self, line): if config.MPLAYER_DEBUG: try: self.log_stdout.write(line + '\n') except ValueError: pass # File closed
if parent and hasattr(parent, 'display_type'): display_type = parent.display_type else: display_type = None
def get(self, parent, files): """ return a list of items based on the files """ items = []
items.append(Playlist(playlist=filename, parent=parent, build=True))
items.append(Playlist(playlist=filename, parent=parent, display_type=display_type, build=True))
def get(self, parent, files): """ return a list of items based on the files """ items = []