Can scan a path to add to the library
This commit is contained in:
parent
717d0eeca3
commit
3077a09a2d
|
@ -0,0 +1,4 @@
|
|||
__author__="bjschuma"
|
||||
__date__ ="$Dec 27, 2009 9:40:48 PM$"
|
||||
|
||||
__all__=["scan"]
|
|
@ -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]
|
|
@ -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)
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
# To change this template, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
|
|
@ -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()
|
Loading…
Reference in New Issue