diff --git a/src/core/library/__init__.py b/src/core/library/__init__.py new file mode 100644 index 00000000..1dffccca --- /dev/null +++ b/src/core/library/__init__.py @@ -0,0 +1,4 @@ +__author__="bjschuma" +__date__ ="$Dec 27, 2009 9:40:48 PM$" + +__all__=["scan"] \ No newline at end of file diff --git a/src/core/library/scan.py b/src/core/library/scan.py new file mode 100644 index 00000000..8ea2efbe --- /dev/null +++ b/src/core/library/scan.py @@ -0,0 +1,20 @@ +#! /usr/bin/python + +# To change this template, choose Tools | Templates +# and open the template in the editor. + +__author__="bjschuma" +__date__ ="$Dec 27, 2009 9:44:30 PM$" + +from bt.file import * + +def scan(dir): + write(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] diff --git a/src/core/scan.py b/src/core/scan.py index a34af2cd..76627667 100644 --- a/src/core/scan.py +++ b/src/core/scan.py @@ -12,29 +12,38 @@ path = "" opt = [] from bt.message import write -from bt.file import expandPath -from tools.library import library +from bt.file import * + +from library import * +#from library.scan import scan # 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 +# Performs the actual scanning +def scan(dir): + files = ls(dir) + for file in files: + path = join(dir,file) + if checkDir(path)==True: + scan(path) + else: + write(path,True) + #self.files += [path] + + +# Called to scan a directory. Performs initial path expansion before traversing def run(args=None): if args == None: return - space = ' ' - path = space.join(args) - library.scan(expandPath(path)) - pass + path = expandPath( space.join(args) ) + scan(path) diff --git a/src/core/tools/__init__.py b/src/core/tools/__init__.py deleted file mode 100644 index 5ff26b2a..00000000 --- a/src/core/tools/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# 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 deleted file mode 100644 index 1f6063ae..00000000 --- a/src/core/tools/library.py +++ /dev/null @@ -1,27 +0,0 @@ -# This is a simple test plugin, to make sure everything is working - -__author__="bjschuma" -__date__ ="$Dec 21, 2009 8:43:01 PM$" - - -from bt.file import * -from bt.message import write - - -class Library: - def __init__(self): - self.files = [] - - - 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] - -global library -library = Library()