mirror of
https://github.com/derrod/legendary.git
synced 2025-01-18 13:17:09 +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),
|
old_filename=task.temporary_filename),
|
||||||
timeout=1.0)
|
timeout=1.0)
|
||||||
elif task.delete:
|
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:
|
elif task.open:
|
||||||
self.writer_queue.put(WriterTask(task.filename, fopen=True), timeout=1.0)
|
self.writer_queue.put(WriterTask(task.filename, fopen=True), timeout=1.0)
|
||||||
current_file = task.filename
|
current_file = task.filename
|
||||||
|
|
|
@ -217,7 +217,8 @@ class FileWorker(Process):
|
||||||
try:
|
try:
|
||||||
os.remove(full_path)
|
os.remove(full_path)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
logger.error(f'Removing file failed: {e!r}')
|
if not j.silent:
|
||||||
|
logger.error(f'Removing file failed: {e!r}')
|
||||||
|
|
||||||
self.o_q.put(WriterTaskResult(success=True, filename=j.filename))
|
self.o_q.put(WriterTaskResult(success=True, filename=j.filename))
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -28,7 +28,7 @@ class WriterTask:
|
||||||
|
|
||||||
def __init__(self, filename, chunk_offset=0, chunk_size=0, chunk_guid=None, close=False,
|
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,
|
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.filename = filename
|
||||||
self.empty = empty
|
self.empty = empty
|
||||||
self.shm = shared_memory
|
self.shm = shared_memory
|
||||||
|
@ -46,6 +46,7 @@ class WriterTask:
|
||||||
self.rename = rename
|
self.rename = rename
|
||||||
self.old_filename = old_filename
|
self.old_filename = old_filename
|
||||||
|
|
||||||
|
self.silent = silent # disable logging
|
||||||
self.kill = kill # final task for worker (quit)
|
self.kill = kill # final task for worker (quit)
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ class ChunkTask:
|
||||||
|
|
||||||
class FileTask:
|
class FileTask:
|
||||||
def __init__(self, filename, delete=False, empty=False, fopen=False, close=False,
|
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
|
Download manager Task for a file
|
||||||
|
|
||||||
|
@ -130,6 +131,7 @@ class FileTask:
|
||||||
self.close = close
|
self.close = close
|
||||||
self.rename = rename
|
self.rename = rename
|
||||||
self.temporary_filename = temporary_filename
|
self.temporary_filename = temporary_filename
|
||||||
|
self.silent = silent
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_reusing(self):
|
def is_reusing(self):
|
||||||
|
|
Loading…
Reference in a new issue