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 _EncryptBigFile(self): self._RemoteRarPassword = self._OriginalFileHash fE = fileEncryptor(self.OriginalFileFullName, self._RemoteRarPassword) self._RemoteFileName = time.strftime('%Y%m%d%H%m%S') + '.rar' self._LocalTempFullName = self._RemoteFileName if not fE.getRarFile(self._RemoteFileName): self._RemoteFileName = time.strftime('%Y%m%d%H%m%S') + '.q2d' self._LocalTempFullName = self._RemoteFileName self._RemoteRarPassword = '' return False return True