def __init__(self): logger.log( 9, 'games.PluginInterface.__init__()') plugin.MimetypePlugin.__init__(self) self.display_type = [ 'games' ] # activate the mediamenu for image plugin.activate('mediamenu', level=plugin.is_active('games')[2], args='games')
def __init__(self): plugin.DaemonPlugin.__init__(self) self.icecast_pid = None self.ices_pid = None plugin.activate('icecast.IcecastChanger') try: # start icecast mycmd = os.path.basename(config.ICECAST_CMD) self.icecast_pid = os.spawnl(os.P_NOWAIT, config.ICECAST_CMD, mycmd, '-d', config.ICECAST_CONF_DIR) time.sleep(1) # start ices mycmd = os.path.basename(config.ICES_CMD) args = config.ICES_OPTIONS args.insert(0, mycmd) args.append('-F') args.append(config.ICES_DEF_LIST) olddir = os.getcwd() newdir = os.path.dirname(config.ICES_DEF_LIST) os.chdir(newdir) self.ices_pid = os.spawnv(os.P_NOWAIT, config.ICES_CMD, args) os.chdir(olddir) except: print 'Crash!' traceback.print_exc() sleep(1)
def __init__(self): plugin.MainMenuPlugin.__init__(self) self._type = 'mainmenu_tv' self.parent = None self.prog_menu = SearchProgramMenu() plugin.register(self.prog_menu, "Search Program") plugin.activate(self.prog_menu)
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 = [ '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): _debug_('games.PluginInterface.__init__()', 2) plugin.MimetypePlugin.__init__(self) self.display_type = ['games'] # activate the mediamenu for image plugin.activate('mediamenu', level=plugin.is_active('games')[2], args='games')
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): if not config.DVDCOPY_DIR: self.reason = 'DVDCOPY_DIR not set' return if not config.CONF.dvdbackup: self.reason = 'dvdbackup not detected' return plugin.ItemPlugin.__init__(self) #Activate IdleBar monitor plugin. if config.DVDCOPY_IDLEBAR: idlebar_plugin = DVDCopyIdleBar() plugin.activate(idlebar_plugin, level=40)
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')
def __init__(self): if not udisks_available: self.reason = "Failed to import dbus" return plugin.Plugin.__init__(self) self.devices = Devices() plugin.activate(self.devices, 'video') plugin.activate(self.devices, 'audio') plugin.activate(self.devices, 'image') plugin.activate(self.devices, 'games')
def __init__(self): """ normal plugin init, but sets _type to 'mainmenu_tv' """ if not config.TV_RECORD_DIR: self.reason = 'TV_RECORD_DIR is not set' return if not os.path.isdir(config.TV_RECORD_DIR): self.reason = 'TV_RECORD_DIR "%s" is not a directory' % (config.TV_RECORD_DIR) return global disk_manager plugin.MainMenuPlugin.__init__(self) self._type = 'mainmenu_tv' self.parent = None disk_manager = DiskManager(int(config.TVRM_MINIMUM_DISK_FREE) * 1024 * 1024) plugin.register(disk_manager, "DiskManager") plugin.activate(disk_manager)
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)
import plugin class PluginInterface(plugin.Plugin): def __init__(self, arg1, arg2='foo'): plugin.Plugin.__init__(self) plugin.activate('foo', args=('1',)) plugin.activate('foo', args=('1', 'bar'))
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ----------------------------------------------------------------------- import config import plugin #import logging #logger = logging.getLogger("freevo.skin.xbmc.config") # failsafe if config.SKIN_XML_FILE == 'xbmc': if plugin.is_active('audio.detachbar'): plugin.remove('audio.detachbar') if not plugin.is_active('audio.detachdialog'): plugin.activate('audio.detachdialog') # ====================================================================== # Freevo SKIN settings: # ====================================================================== # # Skin file that contains the actual skin code. This is imported # from skin.py # SKIN_MODULE = 'xbmc' # # XML file used for the dialog skins. # DIALOG_SKIN_XML_FILE = 'xbmc'
new_files = self.listoverlay() for f in self.files: if not f in new_files: changed = True break else: for f in new_files: if not f in self.files: changed = True break else: changed = True if changed: _debug_('directory has changed') self.item.build(menuw=self.menuw, arg='update') self.last_time = vfs.mtime(self.dir) self.item.__dirwatcher_last_time__ = self.last_time self.files = self.listoverlay() self.item.__dirwatcher_last_files__ = self.files def poll(self): if self.dir and self.menuw and \ self.menuw.menustack[-1] == self.item_menu and not rc.app(): self.scan() # and activate that DaemonPlugin dirwatcher = Dirwatcher() plugin.activate(dirwatcher)
def __init__(self): plugin.MimetypePlugin.__init__(self) self.display_type = [ 'games' ] # activate the mediamenu for image plugin.activate('mediamenu', level=plugin.is_active('games')[2], args='games')
def __init__(self): logger.log( 9, 'PluginInterface.__init__()') plugin.MainMenuPlugin.__init__(self) self.reminders = Reminders() plugin.register(self.reminders, "TVReminders") plugin.activate(self.reminders)
def __init__(self): plugin.ItemPlugin.__init__(self) self.skin = skin.get_singleton() self.item = None self.plugin_name = 'video.mplayer_ppmenu.item' self.default_str = _('Default') if hasattr(config, 'MPLAYER_VF_PROGRESSIVE_OPTS'): self.vfp_opts = config.MPLAYER_VF_PROGRESSIVE_OPTS else: self.vfp_opts = [ (self.default_str, ''), ('LQ', 'pp=de'), ('HQ', 'pp=ac/al'), ('HQ denoise3d', 'pp=ac/al,hqdn3d=2:2:4'), ('HQ denoise3d+unsharp', 'pp=ac/al,hqdn3d=2:2:4,unsharp=l3x3:0.5'), ('HQ denoise3d+unsharp+noise', 'pp=ac/al,hqdn3d=2:2:4,unsharp=l3x3:0.5,noise=12uah:5uah'), ('HD content', 'pp=de -lavdopts fast:skiploopfilter=all:threads=2') ] self.vfp_opt = None self.vfp_args_def = config.MPLAYER_VF_PROGRESSIVE self.vfp_title_def = _('Video PP - %s') self.vfp_title = self.vfp_title_def % self.default_str if hasattr(config, 'MPLAYER_VF_INTERLACED_OPTS'): self.vfi_opts = config.MPLAYER_VF_INTERLACED_OPTS else: self.vfi_opts = [ (self.default_str, ''), ('LQ', 'pp=de'), ('HQ', 'pp=ac/al'), ('HQ denoise3d', 'pp=ac/al,hqdn3d=2:2:4'), ('HQ denoise3d+unsharp', 'pp=ac/al,hqdn3d=2:2:4,unsharp=l3x3:0.5'), ('HQ denoise3d+unsharp+noise', 'pp=ac/al,hqdn3d=2:2:4,unsharp=l3x3:0.5,noise=12uah:5uah') ] self.vfi_opt = None self.vfi_args_def = config.MPLAYER_VF_PROGRESSIVE self.vfi_title_def = _('Video PP - %s') self.vfi_title = self.vfi_title_def % self.default_str # Aspect ratio properties # self.cnt = 0 if hasattr(config, 'MPLAYER_ARGS_DEF'): self.args_def = config.MPLAYER_ARGS_DEF else: self.args_def = '' self.title_def = _('Aspect Ratio - %s') self.title = self.title_def % self.default_str if hasattr(config, 'MPLAYER_ASPECT_RATIOS'): self.ratios = config.MPLAYER_ASPECT_RATIOS else: self.ratios = (_('Def'), '16:9', '2.35:1', '4:3') plugin.activate('video.mplayer_ppmenu.daemon')
import plugin class PluginInterface(plugin.Plugin): def __init__(self, arg1, arg2='foo'): plugin.Plugin.__init__(self) plugin.activate('foo', args=('1', )) plugin.activate('foo', args=('1', 'bar'))
dirname = os.path.dirname(fxd.getattr(None, 'filename', '')) if children: children = children[0].children items = [] for child in children: fname = os.path.join(dirname, String(fxd.gettext(child))) if child.name == 'directory': items.append((fname, fxd.getattr(child, 'recursive', 0))) elif child.name == 'file': items.append(fname) pl = Playlist('', items, fxd.getattr(None, 'parent', None), display_type=fxd.getattr(None, 'display_type'), build=True, random=fxd.getattr(node, 'random', 0), repeat=fxd.getattr(node, 'repeat', 0)) pl.name = fxd.getattr(node, 'title') pl.image = fxd.childcontent(node, 'cover-img') if pl.image: pl.image = vfs.join(vfs.dirname(fxd.filename), pl.image) fxd.parse_info(fxd.get_children(node, 'info', 1), pl) fxd.getattr(None, 'items', []).append(pl) # load the MimetypePlugin mimetype = Mimetype() plugin.activate(mimetype)
def __init__(self): logger.log(9, 'PluginInterface.__init__()') plugin.MainMenuPlugin.__init__(self) self.reminders = Reminders() plugin.register(self.reminders, "TVReminders") plugin.activate(self.reminders)
""" 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)
class PluginInterface(plugin.MainMenuPlugin): """ album_tree v0.51 http://freevo.sourceforge.net/cgi-bin/doc/PluginAudioAlbumTree = Summary = Plugin to browse songs in a tree-like way. Requires pysqlite. Tested on freevo 1.5.3 and a 12.000 mp3/6.0 MB database. = Pre Installation = The sqlite-meta-database should be available. The audio.rating and audio.logger plugin allso use this database ,you can skip the rest of the pre-install if those plugins are already succesfully installed. *install pysqlite,sqlite *edit your local_config.py : Configure AUDIO_ITEMS ('''AudioConfig''' ,don't leave it at the default!) *run {{{freevo cache}}} *wait..... *The meta database should be available now. = Installation = *Download freevo-audio-album-tree-0.x.x.tgz *{{{ tar -zxvf freevo-audio-album-tree-0.x.x.tgz cd freevo-audio-album-tree0.x.x python setup.py }}} = Configuration = Edit your local_config.py and add this: {{{ plugin.activate('audio.album_tree') AUDIO_ALBUM_TREE_SPEC = [] #You could add all trees below:, but probably you only want 1 or 2 of them: AUDIO_ALBUM_TREE_SPEC.append({'name':'Artist/Album/Track' ,'spec':["artist","album","track||'-'||title"] ,'alt_grouping':[None,None,'track'] }) #A case sensitive tree like above... #Is easy to convert to a convert to a case insensitive tree like below: AUDIO_ALBUM_TREE_SPEC.append({'name':'nocase:artist/album/Track' ,'spec':["lower(artist)","lower(album)","track||'-'||title"] ,'alt_grouping':[None,None,'track'] }) #my favorite layout: AUDIO_ALBUM_TREE_SPEC.append({'name':'(A-Z)/Artist/Album-Year/Track' ,'spec':["upper(substr(artist,0,1))" ,"artist","album||'-'||year" ,"track||'-'||title"] ,'alt_grouping':[None,None,'year||album','track'] }) #you can comment out a tree definition like this: #AUDIO_ALBUM_TREE_SPEC.append({'name':'Artist-Album/Track' # ,'spec':["artist||'-'||album","track||'-'||title"] # ,'alt_grouping':[None,'track'] # }) #More Examples: AUDIO_ALBUM_TREE_SPEC.append({'name':'Year/Artist-Album/Track' ,'spec':["year","artist||'-'||album","track||'-'||title"] ,'alt_grouping':[None,None,None,'track'] }) AUDIO_ALBUM_TREE_SPEC.append({'name':'Dirtitle/Artist/Album/Track' ,'spec':["dirtitle","artist","album","track||'-'||title"] ,'alt_grouping':[None,None,None,'track'] }) #see http://www.sqlite.org/lang_expr.html for "scripting" functions }}} = Post Installation = New plugins are not immediately visible on the freevo webserver. You might want to restart the [wiki:Webserver freevo webserver] after the installation of a new plugin. """ def __init__(self): plugin.MainMenuPlugin.__init__(self) #config.EVENTS['audio']['DISPLAY'] = Event(FUNCTION_CALL, arg=self.detach) self.show_item = menu.MenuItem(_('Album Tree'), action=self.onchoose_main) self.show_item.type = 'audio' plugin.register(self, 'audio.album_tree') if (not config.__dict__.has_key('AUDIO_ALBUM_TREE_SPEC')) or ( not config.AUDIO_ALBUM_TREE_SPEC): print '*ALBUM_TREE:"config.AUDIO_ALBUM_TREE_SPEC" is empty:DEMO-MODE:USING PREDEFINED TREES' self.load_demo() else: self.load_spec(config.AUDIO_ALBUM_TREE_SPEC) def load_spec(self, spec_list): """ load definitions from config """ curs = db.cursor self.album_tree_list = [] for specdef in spec_list: tree = treeSpec(specdef['name'], curs, specdef['spec']) if specdef.has_key('alt_grouping'): tree.alt_grouping = specdef['alt_grouping'] self.album_tree_list.append(tree) def load_demo(self): """ load predefined testing layout """ curs = db.cursor self.album_tree_list = [ treeSpec('Artist/Album/Track', curs, ["artist", "album", "track||'-'||title"], [None, None, 'track']), treeSpec('(A-Z)/Artist/Year-Album/Track', curs, [ "upper(substr(artist,0,1))", "artist", "album||'-'||year", "track||'-'||title" ], [None, None, 'year||album', 'track']), treeSpec('Artist-Album/Track', curs, ["artist||'-'||album", "track||'-'||title"], [None, 'track']), treeSpec('a-z/artist/title-album-track', curs, [ "lower(substr(artist,0,1))", "lower(artist)", "title||'-'||album||'-'||track" ]), treeSpec('Year/Artist-Album/Track', curs, ["year", "artist||'-'||album", "track||'-'||title"], [None, None, None, 'track']) #demo: , treeSpec('Dirtitle/Artist/Album/Track', curs, ["dirtitle", "artist", "album", "track||'-'||title"], [None, None, None, 'track']) ] #treespec below: #INSANE,but this is what i like about foobar2000. #NOT YET POSSIBLE, "album_artist" tag is not in sql database. #Surprisingly:sqlite can handle it pretty fast. #treeSpec('a-z/album_artist/album/track-(artist)-title',curs # ,["lower(substr(ifnull(album_artist,artist),0,1))", # "ifnull(album_artist,artist)" # ,"album","track||'-'||nullif(artist,ifnull(album_artist,artist))||'-'||title"] # ,[None,None,None,None,'track']) def items(self, parent): return [self.show_item] def actions(self): #todo: add random 10 etc.. return [] def onchoose_main(self, arg=None, menuw=None): """ main menu """ # items = [] for tree in self.album_tree_list: items.append( menu.MenuItem(tree.name, action=self.onchoose_node, arg=[tree, []])) myobjectmenu = menu.Menu(_('Album Tree'), items, reload_func=menuw.back_one_menu) rc.app(None) menuw.pushmenu(myobjectmenu) menuw.refresh() def onchoose_node(self, arg=None, menuw=None): """ browse through a tree specification """ tree = arg[0] data = arg[1] title = '-'.join(data) mylistofitems = [] if len(tree.spec) - 1 <> len(data): #non-tracks for tree_item, count in tree.execute(data): mylistofitems.append( menu.MenuItem("%s(%i)" % (tree_item, count), action=self.onchoose_node, arg=[tree, data + [tree_item]])) else: #tracks self.onchoose_last_node(tree, data, menuw) return #should be impossible? if (len(mylistofitems) == 0): mylistofitems += [ menu.MenuItem(_('No Objects found'), menuw.back_one_menu, 0) ] myobjectmenu = menu.Menu(title, mylistofitems) #reload_func=menuw.back_one_menu ) rc.app(None) menuw.pushmenu(myobjectmenu) menuw.refresh() def onchoose_last_node(self, tree, data, menuw): """ last node in tree generates a playlist. """ title = '-'.join(data) #creating of audio items is slow. #need a progress-bar. pl = playlist.Playlist(name='-'.join(data), playlist=[], display_type='audiocd') tracks = tree.execute(data) #returns list of (desc,path,filename) pop = ProgressBox(text=_('Generating playlist...'), full=len(tracks)) pop.show() items = [] i = 0 for desc, path, filename in tracks: filepath = os.path.join(path, filename) item = audioitem.AudioItem(filepath, parent=pl) item.name = desc item.track = i items.append(item) pop.tick() i += 1 pop.destroy() pl.playlist = items #note/question for core developers: #command below causes strange errors? #plugin.__plugin_type_list__ is empty??? but it's Not? #pl.browse(arg=None,menuw=menuw) #print 'LIST=',plugin.__plugin_type_list__['mimetype'] #workaround: not all features of a real playlist :( mymenu = menu.Menu(title, pl.playlist, item_types="audio") menuw.pushmenu(mymenu)