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 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 showfiles(): print("showing") retVal = db.ShowAllFiles() #retVal=retVal.replace("@","<br>") #retVal= vars.strHTMLHeader + retVal #debug.debugPrint(retVal) strPath = os.path.dirname(__file__) + vars._indexFile strContent = mw.CreateTableContent(retVal) print("Content: " + strContent) #tm.SleepSeconds(5) strRet = mw.readHTMLFile(strPath).replace("%tbl_cntnt%", strContent) retVal = strRet return retVal
def whipefiles(): print("Clearing out database") strQuery = "delete from FileNames" retVal = db.executeQuery(strQuery) strPath = os.path.dirname(__file__) + vars._DoneFile return mw.getTemplate(strPath).replace("%MESSAGE%", str(retVal))
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 LendingRates(): print("Showing LendingRates polled from poloniex") retVal = getLendingData() strPath = os.path.dirname(__file__).replace("app", "") + vars._PolLend return mw.getTemplate(strPath).replace("%LOWEST_LEND%", str(retVal))
def showInfo(): strInfo, strDistinct, strMP3, strWav, strflv, strAvi = db.showInfo() strBMP, strJPG, strpng, strTiff = db.showPictureInfo() strDOC, strDOCX, strODT, strTXT = db.showDocumentInfo() strPY, strC, strBAS, strH, strCPP, strPY_L, strC_L, strBAS_L, strH_L, strCPP_L = db.showProjectInfo( ) #strList=db.showGetInfoOnFileExtention() print("Collecting summery") #strSummery=db.getOverAllSummery() strSummery = "" strPath = os.path.dirname(__file__) + vars._infoFile strHTML = mw.readHTMLFile(strPath).replace("%info%", strInfo).replace( "%info2%", strDistinct).replace("%MP3%", strMP3).replace("%WAV%", strWav).replace( "%summery%", strSummery).replace("%avi%", strAvi).replace("%flv%", strflv) strHTML = strHTML.replace("%BMP%", strBMP).replace( "%JPG%", strJPG).replace("%PNG%", strpng).replace("%TIFF%", strTiff).replace( "%DOC%", strDOC).replace("%DOCX%", strDOCX).replace("%ODT%", strODT).replace("%TXT%", strTXT) strHTML = strHTML.replace("%T_PY%", strPY).replace("%T_C%", strC).replace( "%T_BAS%", strBAS).replace("%T_h%", strH) strHTML = strHTML.replace("%T_PY_L%", strPY_L).replace( "%T_C_L%", strC_L).replace("%T_BAS_L%", strBAS_L).replace( "%T_h_L%", strH_L).replace("%T_CPP_L%", strCPP_L).replace("%T_CPP%", strCPP) return strHTML
def showfiles(): print("showing") retVal = db.ShowAllFiles() #retVal=retVal.replace("@","<br>") #retVal= vars.strHTMLHeader + retVal #debug.debugPrint(retVal) strPath = os.path.dirname(__file__) + vars._indexFile strContent = mw.CreateTableContent(retVal) print("Content: " + strContent) #tm.SleepSeconds(5) strFooter, strStyle, btnCrawlHTML = mw.getAllMakeUpDone() strRet = str(mw.readHTMLFile(strPath).replace("%tbl_cntnt%", strContent)) strRet = strRet.replace("%FOOTER%", str(strFooter)).replace( "%STYLE%", str(strStyle)).replace("%BTNCRAWL%", str(btnCrawlHTML)) retVal = strRet return retVal
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 showInfo(): strInfo, strDistinct, strMP3, strWav, strflv, strAvi = db.showInfo() strBMP, strJPG, strpng, strTiff = db.showPictureInfo() strDOC, strDOCX, strODT, strTXT = db.showDocumentInfo() strPY, strC, strBAS, strH, strCPP, strPY_L, strC_L, strBAS_L, strH_L, strCPP_L = db.showProjectInfo( ) strList = "" #strList=db.getALlStoredFileExtentions() print("Collecting summery") #strSummery=db.getOverAllSummery() strSummery = "" strPath = os.path.dirname(__file__) + vars._infoFile strFooterPath = os.path.dirname(__file__) + vars._FooterFile #get the footer data strFooterHTML = mw.readHTMLFile(strFooterPath) strHTML = mw.readHTMLFile(strPath).replace("%info%", strInfo).replace( "%info2%", strDistinct).replace("%MP3%", strMP3).replace("%WAV%", strWav).replace( "%summery%", strSummery).replace("%avi%", strAvi).replace("%flv%", strflv) strHTML = strHTML.replace("%BMP%", strBMP).replace( "%JPG%", strJPG).replace("%PNG%", strpng).replace("%TIFF%", strTiff).replace( "%DOC%", strDOC).replace("%DOCX%", strDOCX).replace("%ODT%", strODT).replace("%TXT%", strTXT) strHTML = strHTML.replace("%T_PY%", strPY).replace("%T_C%", strC).replace( "%T_BAS%", strBAS).replace("%T_h%", strH) strHTML = strHTML.replace("%T_PY_L%", strPY_L).replace( "%T_C_L%", strC_L).replace("%T_BAS_L%", strBAS_L).replace( "%T_h_L%", strH_L).replace("%T_CPP_L%", strCPP_L).replace("%T_CPP%", strCPP) strFooter, strStyle, btnCrawlHTML = mw.getAllMakeUpDone() strHTML = strHTML.replace("%FOOTER%", str(strFooter)).replace( "%STYLE%", str(strStyle)).replace("%BTNCRAWL%", str(btnCrawlHTML)) return strHTML
def getALlStoredFileExtentions(): print("showing Picture information") cursorObj = FetchCursor() #what do we want to see: #the db used #the number of files StoreFileList list=[] strQuery="select distinct path from FileNames" cursorObj.execute(strQuery) print("Executing: " + strQuery) rows = cursorObj.fetchall() for row in rows: print(row) for cell in row: print(cell) iLenght=[len(cell)-1] print(str(iLenght)) strExt=mw.getFileExtention(cell[len(cell)-1]) if not cell in list: list.append(str(cell)) return list
def storeSingeFile(FileName): debugPrint("Entering storeSingleFile") extList=[] try: with sqlite3.connect("file.db") as con2: cur = con2.cursor() debugPrint("Executing SingleFile Query") iFileCounter=0 #FileName = FileName.replace("[","").replace("'","").replace("]","").strip().split(",") FileName = returnFilePathToStore(str(FileName)) #lets check if the file is already in the db, #if so we dont need to add it. debugPrint(FileName) debugPrint("Looking up file!") try: #boFileStored=False print("<<<<<<<<<<<<<< File Stored Evaluation >>>>>>>>>>>>>>") boFileStored = FileAlreadyStored(FileName) debugPrint("Filed stored status : " + str(boFileStored)) except Error: debugPrint("Error looking up Filestored") debugPrint(str(Error)) finally: if boFileStored != True: debugPrint("File Not found so adding!") try: Date= os.path.getmtime(FileName.strip()) Size= os.path.getsize(FileName.strip()) except: Date=str(datetime.datetime.now()) Size=0 debugPrint(Date) strQuery="insert into FileNames(name, path, date, size)values('@filename','@filepath','@filedate','@n')" FileName = returnFilePathToStore(str(FileName)) strQuery=strQuery.replace('@filepath',returnFilePathToStore(FileName)) FileName=FileName.split("/") strQuery=strQuery.replace('@filename',FileName[len(FileName)-1]) strQuery=strQuery.replace('@filedate',str(Date)) strQuery=strQuery.replace('@n',str(Size)) print(strQuery) curInject = con2.cursor() curInject.execute(strQuery) print("Insert File Query Executed") #now lets see if we need to update the extention db iLenght=len(FileName)-1 print("FileName:" + str(FileName)) print("Lenght found:" + str(iLenght)) strFileName=FileName[iLenght]; #strFileName=strFileName.split('.')[iLenght-1] print("Filename:" + str(strFileName)) strExtention=mw.getFileExtention(str(strFileName)) if not strExtention in extList: extList.append(str(strExtention)) strQuery="insert into Extentions(Ext, count)values('@strExt','1')" strQuery=strQuery.replace("@strExt", str(strExtention)) curInject.execute(strQuery) print("Insert Extention Executed") else: debugPrint("FileName not stored: " + str(FileName)) finally: print("Added: " + str(FileName))