minor fixes
This commit is contained in:
parent
82a951f715
commit
fd874b4cd8
@ -42,6 +42,7 @@ class MasterService:
|
||||
while True:
|
||||
video_params = await self.queue.get()
|
||||
redis = RedisClient()
|
||||
await redis.del_tasks_queue()
|
||||
await redis.del_task_from_queue_and_add_to_tasks(task=video_params)
|
||||
self.currently_underway[video_params['link']] = video_params
|
||||
|
||||
|
@ -60,3 +60,8 @@ class RedisClient:
|
||||
async with self.connection as connection:
|
||||
res = await connection.srem(self.TASKS_DONE_NAME + f":1", json.dumps(task, indent=4).encode('utf-8'))
|
||||
return res
|
||||
|
||||
async def del_tasks_queue(self) -> int:
|
||||
async with self.connection as connection:
|
||||
res = await connection.delete(self.TASKS_NAME + f":1")
|
||||
return res
|
||||
|
@ -71,7 +71,9 @@ async def is_task_already_done_or_exist(redis: RedisClient, link: str):
|
||||
|
||||
if len(tasks) > 0:
|
||||
task = tasks[0]
|
||||
return task
|
||||
if os.path.exists(os.path.join(os.getcwd(), os.pardir, os.pardir + "/downloads/" + task["result"])):
|
||||
return task
|
||||
await redis.del_task_from_task_done_queue(task)
|
||||
|
||||
|
||||
async def is_task_in_process(redis: RedisClient, link: str):
|
||||
@ -145,7 +147,7 @@ async def download_video(file_path):
|
||||
with open(base_download_dir + f'/{file_path}', mode="rb") as file_like:
|
||||
yield from file_like
|
||||
|
||||
return StreamingResponse(iterfile(), media_type="video/mp4")
|
||||
return StreamingResponse(iterfile(), headers={'Content-Disposition': f'inline; filename="{file_path}"'}, media_type="video")
|
||||
|
||||
|
||||
@app.post('/check/', response_class=FileResponse, status_code=200)
|
||||
|
Loading…
Reference in New Issue
Block a user