url = 'http:/' + file.path[len(self.cache_dir.path):]
# Store the hashed file in the database
- new_hash = self.db.storeFile(file, result.digest())
+ new_hash = self.db.storeFile(file, result.digest(),
+ ''.join(result.pieceDigests()))
# Tell the main program to handle the new cache file
df = self.manager.new_cached_file(file, result, new_hash, url, True)
else:
log.msg('Hashed file to %s: %s' % (hash.hexdigest(), url))
- new_hash = self.db.storeFile(destFile, hash.digest())
+ new_hash = self.db.storeFile(destFile, hash.digest(),
+ ''.join(hash.pieceDigests()))
log.msg('now avaliable: %s' % (url))
if self.manager:
from pysqlite2 import dbapi2 as sqlite
from binascii import a2b_base64, b2a_base64
from time import sleep
-import os
+import os, sha
from twisted.python.filepath import FilePath
from twisted.trial import unittest