mirror of
https://github.com/derrod/legendary.git
synced 2025-01-03 04:45:28 +00:00
[downloader/models] Add silent deletion task flag
This commit is contained in:
parent
691fd9bc8f
commit
08c2008281
|
@ -445,7 +445,7 @@ class DLManager(Process):
|
|||
old_filename=task.temporary_filename),
|
||||
timeout=1.0)
|
||||
elif task.delete:
|
||||
self.writer_queue.put(WriterTask(task.filename, delete=True), timeout=1.0)
|
||||
self.writer_queue.put(WriterTask(task.filename, delete=True, silent=task.silent), timeout=1.0)
|
||||
elif task.open:
|
||||
self.writer_queue.put(WriterTask(task.filename, fopen=True), timeout=1.0)
|
||||
current_file = task.filename
|
||||
|
|
|
@ -217,6 +217,7 @@ class FileWorker(Process):
|
|||
try:
|
||||
os.remove(full_path)
|
||||
except OSError as e:
|
||||
if not j.silent:
|
||||
logger.error(f'Removing file failed: {e!r}')
|
||||
|
||||
self.o_q.put(WriterTaskResult(success=True, filename=j.filename))
|
||||
|
|
|
@ -28,7 +28,7 @@ class WriterTask:
|
|||
|
||||
def __init__(self, filename, chunk_offset=0, chunk_size=0, chunk_guid=None, close=False,
|
||||
shared_memory=None, cache_file='', old_file='', release_memory=False, rename=False,
|
||||
empty=False, kill=False, delete=False, old_filename='', fopen=False):
|
||||
empty=False, kill=False, delete=False, old_filename='', fopen=False, silent=False):
|
||||
self.filename = filename
|
||||
self.empty = empty
|
||||
self.shm = shared_memory
|
||||
|
@ -46,6 +46,7 @@ class WriterTask:
|
|||
self.rename = rename
|
||||
self.old_filename = old_filename
|
||||
|
||||
self.silent = silent # disable logging
|
||||
self.kill = kill # final task for worker (quit)
|
||||
|
||||
|
||||
|
@ -113,7 +114,7 @@ class ChunkTask:
|
|||
|
||||
class FileTask:
|
||||
def __init__(self, filename, delete=False, empty=False, fopen=False, close=False,
|
||||
rename=False, temporary_filename=None):
|
||||
rename=False, temporary_filename=None, silent=False):
|
||||
"""
|
||||
Download manager Task for a file
|
||||
|
||||
|
@ -130,6 +131,7 @@ class FileTask:
|
|||
self.close = close
|
||||
self.rename = rename
|
||||
self.temporary_filename = temporary_filename
|
||||
self.silent = silent
|
||||
|
||||
@property
|
||||
def is_reusing(self):
|
||||
|
|
Loading…
Reference in a new issue