always delete file from downloads if download was not complete
This commit is contained in:
parent
e5af041627
commit
dcd78bd86e
1 changed files with 4 additions and 0 deletions
|
@ -193,6 +193,10 @@ class StreamManager:
|
||||||
return stream
|
return stream
|
||||||
|
|
||||||
async def delete_stream(self, stream: ManagedStream, delete_file: typing.Optional[bool] = False):
|
async def delete_stream(self, stream: ManagedStream, delete_file: typing.Optional[bool] = False):
|
||||||
|
stream_finished = False if not stream.finished and stream.downloader\
|
||||||
|
else (stream.downloader and stream.downloader.stream_finished_event.is_set())
|
||||||
|
if not stream_finished:
|
||||||
|
delete_file = True
|
||||||
stream.stop_download()
|
stream.stop_download()
|
||||||
self.streams.remove(stream)
|
self.streams.remove(stream)
|
||||||
await self.storage.delete_stream(stream.descriptor)
|
await self.storage.delete_stream(stream.descriptor)
|
||||||
|
|
Loading…
Reference in a new issue