50 lines
872 B
Python
50 lines
872 B
Python
# Basic plugin class
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Feb 5, 2010 7:47:18 PM$"
|
|
|
|
|
|
from bt import plugin
|
|
from bt.message import write
|
|
from bt import signal
|
|
|
|
from ct import gstreamer
|
|
|
|
|
|
class Plugin(plugin.Plugin):
|
|
def __init__(self):
|
|
plugin.Plugin.__init__(self)
|
|
self.help = "Used to control various aspects of playback"
|
|
self.usage = "music [load, pause, play, vol]"
|
|
|
|
|
|
def loadTrack(self,args):
|
|
if len(args) == 0:
|
|
write("Usage: music load track")
|
|
join = ' '
|
|
path = join.join(args)
|
|
write("Loading: "+path)
|
|
gstreamer.close()
|
|
gstreamer.load(path)
|
|
|
|
|
|
|
|
def run(self, args=None):
|
|
if args==None or len(args) < 1:
|
|
write(self.help)
|
|
return
|
|
|
|
if args[0] == "load":
|
|
self.loadTrack(args[1:])
|
|
|
|
elif args[0] == "play":
|
|
signal.emit("play")
|
|
|
|
elif args[0] == "pause":
|
|
signal.emit("pause")
|
|
|
|
elif args[0] == "vol":
|
|
gstreamer.setvol(args[1])
|
|
|
|
|