def __init__(self): """ Register command to normal fxd item parser to enable <command> tags in fxd files in every menu """ plugin.register_callback('fxditem', [], 'command', fxdparser) plugin.Plugin.__init__(self)
def __init__(self): plugin.MimetypePlugin.__init__(self) self.display_type = [ 'audio' ] # register the callbacks plugin.register_callback('fxditem', ['audio'], 'audio', self.fxdhandler) # activate the mediamenu for audio plugin.activate('mediamenu', level=plugin.is_active('audio')[2], args='audio')
def __init__(self): plugin.MimetypePlugin.__init__(self) self.display_type = [ 'image' ] # register the callbacks plugin.register_callback('fxditem', ['image'], 'slideshow', self.fxdhandler) # activate the mediamenu for image plugin.activate('mediamenu', level=plugin.is_active('image')[2], args='image')
def __init__(self): logger.debug('audio.PluginInterface.__init__()') plugin.MimetypePlugin.__init__(self) self.display_type = [ 'audio' ] # register the callbacks plugin.register_callback('fxditem', ['audio'], 'audio', self.fxdhandler) # activate the mediamenu for audio plugin.activate('mediamenu', level=plugin.is_active('audio')[2], args='audio')
def __init__(self): plugin.MimetypePlugin.__init__(self) self.display_type = ['image'] # register the callbacks plugin.register_callback('fxditem', ['image'], 'slideshow', self.fxdhandler) # activate the mediamenu for image plugin.activate('mediamenu', level=plugin.is_active('image')[2], args='image')
def __init__(self): plugin.MimetypePlugin.__init__(self) self.display_type = [ 'video' ] if config.AUDIO_SHOW_VIDEOFILES: self.display_type = [ 'video', 'audio' ] # load the fxd part of video import fxdhandler plugin.register_callback('fxditem', ['video'], 'movie', fxdhandler.parse_movie) plugin.register_callback('fxditem', ['video'], 'disc-set', fxdhandler.parse_disc_set) # activate the mediamenu for video plugin.activate('mediamenu', level=plugin.is_active('video')[2], args='video')
return [ ( self.browse, _('Browse list')) ] def browse(self, arg=None, menuw=None): """ show all items """ import menu moviemenu = menu.Menu(self.name, self.items, item_types=self.display_type) menuw.pushmenu(moviemenu) def container_callback(fxd, node): """ handle <container> tags. Inside this tag all other base level tags like <audio>, <movie> and <container> itself will be parsed as normal. """ c = Container(fxd, node) if c.items: fxd.getattr(None, 'items', []).append(c) # ------------------------------------------------------------------------------------- plugin.register_callback('fxditem', None, 'container', container_callback) mimetype = Mimetype() plugin.activate(mimetype, level=0)
if encjob is None: #print 'encjob failed' return if encjob.crop is None: #print 'no crop result' return videos = fxd.get_children(node, 'video', 0) for video in videos: #print video.__dict__ files = fxd.get_children(video, 'file', 0) for file in files: #print file.__dict__ fxd.setattr(file, 'mplayer-options', '-vf crop=%s' % encjob.crop) plugin.register_callback('fxditem', ['video'], 'movie', fxdhandler.parse_movie) plugin.register_callback('fxditem', ['video'], 'disc-set', fxdhandler.parse_disc_set) print checking('checking cropdetect'), sys.__stdout__.flush() fxdfiles = [] for dirname in defaults['directory']: if os.path.isdir(dirname): if defaults['recursive']: fxdfiles += util.match_files_recursively( dirname, fxditem.mimetype.suffix()) else: fxdfiles += util.match_files(dirname, fxditem.mimetype.suffix())
def __init__(self): plugin.MimetypePlugin.__init__(self) # register the callback plugin.register_callback('fxditem', [], 'playlist', self.fxdhandler)
if encjob is None: #print 'encjob failed' return if encjob.crop is None: #print 'no crop result' return videos = fxd.get_children(node, 'video', 0) for video in videos: #print video.__dict__ files = fxd.get_children(video, 'file', 0) for file in files: #print file.__dict__ fxd.setattr(file, 'mplayer-options', '-vf crop=%s' % encjob.crop) plugin.register_callback('fxditem', ['video'], 'movie', fxdhandler.parse_movie) plugin.register_callback('fxditem', ['video'], 'disc-set', fxdhandler.parse_disc_set) print checking('checking cropdetect'), sys.__stdout__.flush() fxdfiles = [] for dirname in defaults['directory']: if os.path.isdir(dirname): if defaults['recursive']: fxdfiles += util.match_files_recursively(dirname, fxditem.mimetype.suffix()) else: fxdfiles += util.match_files(dirname, fxditem.mimetype.suffix()) else: fxdfiles += [ os.path.abspath(dirname) ]
def cache_cropdetect(): """ cache all video files for crop detection """ import encodingcore import kaa.metadata # load the fxd part of video import fxdhandler plugin.register_callback('fxditem', ['video'], 'movie', fxdhandler.parse_movie) plugin.register_callback('fxditem', ['video'], 'disc-set', fxdhandler.parse_disc_set) print 'checking cropdetect...................................', print sys.__stdout__.flush() suffixes = set(config.VIDEO_MPLAYER_SUFFIX).union(config.VIDEO_XINE_SUFFIX) files = [] fxd = [] for d in config.VIDEO_ITEMS: if d.__class__ != tuple: continue if not os.path.isdir(d[1]): continue try: files += util.match_files_recursively(d[1], suffixes) fxd += util.match_files_recursively(d[1], fxditem.mimetype.suffix()) except: pass def lowercaseSort(lhs, rhs): lhs, rhs = lhs.lower(), rhs.lower() return cmp(lhs, rhs) fxd.sort(lowercaseSort) files = util.misc.unique(files) files.sort(lowercaseSort) for filename in copy.copy(files): try: info = kaa.metadata.parse(filename) if not info: print 'ERROR: "%s" has no metadata' % (filename) continue if info.length < 5 or info.length > 5 * 60 * 60: print 'ERROR: "%s" has invalid length of %s' % (filename, info.length) continue encjob = encodingcore.EncodingJob(None, None, None, None) encjob.source = filename encjob.info = info encjob.length = info.length encjob._CropDetect() encjob.thread.join(10.0) if encjob.thread.isAlive(): encjob.thread.kill_pipe() encjob.thread.join(10.0) if encjob.thread.isAlive(): print 'CRITICAL: "%s" thread is still alive (pid %s)' % ( filename, encjob.pipe.pid) print print dir(encjob.thread) print print encjob.thread.__dict__ print continue else: print 'ERROR: "%s" cropdetect thread was killed' % ( filename) continue print filename, info.mime, info.length, encjob.crop, encjob.cropres except Exception, e: print 'ERROR: "%s" failed: %s' % (filename, e)
def __init__(self): # register command to normal fxd item parser # to enable <command> tags in fxd files in every menu plugin.register_callback('fxditem', [], 'command', fxdparser) plugin.MainMenuPlugin.__init__(self)
""" actions for this item """ return [(self.browse, _("Browse list"))] def browse(self, arg=None, menuw=None): """ show all items """ import menu moviemenu = menu.Menu(self.name, self.items, item_types=self.display_type) menuw.pushmenu(moviemenu) def container_callback(fxd, node): """ handle <container> tags. Inside this tag all other base level tags like <audio>, <movie> and <container> itself will be parsed as normal. """ c = Container(fxd, node) if c.items: fxd.getattr(None, "items", []).append(c) # ------------------------------------------------------------------------------------- plugin.register_callback("fxditem", None, "container", container_callback) mimetype = Mimetype() plugin.activate(mimetype, level=0)