Compare commits
No commits in common. "493cde3f29a76d66e649e534cebfe0d9acb071b9" and "abd9b0ccf8ac2a190fa33dd75e9779bd6a826d2c" have entirely different histories.
493cde3f29
...
abd9b0ccf8
@ -42,7 +42,6 @@ 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,8 +60,3 @@ 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,9 +71,7 @@ async def is_task_already_done_or_exist(redis: RedisClient, link: str):
|
||||
|
||||
if len(tasks) > 0:
|
||||
task = tasks[0]
|
||||
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):
|
||||
@ -147,7 +145,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(), headers={'Content-Disposition': f'inline; filename="{file_path}"'}, media_type="video")
|
||||
return StreamingResponse(iterfile(), media_type="video/mp4")
|
||||
|
||||
|
||||
@app.post('/check/', response_class=FileResponse, status_code=200)
|
||||
|
Loading…
x
Reference in New Issue
Block a user