rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
print network_play
def play(self, options, item): """ play a videoitem with mplayer """
def __init__(self, directory, parent, name = '', display_type = None, add_args = None): dt = display_type if display_type == 'tv': dt = 'video' elif not dt: dt = 'all' self.autovars = [ ('num_dir_items', 0), ('num_timestamp', 0), ('num_%s_items' % dt, 0)]
def __init__(self, directory, parent, name = '', display_type = None, add_args = None, create_metainfo=True): self.autovars = [ ('num_dir_items', 0) ]
def __init__(self, directory, parent, name = '', display_type = None, add_args = None): dt = display_type if display_type == 'tv': dt = 'video' elif not dt: dt = 'all' self.autovars = [ ('num_dir_items', 0), ('num_timestamp', 0), ('num_%s_items' % dt, 0)]
self.create_metainfo()
if create_metainfo: self.create_metainfo()
def __init__(self, directory, parent, name = '', display_type = None, add_args = None): dt = display_type if display_type == 'tv': dt = 'video' elif not dt: dt = 'all' self.autovars = [ ('num_dir_items', 0), ('num_timestamp', 0), ('num_%s_items' % dt, 0)]
display_type = self.display_type
display_type = self.display_type or 'all'
def __getitem__(self, key): """ return the specific attribute """ if key == 'type': if self.media: return _('Directory on disc [%s]') % self.media.label return _('Directory')
num_timestamp = self.info['num_timestamp'] if num_timestamp != timestamp:
num_timestamp = self.info['num_%s_timestamp' % name] if not num_timestamp or num_timestamp < timestamp: if self.media: self.media.mount()
def create_metainfo(self): """ create some metainfo for the directory """ timestamp = os.stat(self.dir)[stat.ST_MTIME] num_timestamp = self.info['num_timestamp']
display_type = self.display_type if self.display_type == 'tv': display_type = 'video'
def create_metainfo(self): """ create some metainfo for the directory """ timestamp = os.stat(self.dir)[stat.ST_MTIME] num_timestamp = self.info['num_timestamp']
if self.display_type: if num_play_items != self['num_%s_items' % display_type]: self['num_%s_items' % display_type] = num_play_items else: if num_play_items != self['num_all_items']: self['num_all_items'] = num_play_items
if num_play_items != self['num_%s_items' % name]: self['num_%s_items' % name] = num_play_items
def create_metainfo(self): """ create some metainfo for the directory """ timestamp = os.stat(self.dir)[stat.ST_MTIME] num_timestamp = self.info['num_timestamp']
self['num_timestamp'] = timestamp
self['num_%s_timestamp' % name] = timestamp if self.media: self.media.umount()
def create_metainfo(self): """ create some metainfo for the directory """ timestamp = os.stat(self.dir)[stat.ST_MTIME] num_timestamp = self.info['num_timestamp']
various = '__various__'
various = u'__various__'
def addPathDB(path, dirtitle, type='*.mp3', verbose=True): # Get some stuff ready count = 0 db = MetaDatabase(); if not db.checkTable('music'): db.runQuery(dbschema) # Compare and contrast the db to the disc songs = util.recursefolders(path,1,type,1) for row in db.runQuery('SELECT path, filename FROM music'): try: so...
if i in ('subtitle', 'url'): setattr(self, i, info[i])
if i == 'subtitle': self.subtitle = info[i] elif i == 'url': self.url = String(info[i])
def __init__(self, id = -1, name = 'unknown', channel = 'unknown', priority = 0, start = 0, stop = 0, info = {}, status = 'scheduled' ): self.id = id self.name = name self.channel = channel self.priority = priority self.start = start self.stop = stop self.status = status self.info = {}
info['url'] = self.url
info['url'] = Unicode(self.url)
def long_list(self): """ Return a long list with every information about the recording. """ info = copy.copy(self.info) if self.subtitle: info['subtitle'] = self.subtitle if self.url: info['url'] = self.url return self.id, self.name, self.channel, self.priority, self.start, \ self.stop, self.status, self.start_padding,...
for var in ('name', 'channel', 'status', 'subtitle', 'url', 'fxdname'):
for var in ('name', 'channel', 'status', 'subtitle', 'fxdname'):
def parse_fxd(self, parser, node): """ Parse informations from a fxd node and set the internal variables. """ self.id = int(parser.getattr(node, 'id')) for child in node.children: for var in ('name', 'channel', 'status', 'subtitle', 'url', 'fxdname'): if child.name == var: setattr(self, var, parser.gettext(child)) if c...
subnode = fxdparser.XMLnode(var, [], getattr(self, var) )
subnode = fxdparser.XMLnode(var, [], Unicode(getattr(self, var)) )
def __fxd__(self, fxd): """ Dump informations about the recording in a fxd file node. """ node = fxdparser.XMLnode('recording', [ ('id', self.id ) ] ) for var in ('name', 'channel', 'priority', 'url', 'status', 'subtitle', 'fxdname'): if getattr(self, var): subnode = fxdparser.XMLnode(var, [], getattr(self, var) ) fxd....
if value:
if value in (1, True):
def __getitem__(self, key): """ return the specific attribute """ if key == 'type': return _('Directory')
return False
if value in (0, False): return False return value
def __getitem__(self, key): """ return the specific attribute """ if key == 'type': return _('Directory')
print 'save %s' % self.current_cachefile
def save_cache(self,store_empty=True): """ save a modified cache file """ print 'save %s' % self.current_cachefile if not store_empty: for key in copy.copy(self.current_objects): if not self.current_objects[key][0]: del self.current_objects[key] if not self.current_objects: if os.path.isfile(self.current_cachefile): os...
print 'mod'
def load_cache(self, dirname): """ load a new cachefile """ if dirname == self.current_cachedir: return
print 's'
def cache_dir(self, directory, callback): """ cache every file in the directory for future use """ cachefile = self.__get_filename__(directory)
print 'set: %s' % filename print self.current_cachefile
def set(self, filename, dirname, fullname, info): """ set a variable """ if dirname != self.current_cachedir: self.load_cache(dirname) self.current_objects[filename] = (info, os.stat(fullname)[stat.ST_MTIME]) print 'set: %s' % filename print self.current_cachefile self.cache_modified = True
print 'do %s' % filename
def get(self, filename, create=True): """ get info about a file """ fullname = filename dirname = os.path.dirname(filename) filename = os.path.basename(filename) if create: try: return self.find(filename, dirname, fullname) except FileNotFoundException: info = self.create(fullname) except FileOutdatedException: inf...
log.error('osd.py: Bitmap file "%s" doesnt exist!' % filename)
log.error('Image file "%s" doesn\'t exist!' % filename)
def load(url, size=None): """ Load a bitmap and return the image object. If width and height are given, the image is scaled to that. Setting only width or height will keep aspect ratio. """ if size == None: width, height = None, None else: width, height = size if not isinstance(url, (str, unicode)): # image already is...
log.exception('Unknown Problem while loading image %s' % String(url)) return None
log.exception('Problem while loading image %s' % String(url)) image = None
def load(url, size=None): """ Load a bitmap and return the image object. If width and height are given, the image is scaled to that. Setting only width or height will keep aspect ratio. """ if size == None: width, height = None, None else: width, height = size if not isinstance(url, (str, unicode)): # image already is...
path_tail_cdparanoia = '/track_being_rippped'
path_tail_cdparanoia = '/track_being_ripped'
def cd_backup_threaded(self, device, rip_format='mp3'): if DEBUG: print 'cd_backup_threaded function, rip_format = %s' %rip_format rip_format = rip_format album = 'default_album' artist = 'default_artist' genre = 'default_genre' dir_audio_default = "dir_audio_default" path_head = '' # Get the artist, album and song_na...
if DEBUG: print 'After Command = %s' %cdparanoia_command
if DEBUG: print 'cdparanoia: %s' %cdparanoia_command
def cd_backup_threaded(self, device, rip_format='mp3'): if DEBUG: print 'cd_backup_threaded function, rip_format = %s' %rip_format rip_format = rip_format album = 'default_album' artist = 'default_artist' genre = 'default_genre' dir_audio_default = "dir_audio_default" path_head = '' # Get the artist, album and song_na...
+ ' \'' \
+ ' \"' \
def cd_backup_threaded(self, device, rip_format='mp3'): if DEBUG: print 'cd_backup_threaded function, rip_format = %s' %rip_format rip_format = rip_format album = 'default_album' artist = 'default_artist' genre = 'default_genre' dir_audio_default = "dir_audio_default" path_head = '' # Get the artist, album and song_na...
+ '.wav\'' \ + ' \'' \
+ '.wav\"' \ + ' \"' \
def cd_backup_threaded(self, device, rip_format='mp3'): if DEBUG: print 'cd_backup_threaded function, rip_format = %s' %rip_format rip_format = rip_format album = 'default_album' artist = 'default_artist' genre = 'default_genre' dir_audio_default = "dir_audio_default" path_head = '' # Get the artist, album and song_na...
+ '.mp3\'' \
+ '.mp3\"' \
def cd_backup_threaded(self, device, rip_format='mp3'): if DEBUG: print 'cd_backup_threaded function, rip_format = %s' %rip_format rip_format = rip_format album = 'default_album' artist = 'default_artist' genre = 'default_genre' dir_audio_default = "dir_audio_default" path_head = '' # Get the artist, album and song_na...
if DEBUG: print 'lame_command = %s' %lame_command
if DEBUG: 'lame:= %s' %lame_command
def cd_backup_threaded(self, device, rip_format='mp3'): if DEBUG: print 'cd_backup_threaded function, rip_format = %s' %rip_format rip_format = rip_format album = 'default_album' artist = 'default_artist' genre = 'default_genre' dir_audio_default = "dir_audio_default" path_head = '' # Get the artist, album and song_na...
popup_string="Finished Copying CD" pop = PopupBox(text=popup_string)
time_taken = time.time() - begin + 300 min = int(time_taken/60) sec = int(time_taken%60) popup_string="Finished Copying CD in %im%is" % (min,sec) pop = AlertBox(text=popup_string)
def cd_backup_threaded(self, device, rip_format='mp3'): if DEBUG: print 'cd_backup_threaded function, rip_format = %s' %rip_format rip_format = rip_format album = 'default_album' artist = 'default_artist' genre = 'default_genre' dir_audio_default = "dir_audio_default" path_head = '' # Get the artist, album and song_na...
time.sleep(4) pop.destroy()
def cd_backup_threaded(self, device, rip_format='mp3'): if DEBUG: print 'cd_backup_threaded function, rip_format = %s' %rip_format rip_format = rip_format album = 'default_album' artist = 'default_artist' genre = 'default_genre' dir_audio_default = "dir_audio_default" path_head = '' # Get the artist, album and song_na...
special_chars = [ '\"', '\`', '\\\\', '/' ]
special_chars = [ '\"', '\`', '\\\\', '/','\'' ]
def replace_special_char(self, string, repl='-'): # Regular Expression Special Chars = . ^ $ * + ? { [ ] \ | ( ) special_chars = [ '\"', '\`', '\\\\', '/' ] """ special_chars = [ '~', '!', '@', '\\$', '%', \ '\\*', '\\|', ':', \ '\"', '\\?', '\`', '\\\\', \ ';', "\'", '/' ] """ # '~', '!', '@', '# ', '\\$', '%', ...
(new_string, num) = re.subn(pattern, '', new_string, count=0)
(new_string, num) = re.subn(pattern, '\\\'', new_string, count=0)
def replace_special_char(self, string, repl='-'): # Regular Expression Special Chars = . ^ $ * + ? { [ ] \ | ( ) special_chars = [ '\"', '\`', '\\\\', '/' ] """ special_chars = [ '~', '!', '@', '\\$', '%', \ '\\*', '\\|', ':', \ '\"', '\\?', '\`', '\\\\', \ ';', "\'", '/' ] """ # '~', '!', '@', '# ', '\\$', '%', ...
if attr in ("width", "height", "size", "format", "mode", "filename", "has_alpha", "rowstride", "get_pixel", "crop", "scale_preserve_aspect", "copy_rect"):
if attr in ("width", "height", "size", "format", "mode", "filename", "has_alpha", "rowstride", "get_pixel"):
def __getattr__(self, attr): if attr in ("width", "height", "size", "format", "mode", "filename", "has_alpha", "rowstride", "get_pixel", "crop", "scale_preserve_aspect", "copy_rect"): return getattr(self._image, attr) return super(Image, self).__getattr__(attr)
return Image( image._image.scale(size, src_pos, src_size) )
image = image.copy() image.scale(size, src_pos, src_size) return image
def scale(image, size, src_pos = (0, 0), src_size = (-1, -1)): return Image( image._image.scale(size, src_pos, src_size) )
return Image( image._image.crop(pos, size) )
image = image.copy() image.crop(pos, size) return image
def crop(image, pos, size): return Image( image._image.crop(pos, size) )
return Image( image._image.scale_preserve_aspect(size) )
image = image.copy() image.scale_preserve_aspect(size) return image
def scale_preserve_aspect(image, size): return Image( image._image.scale_preserve_aspect(size) )
osd.clearscreen() osd.drawstring('File "%s" not found!' % filename, 30, 280) osd.update()
skin.PopupBox('%s\nnot found!' % filename)
def play(self, mode, file, playlist, repeat=0):
for tv_channel_id, tv_display_name, tv_tuner_id in config.TV_CHANNELS:
for vals in config.TV_CHANNELS: tv_channel_id, tv_display_name, tv_tuner_id = vals[:3]
def get_tunerid(channel_id): tuner_id = None for tv_channel_id, tv_display_name, tv_tuner_id in config.TV_CHANNELS: if tv_channel_id == channel_id: return tv_tuner_id skin.PopupBox('Could not find TV channel %s' % channel_id) time.sleep(2) return None
if event == rc.EXIT:
if event == rc.EXIT or event == rc.MENU:
def eventhandler(event): print 'TV %s' % event if event == rc.EXIT: rc.app = None menuwidget.refresh() elif event == rc.SELECT or event == rc.PLAY: start_tv('tv', em.listing.last_to_listing[3].channel_id) else: em.eventhandler(event)
result = result + " " + str(m.title) + str(sub_title) + " at " + \
result = result + "- " + str(m.title) + str(sub_title) + " at " + \
def comingup(items=None): import tv.record_client as ri import time result = '' cachefile = '%s/upsoon' % (config.FREEVO_CACHEDIR) if (os.path.exists(cachefile) and \ (abs(time.time() - os.path.getmtime(cachefile)) < 3600)): cache = open(cachefile,'r') for a in cache.readlines(): result = result + a cache.close() ret...
self._image = self.scale_preserve_aspect( (w, h) )
self._image = self.scale_preserve_aspect( (w, h) )._image
def thumbnail(self, (w, h)): """ Generates a thumbnail of the image, REPLACING the current image. This simulates the PIL thumbnail function. """ if self.width < w and self.height < h: return
def cache_file(self, filename, cachename): image = Image.open(filename) width, height = image.size scale_x = scale_y = 1.0 if width > osd.width: scale_x = float(osd.width) / width if height > osd.height: scale_y = float(osd.height) / height scale = min(scale_x, scale_y) new_w, new_h = int(scale*width), int(scale*hei...
def view(self, filename, number, playlist, zoom=0, rotation=0):
def cache_file(self, filename, cachename): image = Image.open(filename) width, height = image.size
self.rotation = 0
self.rotation = rotation
def view(self, filename, number, playlist, zoom=0):
if 1: osd.loadbitmap(filename) image = Image.open(filename) width, height = image.size bbx = bby = bbw = bbh = 0 if zoom: width = width / 3 height = height / 3
osd.loadbitmap(filename) image = Image.open(filename) width, height = image.size bbx = bby = bbw = bbh = 0 if zoom: if 'OSD_SDL' in dir(config) and self.rotation == 90: bb = { 1:(2,0), 2:(2,1), 3:(2,2), 4:(1,0), 5:(1,1), 6:(1,2), 7:(0,0), 8:(0,1), 9:(0,2) } elif 'OSD_SDL' in dir(config) and self.rotation == 180: b...
def view(self, filename, number, playlist, zoom=0):
h, v = bb[zoom] bbx = [0, width, 2*width][h] bby = [0, height, 2*height][v] bbw = width bbh = height
h, v = bb[zoom] bbcx = ([1, 3, 5][h]) * width / 6 bbcy = ([1, 3, 5][v]) * height / 6 if 'OSD_SDL' in dir(config) and self.rotation % 180: scale_x = float(osd.width) / (height / 3) scale_y = float(osd.height) / (width / 3) scale = min(scale_x, scale_y) bbw = min(max((width / 3) * scale, osd.height), width) / scale...
def view(self, filename, number, playlist, zoom=0):
x = (osd.width - new_w) / 2 y = (osd.height - new_h) / 2 print width, height, scale, new_w, new_h, x, y osd.clearscreen(color=osd.COL_BLACK)
x = (osd.width - new_w) / 2 y = (osd.height - new_h) / 2 osd.clearscreen(color=osd.COL_BLACK) if 'OSD_SDL' in dir(config): osd.drawbitmap(filename, x, y, scale, bbx, bby, bbw, bbh, rotation = self.rotation) else:
def view(self, filename, number, playlist, zoom=0):
self.drawosd() osd.update() if self.playlist != []: pos = self.playlist.index(self.filename) pos = (pos+1) % len(self.playlist) filename = self.playlist[pos] image = Image.open(filename) width, height = image.size scale_x = scale_y = 1.0 if width > osd.width: scale_x = float(osd.width) / width if height > osd.heig...
self.drawosd()
def view(self, filename, number, playlist, zoom=0):
image_file = (config.FREEVO_CACHEDIR + '/' + os.path.basename('image-viewer-%s.png' % pos)) if not os.path.isfile(image_file): self.cache_file(filename, image_file)
image = Image.open(filename) width, height = image.size scale_x = scale_y = 1.0 if width > osd.width: scale_x = float(osd.width) / width if height > osd.height: scale_y = float(osd.height) / height scale = min(scale_x, scale_y) osd.zoombitmap(filename, scale)
def view(self, filename, number, playlist, zoom=0):
pos = self.playlist.index(self.filename) image_file = (config.FREEVO_CACHEDIR + '/' + os.path.basename('image-viewer-%s.png' % pos))
def eventhandler(self, event):
osd.drawstring('please wait...', osd.width/2 - 60, osd.height/2 - 10, fgcolor=osd.COL_ORANGE, bgcolor=osd.COL_BLACK) osd.update() osd.clearscreen(color=osd.COL_BLACK)
def eventhandler(self, event):
self.rotation = self.rotation - 90 % 360 else: self.rotation = self.rotation + 90 % 360 image = Image.open(self.filename).rotate(self.rotation) width, height = image.size scale_x = scale_y = 1.0 if width > osd.width: scale_x = float(osd.width) / width if height > osd.height: scale_y = float(osd.height) / height scal...
self.rotation = (self.rotation + 270) % 360 else: self.rotation = (self.rotation + 90) % 360 if 'OSD_SDL' in dir(config): image = Image.open(self.filename) if self.rotation % 180: height, width = image.size else: width, height = image.size scale_x = scale_y = 1.0 if width > osd.width: scale_x = float(osd.width) / w...
def eventhandler(self, event):
self.playlist, zoom=self.zoom)
self.playlist, zoom=self.zoom, rotation = self.rotation)
def eventhandler(self, event):
self.playlist, zoom=0)
self.playlist, zoom=0, rotation = self.rotation)
def eventhandler(self, event):
cachefile = vfs.getoverlay(os.path.join(dirname, self.filename)) if not os.path.exists(dirname): os.makedirs(dirname) return cachefile
cachefile = vfs.getoverlay(dirname) if not os.path.exists(cachefile): os.makedirs(cachefile) return os.path.join(cachefile, self.filename)
def __get_filename__(self, dirname): """ return the cache filename for that directory/device """ cachefile = vfs.getoverlay(os.path.join(dirname, self.filename)) if not os.path.exists(dirname): os.makedirs(dirname) return cachefile
if freevo_changed < 1:
if freevo_changed < 2:
def load_cache(dirname): """ load the cache for dirname """ mmpython_cache.load_cache(dirname) meta_cache.load_cache(dirname)
if config.MPLAYER_DEBUG: fname_out = os.path.join(config.LOGDIR, 'tvtime_stdout.log') fname_err = os.path.join(config.LOGDIR, 'tvtime_stderr.log') try: self.log_stdout = open(fname_out, 'a') self.log_stderr = open(fname_err, 'a') except IOError: print print (('ERROR: Cannot open "%s" and "%s" for ' + 'TVTime logging!')...
def __init__(self, (app)): if config.MPLAYER_DEBUG: fname_out = os.path.join(config.LOGDIR, 'tvtime_stdout.log') fname_err = os.path.join(config.LOGDIR, 'tvtime_stderr.log') try: self.log_stdout = open(fname_out, 'a') self.log_stderr = open(fname_err, 'a') except IOError: print print (('ERROR: Cannot open "%s" and "%s"...
def kill(self): self.write('quit\n') childapp.ChildApp.kill(self, signal.SIGINT) if DEBUG: print 'Killing tvtime' if config.MPLAYER_DEBUG: self.log_stdout.close() self.log_stderr.close()
def __init__(self, (app)): if config.MPLAYER_DEBUG: fname_out = os.path.join(config.LOGDIR, 'tvtime_stdout.log') fname_err = os.path.join(config.LOGDIR, 'tvtime_stderr.log') try: self.log_stdout = open(fname_out, 'a') self.log_stderr = open(fname_err, 'a') except IOError: print print (('ERROR: Cannot open "%s" and "%s"...
if config.MPLAYER_DEBUG: try: self.log_stdout.write(line + '\n') except ValueError: pass
def stdout_cb(self, line): if not len(line) > 0: return # XXX Needed because tvtime grabs focus unless used with freevo -fs events = { 'n' : em.MIXER_VOLDOWN, 'm' : em.MIXER_VOLUP, 'c' : em.TV_CHANNEL_UP, 'v' : em.TV_CHANNEL_DOWN, 'Escape' : em.STOP, 'd' : em.TOGGLE_OSD, '_' : em.Event(em.BUTTON, arg='PREV_CHAN'), '0' ...
else:
elif type != 'games':
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
self.outicon = os.path.join(settings.icon_dir, skin_info.icon)
self.outicon = os.path.join(settings.icon_dir, skin_info.outicon)
def __init__(self, parent=None, info=None, skin_type=None): """ Init the item. Sets all needed variables, if parent is given also inherit some settings from there. Set self.info to info if given. """ if not hasattr(self, 'type'): self.type = None # e.g. video, audio, dir, playlist self.name = '' ...
print '\r%-70s %3d%%' % (self.txt, (self.pos * 100 / self.num_changes)),
if self_num_changes != 0: progress = '%3d%%' % (self.pos * 100 / self.num_changes) else: progress = '??%%' print '\r%-70s %s' % (self.txt, progress),
def callback(self): print '\r%-70s %3d%%' % (self.txt, (self.pos * 100 / self.num_changes)), sys.__stdout__.flush() self.pos += 1
cf_norm, cf_input, cf_clist, cf_device = config.TV_SETTINGS.split()
def Play(self, mode, tuner_channel=None, channel_change=0):
command = 'tvtime'
def Play(self, mode, tuner_channel=None, channel_change=0):
self.thread.app.setchannel(tuner_channel)
def Play(self, mode, tuner_channel=None, channel_change=0):
self.write('quit')
self.write('quit\n')
def kill(self): # Use SIGINT instead of SIGKILL to make sure TVTime shuts # down properly and releases all resources before it gets # reaped by childapp.kill().wait() self.write('quit') childapp.ChildApp.kill(self, signal.SIGINT)
self.write('\n')
self.write('enter\n')
def setchannel(self, channelno): ch_digits = list(str(channelno)) # XXX Only works for numerical channels! for digit in ch_digits: cmd = 'CHANNEL_%s\n' % digit self.write(cmd) self.write('\n')
if (osd.sdl_driver == 'dxr3'): if DEBUG: print "Stopping Display for Video Playback on DXR3" osd.stopdisplay()
if DEBUG: print "Stopping Display for tvtime" osd.stopdisplay()
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'play': # The DXR3 device cannot be shared between our SDL session # and TVTime. if (osd.sdl_driver == 'dxr3'): if DEBUG: print "Stopping Display for Video Playback on DXR3" osd.stopdisplay() if DEBUG: print ...
if osd.sdl_driver == 'dxr3': osd.restartdisplay() osd.update() print "Display back online"
osd.restartdisplay() osd.update() print "Display back online"
def run(self): while 1: if self.mode == 'idle': self.mode_flag.wait() self.mode_flag.clear() elif self.mode == 'play': # The DXR3 device cannot be shared between our SDL session # and TVTime. if (osd.sdl_driver == 'dxr3'): if DEBUG: print "Stopping Display for Video Playback on DXR3" osd.stopdisplay() if DEBUG: print ...
print 'STRING: Found "%s"' % string
def _renderstring(self, string, font, ptsize, fgcolor, bgcolor):
print 'STRING: missing "%s"' % string
def _renderstring(self, string, font, ptsize, fgcolor, bgcolor):
_debug_('TVGUIDE EVENT is %s' % event)
_debug_('TVGUIDE EVENT is %s' % event, 2)
def eventhandler(self, event): _debug_('TVGUIDE EVENT is %s' % event)
media.item = DirItem(media.mountdir, None)
media.item = DirItem(media.mountdir, None, create_metainfo=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'...
print 'index error for %s %s' % (display_style, widget_type)
print 'index error for %s %s' % (self.display_style, widget_type)
def init_vars(self, settings, display_type, widget_type = 'menu'): """ check which layout is used and set variables for the object """ redraw = self.redraw self.settings = settings
else: c = self.bg_color.get_color_sdl() a = self.bg_color.get_alpha() box = pygame.Surface(self.get_size(), 0, 32) box.fill(c) box.set_alpha(a)
sel_box.fill(c) sel_box.set_alpha(a) box.blit(sel_box, (0,0))
def _draw(self): """ The actual internal draw function.
self.album = str(vc['ALBUM'][0])
self.album = vc['ALBUM'][0].encode('latin-1')
def set_info_ogg(self, file): """ Sets all the info variables with useful info from the oggfile.
self.artist = str(vc['ARTIST'][0])
self.artist = vc['ARTIST'][0].encode('latin-1')
def set_info_ogg(self, file): """ Sets all the info variables with useful info from the oggfile.
self.title = str(vc['TITLE'][0])
self.title = vc['TITLE'][0].encode('latin-1')
def set_info_ogg(self, file): """ Sets all the info variables with useful info from the oggfile.
def shutdown(menuw=None, arg=None):
def shutdown(menuw=None, arg=None, allow_sys_shutdown=1):
def shutdown(menuw=None, arg=None): osd.clearscreen(color=osd.COL_BLACK) osd.drawstring('shutting down...', osd.width/2 - 90, osd.height/2 - 10, fgcolor=osd.COL_ORANGE, bgcolor=osd.COL_BLACK) osd.update() time.sleep(0.5) osd.shutdown() # SDL must be shutdown to restore video modes etc # XXX temporary kludge so it won...
if 'ENABLE_SHUTDOWN_SYS' in dir(config):
if allow_sys_shutdown and 'ENABLE_SHUTDOWN_SYS' in dir(config):
def shutdown(menuw=None, arg=None): osd.clearscreen(color=osd.COL_BLACK) osd.drawstring('shutting down...', osd.width/2 - 90, osd.height/2 - 10, fgcolor=osd.COL_ORANGE, bgcolor=osd.COL_BLACK) osd.update() time.sleep(0.5) osd.shutdown() # SDL must be shutdown to restore video modes etc # XXX temporary kludge so it won...
os.system('killall -9 freevo_rt 2&> /dev/null')
os.system('killall -9 freevo_python 2&> /dev/null')
def shutdown(menuw=None, arg=None): osd.clearscreen(color=osd.COL_BLACK) osd.drawstring('shutting down...', osd.width/2 - 90, osd.height/2 - 10, fgcolor=osd.COL_ORANGE, bgcolor=osd.COL_BLACK) osd.update() time.sleep(0.5) osd.shutdown() # SDL must be shutdown to restore video modes etc # XXX temporary kludge so it won...
os.system('killall -9 freevo_rt 2&> /dev/null')
os.system('killall -9 freevo_python 2&> /dev/null')
def signal_handler(sig, frame): if sig == signal.SIGTERM: osd.clearscreen(color=osd.COL_BLACK) osd.shutdown() # SDL must be shutdown to restore video modes etc # XXX kludge to shutdown the runtime version (no linker) os.system('killall -9 freevo_rt 2&> /dev/null') os.system('killall -9 freevo_xwin 2&> /dev/null') # X...
'REW' : Event(SEEK, arg=10), 'FFWD' : Event(SEEK, arg=-10),
'REW' : Event(SEEK, arg=-10), 'FFWD' : Event(SEEK, arg=10),
def __cmp__(self, other): """ compare function, return 0 if the objects are identical, 1 otherwise """ if not other: return 1 if isinstance(other, Event): return self.name != other.name return self.name != other
fxd.info['year'] = time.strftime('%m-%d %I:%M', time.localtime(rec_prog.start))
fxd.info['year'] = time.strftime('%m-%d ' + config.TV_TIMEFORMAT, time.localtime(rec_prog.start))
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 = myfilename items += [( self.bookmark_menu, 'Bookmark: %s' % (os.path.basename(m.filename)))]
self.bookmarkfile = myfilename items += [( self.bookmark_menu, 'Bookmarks')] else: if os.path.exists(util.get_bookmarkfile(self.filename)): self.bookmarkfile = util.get_bookmarkfile(self.filename) items += [( self.bookmark_menu, 'Bookmarks ')]
def actions(self): """ return a list of possible actions on this item. """ items = [ (self.play, 'Play'), (self.settings, 'Change play settings') ] if self.variants: items += [ (self.show_variants, 'Show variants') ]
bookmarkfile = self.current_subitem
bookmarkfile = self.bookmarkfile
def bookmark_menu(self,arg=None, menuw=None): """ Bookmark list """ bookmarkfile = self.current_subitem items = [] m = open(bookmarkfile,'r') lines = open(bookmarkfile,'r').readlines() for line in lines: file = copy.copy(self) sec = int(line) hour = int(sec/3600) min = int(sec/60) sec = int(sec%60) file.filename = '%0....
m = open(bookmarkfile,'r') lines = open(bookmarkfile,'r').readlines()
lines = open(str(bookmarkfile),'r').readlines()
def bookmark_menu(self,arg=None, menuw=None): """ Bookmark list """ bookmarkfile = self.current_subitem items = [] m = open(bookmarkfile,'r') lines = open(bookmarkfile,'r').readlines() for line in lines: file = copy.copy(self) sec = int(line) hour = int(sec/3600) min = int(sec/60) sec = int(sec%60) file.filename = '%0....
file.filename = '%0.2d:%0.2d:%0.2d' % (hour,min,sec) file.name = 'Jump to %s' % (file.filename) file.mplayer_options += " -ss %s" % (file.filename)
time = '%0.2d:%0.2d:%0.2d' % (hour,min,sec) file.name = 'Jump to %s' % (time) file.mplayer_options += " -ss %s" % (time)
def bookmark_menu(self,arg=None, menuw=None): """ Bookmark list """ bookmarkfile = self.current_subitem items = [] m = open(bookmarkfile,'r') lines = open(bookmarkfile,'r').readlines() for line in lines: file = copy.copy(self) sec = int(line) hour = int(sec/3600) min = int(sec/60) sec = int(sec%60) file.filename = '%0....
if os.stat(filename)[stat.ST_SIZE] > 1000000: name = os.path.join(os.path.dirname(filename), '.' + os.path.basename(filename) + '.freevo~')
if os.path.isdir(filename) or \ os.stat(filename)[stat.ST_SIZE] > 1000000: base = '.' + os.path.basename(filename) + '.freevo~' name = os.path.join(os.path.dirname(filename), base)
def unlink(filename): try: if os.stat(filename)[stat.ST_SIZE] > 1000000: name = os.path.join(os.path.dirname(filename), '.' + os.path.basename(filename) + '.freevo~') os.rename(filename, name) popen.Process(['rm', '-rf', name]) else: os.unlink(filename) except (OSError, IOError): log.error('can\'t delete %s' % filename...
except (OSError, IOError): log.error('can\'t delete %s' % filename)
except (OSError, IOError), e: log.error('can\'t delete %s: %s' % (filename, e))
def unlink(filename): try: if os.stat(filename)[stat.ST_SIZE] > 1000000: name = os.path.join(os.path.dirname(filename), '.' + os.path.basename(filename) + '.freevo~') os.rename(filename, name) popen.Process(['rm', '-rf', name]) else: os.unlink(filename) except (OSError, IOError): log.error('can\'t delete %s' % filename...
ready = False
def shutdown(): """ shutdown all running childapps """ global __all_childapps__ global running_children global freevo_shutdown if not len(__all_childapps__): return print '%d child(s) still running, terminate them' % len(__all_childapps__) freevo_shutdown = True while running_children: print 'shutting down %s' % run...
self.ready = True
def __init__(self, app, debugname=None, doeslogging=0): global __all_childapps__ __all_childapps__.append(self)
print _( 'logging child to "%s"' ) % logger
print String(_( 'logging child to "%s"' )) % logger
def __init__(self, name, fp, callback, logger=None, doeslogging=0): threading.Thread.__init__(self) self.name = name self.fp = fp self.callback = callback self.logger = None if logger and doeslogging: logger = os.path.join(config.LOGDIR, '%s-%s.log' % (logger, name)) try: try: os.unlink(logger) except: pass self.logger...
print _('ERROR') + ': ' + _( 'Cannot open "%s" for logging!') % logger print _('Set CHILDAPP_DEBUG=0 in local_conf.py, or make %s writable!' ) % \
print String(_('ERROR')) + ': ' + String(_( 'Cannot open "%s" for logging!')) % logger print String(_('Set CHILDAPP_DEBUG=0 in local_conf.py, or make %s writable!' )) % \
def __init__(self, name, fp, callback, logger=None, doeslogging=0): threading.Thread.__init__(self) self.name = name self.fp = fp self.callback = callback self.logger = None if logger and doeslogging: logger = os.path.join(config.LOGDIR, '%s-%s.log' % (logger, name)) try: try: os.unlink(logger) except: pass self.logger...
print
def __init__(self, name, fp, callback, logger=None, doeslogging=0): threading.Thread.__init__(self) self.name = name self.fp = fp self.callback = callback self.logger = None if logger and doeslogging: logger = os.path.join(config.LOGDIR, '%s-%s.log' % (logger, name)) try: try: os.unlink(logger) except: pass self.logger...
if os.path.isfile(self.current_cachefile):
if self.current_cachefile and os.path.isfile(self.current_cachefile):
def save_cache(self): """ Save a modified cache file. This version removed all entries having no informations and removes to cachefile if no object has informations anymore. This speeds up searching. """ for key in copy.copy(self.current_objects): # delete all empty objects if not self.current_objects[key][0]: del self...
start = time.strftime('%I:%M%p', time.localtime(self.start)) return s + u' at %s' % Unicode(start)
return s
def __unicode__(self): if self.description.has_key('title') and self.description['title']: s = self.description['title'] else: s = 'No Title' if self.description.has_key('episode') and self.description['episode']: s += u' %s' % self.description['episode'] if self.description.has_key('subtitle') and \ self.description['...
self.comingup = _('The recordserver is down')
self.comingup = '' self.running = ''
def __init__(self): self.last_update = time.time() self.__recordings = {} self.server = None mcomm.register_entity_notification(self.__entity_update) mcomm.register_event('record.list.update', self.__list_update) self.comingup = _('The recordserver is down')
self.comingup = _('The recordserver is down')
self.comingup = '' self.running = ''
def __entity_update(self, entity): if not entity.present and entity == self.server: log.info('recordserver lost') self.comingup = _('The recordserver is down') self.server = None return
today = [] tomorrow = [] later = [] date0 = time.localtime()[:3] date1 = time.localtime(time.time() + 60 * 60 * 24)[:3] for what in reclist: if time.localtime(what.start)[:3] == date0: today.append(what) elif time.localtime(what.start)[:3] == date1: tomorrow.append(what) elif what.start > time.time(): later.append(wh...
def __request_description(self): if not self.server: return for key in self.__recordings: if not self.__recordings[key].description: cb = self.__describe_callback self.server.recording_describe(self.__recordings[key].id, callback=cb) return log.info('got all recording descriptions')
if len(today) > 0: self.comingup += _('Today') + u':\n' for r in today: self.comingup += u'%s\n' % Unicode(r) if len(tomorrow) > 0: self.comingup += _('Tomorrow') + u':\n' for r in tomorrow: self.comingup += u' %s\n' % Unicode(r) if len(later) > 0: self.comingup += _('This Week') + u':\n' for r in later: self.comingup...
self.running = '' for rec in reclist: if rec.status == SCHEDULED: self.comingup += u'%s\n' % Unicode(rec) if rec.status == RECORDING: self.running += u'%s\n' % Unicode(rec)
def __request_description(self): if not self.server: return for key in self.__recordings: if not self.__recordings[key].description: cb = self.__describe_callback self.server.recording_describe(self.__recordings[key].id, callback=cb) return log.info('got all recording descriptions')