示例#1
0
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)
示例#2
0
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))
示例#3
0
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
示例#4
0
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))
示例#5
0
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
示例#6
0
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)
示例#7
0
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
示例#8
0
def dostuff():
    debug.debugPrint("Testing")
    db.dostuff()
    return "Done"