59 lines
1.2 KiB
Python
59 lines
1.2 KiB
Python
# This is a simple test plugin, to make sure everything is working
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Jan 2, 2010 1:18:37 PM$"
|
|
|
|
|
|
global name, app, type, path, opt
|
|
name = "next"
|
|
app = "ocarina"
|
|
type = "core"
|
|
path = ""
|
|
opt = []
|
|
|
|
from bt.message import write
|
|
from bt.file import join
|
|
import settings
|
|
from tools import database
|
|
from manager import manager
|
|
|
|
|
|
def next():
|
|
cur = settings.get("current")
|
|
database.open()
|
|
count = database.count("track")
|
|
database.close()
|
|
if cur == count:
|
|
return 0
|
|
return cur+1
|
|
|
|
|
|
|
|
# Called every time the plugin is enabled
|
|
def open():
|
|
if settings.has("current") == False:
|
|
settings.set("current",0)
|
|
settings.set("next",next)
|
|
|
|
|
|
# Called every time the plugin is stopped
|
|
def close():
|
|
settings.delete("next")
|
|
pass
|
|
|
|
|
|
# Called when the plugin needs to perform some action
|
|
def run(args=None):
|
|
if settings.has("curlib") == False:
|
|
return
|
|
curlib = str(settings.get("curlib"))
|
|
id = settings.get("next")()
|
|
|
|
database.open()
|
|
a = database.select("path","library","id="+curlib).fetchone()[0]
|
|
b = database.select("path","track","id="+str(id)).fetchone()[0]
|
|
database.close()
|
|
settings.set("current",id)
|
|
manager.run("load",([a+b]))
|
|
manager.run("play")
|