ocarina/src/core/switchlib.py

43 lines
753 B
Python

# This is a simple test plugin, to make sure everything is working
__author__="bjschuma"
__date__ ="$Jan 5, 2010 4:15:12 PM$"
global name, app, type, path, opt
name = "switchlib"
app = "ocarina"
type = "core"
path = ""
opt = []
from bt.message import write
from tools import database
import settings
# Called every time the plugin is enabled
def open():
pass
# Called every time the plugin is stopped
def close():
pass
def help():
return "Switches between multiple libraries"
# Called when the plugin needs to perform some action
def run(args=None):
if args == 0:
return
name = args[0]
write("Switching to: "+name)
result = database.select("id","library","name=\'"+name+"\'").fetchone()[0]
settings.replace("curlib",int(result))