From a3e5c61b506cf13af5ccbda532e16fa44f632fa0 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 18 Jul 2017 04:31:35 -0300 Subject: [PATCH] use FileBodyProducer for encrypt_blob script --- scripts/encrypt_blob.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/encrypt_blob.py b/scripts/encrypt_blob.py index a30fbcc98..3d3552f48 100644 --- a/scripts/encrypt_blob.py +++ b/scripts/encrypt_blob.py @@ -5,6 +5,8 @@ import sys from twisted.internet import defer from twisted.internet import reactor +from twisted.protocols import basic +from twisted.web.client import FileBodyProducer from lbrynet import conf from lbrynet.core import log_support @@ -46,10 +48,8 @@ def encrypt_blob(filename, key, iv): yield manager.setup() creator = CryptStreamCreator(manager, filename, key, iv_generator(iv)) with open(filename, 'r') as infile: - data = infile.read(2**14) - while data: - yield creator.write(data) - data = infile.read(2**14) + producer = FileBodyProducer(infile, readSize=2**22) + yield producer.startProducing(creator) yield creator.stop()