Can scan and add a path to the library
This commit is contained in:
parent
57c6a8bc31
commit
717d0eeca3
|
@ -19,12 +19,13 @@ from bt.message import write
|
|||
import bt.proc
|
||||
from manager import manager
|
||||
|
||||
from tools import library
|
||||
|
||||
|
||||
# Called every time the plugin is enabled
|
||||
def open():
|
||||
write("Ocarina has been started",True)
|
||||
bt.proc.setname("Ocarina 2")
|
||||
#write("Example plugin has been changed",True)
|
||||
|
||||
|
||||
# Called every time the plugin is stopped
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# This is a simple test plugin, to make sure everything is working
|
||||
|
||||
__author__="bjschuma"
|
||||
__date__ ="$Dec 27, 2009 8:07:18 PM$"
|
||||
|
||||
|
||||
global name, app, type, path, opt
|
||||
name = "test"
|
||||
app = "scion"
|
||||
type = "core"
|
||||
path = ""
|
||||
opt = []
|
||||
|
||||
from bt.message import write
|
||||
from bt.file import expandPath
|
||||
from tools.library import library
|
||||
|
||||
|
||||
# Called every time the plugin is enabled
|
||||
def open():
|
||||
pass
|
||||
#write("Example plugin has been started",True)
|
||||
#write("Example plugin has been changed",True)
|
||||
|
||||
|
||||
# Called every time the plugin is stopped
|
||||
def close():
|
||||
pass
|
||||
#write("Example plugin has been stopped",True)
|
||||
|
||||
|
||||
# Called when the plugin needs to perform some action
|
||||
def run(args=None):
|
||||
if args == None:
|
||||
return
|
||||
|
||||
space = ' '
|
||||
path = space.join(args)
|
||||
library.scan(expandPath(path))
|
||||
pass
|
|
@ -4,27 +4,24 @@ __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.file import *
|
||||
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)
|
||||
class Library:
|
||||
def __init__(self):
|
||||
self.files = []
|
||||
|
||||
|
||||
# Called every time the plugin is stopped
|
||||
def close():
|
||||
write("Example plugin has been stopped",True)
|
||||
def scan(self, dir):
|
||||
files = ls(dir)
|
||||
for file in files:
|
||||
path = join(dir,file)
|
||||
if checkDir(path)==True:
|
||||
self.scan(path)
|
||||
else:
|
||||
write(path,True)
|
||||
self.files += [path]
|
||||
|
||||
|
||||
# Called when the plugin needs to perform some action
|
||||
def run(args=None):
|
||||
pass
|
||||
global library
|
||||
library = Library()
|
||||
|
|
Loading…
Reference in New Issue