diff --git a/src/core/load.py b/src/core/load.py index ad5ebbd4..b19a7f81 100644 --- a/src/core/load.py +++ b/src/core/load.py @@ -16,7 +16,7 @@ from bt.file import * import settings #from tools import gstream -import gstreamer +from tools import gstreamer diff --git a/src/core/ocarina.py b/src/core/ocarina.py index 46624dc1..32b178c2 100644 --- a/src/core/ocarina.py +++ b/src/core/ocarina.py @@ -20,6 +20,7 @@ from bt.file import * import bt.proc from manager import manager from tools import database +from tools import gstreamer settings.set("user", join(settings.get("user"),".ocarina2")) @@ -32,6 +33,7 @@ bt.proc.setname("Ocarina2") def open(): write("Ocarina has been started",True) database.init() + gstreamer.init() # Called every time the plugin is stopped diff --git a/src/core/pause.py b/src/core/pause.py index 98f339c9..d15569ae 100644 --- a/src/core/pause.py +++ b/src/core/pause.py @@ -11,7 +11,7 @@ type = "core" path = "" opt = [] -import gstreamer +from tools import gstreamer # Called every time the plugin is enabled diff --git a/src/core/play.py b/src/core/play.py index ff73a835..b1bf0928 100644 --- a/src/core/play.py +++ b/src/core/play.py @@ -12,7 +12,7 @@ path = "" opt = [] from bt.message import write -import gstreamer +from tools import gstreamer # Called every time the plugin is enabled diff --git a/src/core/scan.py b/src/core/scan.py index 92c002d2..fe2302a2 100644 --- a/src/core/scan.py +++ b/src/core/scan.py @@ -20,6 +20,7 @@ import settings from manager import manager #from library import * from tools import database +from tools import extract #from library.scan import scan global root @@ -44,7 +45,8 @@ def scan(dir): else: write(path,True) global root - manager.run("extract", (root,path)) + #manager.run("extract", (root,path)) + extract.run((root,path)) #database.insert(path) #self.files += [path] diff --git a/src/core/tools/__init__.py b/src/core/tools/__init__.py index a863e5d0..840ed0de 100644 --- a/src/core/tools/__init__.py +++ b/src/core/tools/__init__.py @@ -1,4 +1,4 @@ __author__="bjschuma" __date__ ="$Dec 28, 2009 12:21:59 AM$" -__all__ = ['database'] \ No newline at end of file +__all__ = ['database', 'extract'] \ No newline at end of file diff --git a/src/core/extract.py b/src/core/tools/extract.py similarity index 87% rename from src/core/extract.py rename to src/core/tools/extract.py index 261dca90..a603a155 100644 --- a/src/core/extract.py +++ b/src/core/tools/extract.py @@ -4,13 +4,6 @@ __author__="bjschuma" __date__ ="$Dec 28, 2009 10:21:06 PM$" -global name, app, type, path, opt -name = "extract" -app = "ocarina" -type = "core" -path = "" -opt = [] - from bt.message import write from tools import database import settings @@ -19,7 +12,7 @@ import re import tagpy global goodFiles -goodFiles = [] +goodFiles = ["mp3", "ogg"] global search @@ -35,6 +28,8 @@ def genSearch(): search += file search += ")" +genSearch() + # Return true if the file is valid and false if it is not def validFile(filename): @@ -46,19 +41,6 @@ def validFile(filename): return True - -# Called every time the plugin is enabled -def open(): - #goodFile = ".*\.(mp3|ogg)" - goodFiles = ["mp3", "ogg"] - genSearch() - - -# Called every time the plugin is stopped -def close(): - pass - - def findId(table,name): result = database.select("id",table,"name=\'"+name.replace("\'","\'\'")+"\'").fetchone() if result == None: diff --git a/src/core/gstreamer.py b/src/core/tools/gstreamer.py similarity index 90% rename from src/core/gstreamer.py rename to src/core/tools/gstreamer.py index 9f2f2dea..c23af27f 100644 --- a/src/core/gstreamer.py +++ b/src/core/tools/gstreamer.py @@ -4,13 +4,6 @@ __author__="bjschuma" __date__ ="$Dec 21, 2009 11:58:37 PM$" -global name, app, type, path, opt -name = "gstreamer" -app = "ocarina" -type = "core" -path = "" -opt = [] - from bt.file import * import gst @@ -49,7 +42,7 @@ def pause(): # Called every time the plugin is enabled -def open(): +def init(): global pipeline pipeline = gst.Pipeline() pipeline.set_state(gst.STATE_NULL)