diff --git a/src/core/ct/db.py b/src/core/ct/db.py index d27385ae..698d6214 100644 --- a/src/core/ct/db.py +++ b/src/core/ct/db.py @@ -10,6 +10,7 @@ __date__ ="$Jan 27, 2010 6:21:27 PM$" from bt.message import write from sqlite3 import * from bt import sql +import settings def init(): if sql.dbexists() == True: @@ -52,8 +53,6 @@ def newlib(name,path): try: ins = sql.Insert('library',[None,name,path]) ins.execute() - - #sel = sql.Insert('library') except: pass @@ -108,11 +107,27 @@ def rmlib(name): write("Removed library: "+name) +def libid(libname): + sel = sql.Select("id","library","name='"+libname+"'") + result = sel.execute().fetchone() + if result == None: + return None + return result[0] + + def listlib(): sel = sql.Select("*","library") result = sel.execute().fetchall() + id = settings.get("curlib") + curname = "" write("Id Name Path") write("------------------") for row in result: + if row[0] == id: + curname = row[1] write( str(row[0]) + " " + - row[1] + " " + row[2] ) \ No newline at end of file + row[1] + " " + row[2] ) + + #if not curname == "": + #write("") + write("Current: "+curname) \ No newline at end of file diff --git a/src/core/library.py b/src/core/library.py index f8ae4c6b..7df248c3 100644 --- a/src/core/library.py +++ b/src/core/library.py @@ -20,7 +20,8 @@ class Plugin(plugin.Plugin): def open(self): - settings.set("curlib",-1) + if settings.has("curlib") == False: + settings.set("curlib",-1) def create(self,args): @@ -34,7 +35,7 @@ class Plugin(plugin.Plugin): path = expandPath(join.join(args[1:])) db.newlib(name,path) if settings.get("curlib")==-1: - settings.set("curlib") + settings.set("curlib",db.libid(name)) def remove(self,args): @@ -62,3 +63,7 @@ class Plugin(plugin.Plugin): update.go(args[1]) elif args[0] == "prcnt": update.prcnt() + elif args[0] == "switch": + newLib = db.libid(args[1]) + if not newLib == None: + settings.set("curlib",newLib) \ No newline at end of file diff --git a/src/core/music.py b/src/core/music.py index aa42f65e..7dc7be5d 100644 --- a/src/core/music.py +++ b/src/core/music.py @@ -13,7 +13,7 @@ class Plugin(plugin.Plugin): def __init__(self): plugin.Plugin.__init__(self) self.help = "Used to control various aspects of playback" - self.usage = "music [load]" + self.usage = "music [load, pause, play]" def loadTrack(self,args): diff --git a/src/core/next.py b/src/core/next.py new file mode 100644 index 00000000..98d9d524 --- /dev/null +++ b/src/core/next.py @@ -0,0 +1,26 @@ +# Basic plugin class + +__author__="bjschuma" +__date__ ="$Feb 7, 2010 7:40:01 PM$" + + +from bt import plugin + + +class Plugin(plugin.Plugin): + def __init__(self): + plugin.Plugin.__init__(self) + self.help = "next" + + + def open(self): + pass + + + def close(self): + pass + + + def run(self, args=None): + pass +