def crawlDir(rootdir): debug.debugPrint("Entering crawlDir") FileList = [] try: iFileCounter = 0 for dirs, subdirs, files in os.walk(rootdir): for file in files: print("================== new file ================== ") strFilePath = dirs + "/" + str(file) print("File Probe: " + str(strFilePath)) db.storeSingeFile(str(strFilePath)) #We need to check if the path is already stored #if so we can update the counter FileList.append(strFilePath) iFileCounter = iFileCounter + 1 print("=============================================== ") except Error: print(Error) finally: print("Finally") debug.debugPrint("Files found: " + str(iFileCounter)) return str(FileList)
def crawler(): retval = crawl.Crawl(vars.rootdir) strPath = os.path.dirname(__file__) + vars._CrawlFile debug.debugPrint("AdminFile: " + str(strPath)) strFooter, strStyle, btnCrawlHTML = mw.getAllMakeUpDone() retval = "Done" return mw.readHTMLFile(strPath).replace( "%FOOTER%", str(strFooter)).replace("%STYLE%", str(strStyle)).replace( "%MESSAGE%", str(retval)).replace("%BTNCRAWL%", str(btnCrawlHTML))
def Crawl(rootdir): strBuilder = "Crawling directory " + rootdir FileNames = crawlDir(rootdir) #now lets save the FileNames found #db.StoreFileList(FileNames) debug.debugPrint("Exiting Crawl()") return FileNames
def admin(): strPath = os.path.dirname(__file__).replace("app", "") + vars._AdminFile debug.debugPrint("AdminFile: " + str(strPath)) strFooter, strStyle, btnCrawlHTML = mw.getAllMakeUpDone() return mw.readHTMLFile(strPath).replace( "%FOOTER%", str(strFooter)).replace("%STYLE%", str(strStyle)).replace("%BTNCRAWL%", str(btnCrawlHTML))
def main(): #strPath=os.path.dirname(__file__) + vars._indexFile strPath = os.path.dirname(__file__) + vars._WelcomeFile debug.debugPrint("PATH FOUND: " + strPath) #print(strPath) debug.debugPrint("Reading file") strRet = mw.readHTMLFile(strPath) #mw.writeTxtFile() return strRet
def dostuff(): debug.debugPrint("Testing") #strFooterPath=os.path.dirname(__file__) + vars._TestFile #print("Generated Test1: " + strFooterPath) #return mw.doStuff(strFooterPath) #strQuery="insert into Extentions(Ext, count)values('" + str(strExt) + "','1')" strQuery = "insert into Extentions(Ext, count)values('gif','1')" strRet = db.executeQuery(strQuery) return str(strRet)
def main(): #strPath=os.path.dirname(__file__) + vars._indexFile strPath = os.path.dirname(__file__).replace("app", "") + vars._WelcomeFile debug.debugPrint("PATH FOUND: " + strPath) #strFooterPath=os.path.dirname(__file__) + vars._FooterFile print("Generated FooterFile: " + strFooterPath) #print(strPath) strFooter, strStyle, btnCrawlHTML = mw.getAllMakeUpDone() return mw.readHTMLFile(strPath).replace( "%FOOTER%", str(strFooter)).replace("%STYLE%", str(strStyle)).replace("%BTNCRAWL%", str(btnCrawlHTML)) return strRet
def dostuff(): debug.debugPrint("Testing") db.dostuff() return "Done"