job_queue: use get_list WebRequest method
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
bc7e7d4548
commit
07e4b2cd7a
|
@ -251,20 +251,15 @@ class JobQueue:
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
action = web_request.get_action()
|
action = web_request.get_action()
|
||||||
if action == "POST":
|
if action == "POST":
|
||||||
files: Union[List[str], str] = web_request.get('filenames')
|
files = web_request.get_list('filenames')
|
||||||
reset = web_request.get_boolean("reset", False)
|
reset = web_request.get_boolean("reset", False)
|
||||||
if isinstance(files, str):
|
|
||||||
files = [f.strip() for f in files.split(',') if f.strip()]
|
|
||||||
# Validate that all files exist before queueing
|
# Validate that all files exist before queueing
|
||||||
await self.queue_job(files, reset=reset)
|
await self.queue_job(files, reset=reset)
|
||||||
elif action == "DELETE":
|
elif action == "DELETE":
|
||||||
if web_request.get_boolean("all", False):
|
if web_request.get_boolean("all", False):
|
||||||
await self.delete_job([], all=True)
|
await self.delete_job([], all=True)
|
||||||
else:
|
else:
|
||||||
job_ids: Union[List[str], str] = web_request.get('job_ids')
|
job_ids = web_request.get_list('job_ids')
|
||||||
if isinstance(job_ids, str):
|
|
||||||
job_ids = [f.strip() for f in job_ids.split(',')
|
|
||||||
if f.strip()]
|
|
||||||
await self.delete_job(job_ids)
|
await self.delete_job(job_ids)
|
||||||
else:
|
else:
|
||||||
raise self.server.error(f"Invalid action: {action}")
|
raise self.server.error(f"Invalid action: {action}")
|
||||||
|
|
Loading…
Reference in New Issue