From 4c0c76cde4516c092379e40e8fa6618eea6884d9 Mon Sep 17 00:00:00 2001 From: bjschuma Date: Tue, 22 Dec 2009 00:29:19 -0500 Subject: [PATCH] Can play music --- nbproject/project.properties | 4 +++ nbproject/project.xml | 13 +++++++ src/clean.sh | 4 +++ src/core/__init__.py | 1 + src/core/gstreamer.py | 66 ++++++++++++++++++++++++++++++++++++ src/core/load.py | 53 +++++++++++++++++++++++++++++ src/core/ocarina.py | 35 +++++++++++++++++++ src/core/play.py | 31 +++++++++++++++++ src/core/tools/__init__.py | 4 +++ src/core/tools/library.py | 30 ++++++++++++++++ src/ocarina | 4 +++ 11 files changed, 245 insertions(+) create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/clean.sh create mode 100644 src/core/__init__.py create mode 100644 src/core/gstreamer.py create mode 100644 src/core/load.py create mode 100644 src/core/ocarina.py create mode 100644 src/core/play.py create mode 100644 src/core/tools/__init__.py create mode 100644 src/core/tools/library.py create mode 100755 src/ocarina diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 00000000..596eddd7 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,4 @@ +java.lib.path= +platform.active=Python_2.6.4 +python.lib.path= +src.dir=src diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 00000000..bf48cb41 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,13 @@ + + + org.netbeans.modules.python.project + + + ocarina + + + + + + + diff --git a/src/clean.sh b/src/clean.sh new file mode 100644 index 00000000..4ce09705 --- /dev/null +++ b/src/clean.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +rm -r ./*/*.pyc +rm -r ./*/*/*.pyc diff --git a/src/core/__init__.py b/src/core/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/core/__init__.py @@ -0,0 +1 @@ + diff --git a/src/core/gstreamer.py b/src/core/gstreamer.py new file mode 100644 index 00000000..d06f665e --- /dev/null +++ b/src/core/gstreamer.py @@ -0,0 +1,66 @@ +# This is a simple test plugin, to make sure everything is working + +__author__="bjschuma" +__date__ ="$Dec 21, 2009 11:58:37 PM$" + + +global name, app, type, path, opt +name = "test" +app = "scion" +type = "core" +path = "" +opt = [] + +from bt.file import * +import gst + +import settings +global pipeline +pipeline = None + + + +def load(filename): + filename = expandPath(filename) + if checkPath(filename) == False: + return + + write("loading file: "+filename) + bin = gst.element_factory_make("playbin", None) + bin.set_property("uri", "file://"+filename) + bin.set_state(gst.STATE_PAUSED) + + global pipeline + pipeline = gst.Pipeline("player") + pipeline.add(bin) + + + +def play(): + global pipeline + pipeline.set_state(gst.STATE_PLAYING) + + + + +# Called every time the plugin is enabled +def open(): + global pipeline + pipeline = gst.Pipeline() + pipeline.set_state(gst.STATE_NULL) + write(songs) + if len(songs) > 0: + load(songs[0]) + + + +# Called every time the plugin is stopped +def close(): + global pipeline + pipeline.set_state(gst.STATE_NULL) + + + +# Called when the plugin needs to perform some action +def run(args=None): + pass diff --git a/src/core/load.py b/src/core/load.py new file mode 100644 index 00000000..903472cb --- /dev/null +++ b/src/core/load.py @@ -0,0 +1,53 @@ +# This is a simple test plugin, to make sure everything is working + +__author__="bjschuma" +__date__ ="$Dec 21, 2009 10:35:01 PM$" + + +global name, app, type, path, opt +name = "audio" +app = "ocarina" +type = "core" +path = "" +opt = [] + +from bt.message import write +from bt.file import * +import settings + +#from tools import gstream +import gstreamer + + + +# Called every time the plugin is enabled +def open(): + pass + #write("Example plugin has been changed",True) + + + +# Called every time the plugin is stopped +def close(): + pass + + + +# Called when the plugin needs to perform some action +def run(args=None): + if args == None: + return + + gstreamer.load(args[0]) + #filename = expandPath(args[0]) + #if checkPath(filename) == False: + # return + + #write("loading file: "+filename) + #bin = gst.element_factory_make("playbin", None) + #bin.set_property("uri", "file://"+filename) + #bin.set_state(gst.STATE_PAUSED) + + #pipeline = gst.Pipeline("player") + #pipeline.add(bin) + diff --git a/src/core/ocarina.py b/src/core/ocarina.py new file mode 100644 index 00000000..70162991 --- /dev/null +++ b/src/core/ocarina.py @@ -0,0 +1,35 @@ +#! /usr/bin/python + +# To change this template, choose Tools | Templates +# and open the template in the editor. + +__author__="bjschuma" +__date__ ="$Dec 21, 2009 9:18:52 PM$" + + +global name, app, type, path, opt +name = "ocarina" +app = "ocarina" +type = "core" +path = "" +opt = [] + +import settings +from bt.message import write +from manager import manager + + +# Called every time the plugin is enabled +def open(): + write("Ocarina has been started",True) + #write("Example plugin has been changed",True) + + +# Called every time the plugin is stopped +def close(): + write("Ocarina has been stopped",True) + + +# Called when the plugin needs to perform some action +def run(args=None): + pass diff --git a/src/core/play.py b/src/core/play.py new file mode 100644 index 00000000..bd50d8d0 --- /dev/null +++ b/src/core/play.py @@ -0,0 +1,31 @@ +# This is a simple test plugin, to make sure everything is working + +__author__="bjschuma" +__date__ ="$Dec 22, 2009 12:05:02 AM$" + + +global name, app, type, path, opt +name = "test" +app = "scion" +type = "core" +path = "" +opt = [] + +from bt.message import write +import gstreamer + + +# Called every time the plugin is enabled +def open(): + write("Example plugin has been started",True) + #write("Example plugin has been changed",True) + + +# Called every time the plugin is stopped +def close(): + write("Example plugin has been stopped",True) + + +# Called when the plugin needs to perform some action +def run(args=None): + gstreamer.play() diff --git a/src/core/tools/__init__.py b/src/core/tools/__init__.py new file mode 100644 index 00000000..5ff26b2a --- /dev/null +++ b/src/core/tools/__init__.py @@ -0,0 +1,4 @@ +# To change this template, choose Tools | Templates +# and open the template in the editor. + + diff --git a/src/core/tools/library.py b/src/core/tools/library.py new file mode 100644 index 00000000..8caa1fe9 --- /dev/null +++ b/src/core/tools/library.py @@ -0,0 +1,30 @@ +# This is a simple test plugin, to make sure everything is working + +__author__="bjschuma" +__date__ ="$Dec 21, 2009 8:43:01 PM$" + + +global name, app, type, path, opt +name = "library" +app = "ocarina" +type = "core" +path = "" +opt = [] + +from bt.message import write + + +# Called every time the plugin is enabled +def open(): + write("Example plugin has been started",True) + #write("Example plugin has been changed",True) + + +# Called every time the plugin is stopped +def close(): + write("Example plugin has been stopped",True) + + +# Called when the plugin needs to perform some action +def run(args=None): + pass diff --git a/src/ocarina b/src/ocarina new file mode 100755 index 00000000..a80c2ce3 --- /dev/null +++ b/src/ocarina @@ -0,0 +1,4 @@ +#!/bin/bash + +PLUG=`pwd`/`dirname $0`"/core" +cd && `which scion` "-p $PLUG" $* \ No newline at end of file