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 = []
|
opt = []
|
||||||
|
|
||||||
from bt.message import write
|
from bt.message import write
|
||||||
from bt.file import expandPath
|
from bt.file import *
|
||||||
from tools.library import library
|
|
||||||
|
from library import *
|
||||||
|
#from library.scan import scan
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is enabled
|
# Called every time the plugin is enabled
|
||||||
def open():
|
def open():
|
||||||
pass
|
pass
|
||||||
#write("Example plugin has been started",True)
|
|
||||||
#write("Example plugin has been changed",True)
|
|
||||||
|
|
||||||
|
|
||||||
# Called every time the plugin is stopped
|
# Called every time the plugin is stopped
|
||||||
def close():
|
def close():
|
||||||
pass
|
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):
|
def run(args=None):
|
||||||
if args == None:
|
if args == None:
|
||||||
return
|
return
|
||||||
|
|
||||||
space = ' '
|
space = ' '
|
||||||
path = space.join(args)
|
path = expandPath( space.join(args) )
|
||||||
library.scan(expandPath(path))
|
scan(path)
|
||||||
pass
|
|
||||||
|
|
|
@ -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