def download(self, bigfileid): if not self._imapReady: return splitedfileslist = dba.getSplitedFilesListByBigFileId(bigfileid) if not len(splitedfileslist) > 0: return False print 'Downloading Big file: %s' % splitedfileslist[0][1] if self._downloadSplitedFiles(splitedfileslist): if self._rebuid(splitedfileslist): print 'Download successfully!' self._RemoteRarPassword = splitedfileslist[0][9] self._RemoteFileName = splitedfileslist[0][5] self._OriginalFileBaseName = splitedfileslist[0][1] self._OriginalFileHash = splitedfileslist[0][2] if '' != self._RemoteRarPassword: fE = fileEncryptor(self._RemoteFileName, self._RemoteRarPassword) if fE.getUnRarFile(self._RemoteFileName) and getFileMD5( self._OriginalFileBaseName ) == self._OriginalFileHash: print '\n------------->RAR file password :%s' % self._RemoteRarPassword print 'you can delete the rar file <%s> manually\n' % self._RemoteFileName #os.remove(self._RemoteFileName) self._cleanDownloadTempFiles(splitedfileslist) return True else: if getFileMD5(self._OriginalFileBaseName ) == self._OriginalFileHash: self._cleanDownloadTempFiles(splitedfileslist) return True return False
def download(self, bigfileid): if not self._imapReady: return splitedfileslist = dba.getSplitedFilesListByBigFileId(bigfileid) if not len(splitedfileslist) > 0: return False print 'Downloading Big file: %s' % splitedfileslist[0][1] if self._downloadSplitedFiles(splitedfileslist): if self._rebuid(splitedfileslist): print 'Download successfully!' self._RemoteRarPassword = splitedfileslist[0][9] self._RemoteFileName = splitedfileslist[0][5] self._OriginalFileBaseName = splitedfileslist[0][1] self._OriginalFileHash = splitedfileslist[0][2] if '' != self._RemoteRarPassword : fE = fileEncryptor(self._RemoteFileName, self._RemoteRarPassword) if fE.getUnRarFile(self._RemoteFileName) and getFileMD5(self._OriginalFileBaseName) == self._OriginalFileHash: print '\n------------->RAR file password :%s' % self._RemoteRarPassword print 'you can delete the rar file <%s> manually\n' % self._RemoteFileName #os.remove(self._RemoteFileName) self._cleanDownloadTempFiles(splitedfileslist) return True else: if getFileMD5(self._OriginalFileBaseName) == self._OriginalFileHash: self._cleanDownloadTempFiles(splitedfileslist) return True return False
def delete(self, bigfileid): if not self._imapReady: return splitedfileslist = dba.getSplitedFilesListByBigFileId(bigfileid) if len(splitedfileslist) > 0: print 'Deleting Big file: %s' % splitedfileslist[0][1] self._deleteSplitedFiles(splitedfileslist) if dba.deleteBigFileById(bigfileid): print 'File has been deleted!' return True else: print 'Failed to delete file for some reason...' return False