Can scan and add a path to the library

This commit is contained in:
bjschuma 2009-12-27 20:32:41 -05:00
parent 57c6a8bc31
commit 717d0eeca3
3 changed files with 57 additions and 19 deletions

View File

@ -19,12 +19,13 @@ from bt.message import write
import bt.proc import bt.proc
from manager import manager from manager import manager
from tools import library
# Called every time the plugin is enabled # Called every time the plugin is enabled
def open(): def open():
write("Ocarina has been started",True) write("Ocarina has been started",True)
bt.proc.setname("Ocarina 2") bt.proc.setname("Ocarina 2")
#write("Example plugin has been changed",True)
# Called every time the plugin is stopped # Called every time the plugin is stopped

40
src/core/scan.py Normal file
View File

@ -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

View File

@ -4,27 +4,24 @@ __author__="bjschuma"
__date__ ="$Dec 21, 2009 8:43:01 PM$" __date__ ="$Dec 21, 2009 8:43:01 PM$"
global name, app, type, path, opt from bt.file import *
name = "library"
app = "ocarina"
type = "core"
path = ""
opt = []
from bt.message import write from bt.message import write
# Called every time the plugin is enabled class Library:
def open(): def __init__(self):
write("Example plugin has been started",True) self.files = []
#write("Example plugin has been changed",True)
# Called every time the plugin is stopped def scan(self, dir):
def close(): files = ls(dir)
write("Example plugin has been stopped",True) for file in files:
path = join(dir,file)
if checkDir(path)==True:
self.scan(path)
else:
write(path,True)
self.files += [path]
global library
# Called when the plugin needs to perform some action library = Library()
def run(args=None):
pass