39 lines
712 B
Python
39 lines
712 B
Python
# Basic plugin class
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Jan 27, 2010 6:16:01 PM$"
|
|
|
|
|
|
from bt import plugin
|
|
from bt.file import expandPath
|
|
from bt.message import write
|
|
from ct import db
|
|
|
|
|
|
class Plugin(plugin.Plugin):
|
|
def __init__(self):
|
|
plugin.Plugin.__init__(self)
|
|
self.help = "Used to access various parts of the library"
|
|
self.usage = "library [create]"
|
|
|
|
|
|
def create(self,args):
|
|
usage = "Usage: library create name path"
|
|
if len(args) < 2:
|
|
write(usage)
|
|
return
|
|
|
|
name = args[0]
|
|
join = ' '
|
|
path = expandPath(join.join(args[1:]))
|
|
db.newlib(name,path)
|
|
|
|
|
|
def run(self, args=None):
|
|
if (args==None) or (len(args)==0):
|
|
write(self.usage)
|
|
|
|
if args[0] == "create":
|
|
self.create(args[1:])
|
|
|