From dbc8cfe5ae0966687e682614945e62e9881cbbdf Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 13 Feb 2019 21:30:32 -0300 Subject: [PATCH] delete incomplete files on assembler stop --- lbrynet/stream/assembler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lbrynet/stream/assembler.py b/lbrynet/stream/assembler.py index 9388ee872..e8edf60f8 100644 --- a/lbrynet/stream/assembler.py +++ b/lbrynet/stream/assembler.py @@ -128,6 +128,9 @@ class StreamAssembler: else: log.debug("stream decryption and assembly did not finish (%i/%i blobs are done)", written_blobs or 0, len(self.descriptor.blobs) - 2) + if self.stream_handle is not None and self.output_path is not None: + log.debug("erasing incomplete file assembly: %s", self.output_path) + os.unlink(self.output_path) async def get_blob(self, blob_hash: str, length: typing.Optional[int] = None) -> 'BlobFile': return self.blob_manager.get_blob(blob_hash, length)