Skip to content

Commit

Permalink
Added running downloads & storage block
Browse files Browse the repository at this point in the history
  • Loading branch information
vJan00 committed Jan 31, 2024
1 parent 8d9f24c commit 2fc51a5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def transcribe_post():
if not priority.isnumeric():
return {"error": "Priority nan"}, 400

if (100 / round(psutil.disk_usage('./').total / 1000000000, 1)
* round(psutil.disk_usage('./').used / 1000000000, 1) > 90):
return {"error": "Not enough storage"}, 507

if 'file' in request.files:
try:
file: FileStorage = request.files['file']
Expand All @@ -65,6 +69,9 @@ def transcribe_post():
except:
return {"Error": "Failed to add file"}, 400
elif link:
if len(ts_api.runningDownloads) >= 3:
return {"Error": "Too many downloads already running"}, 503

try:
uid = str(uuid.uuid4())
Thread(target=ts_api.add_link_to_queue,
Expand Down

0 comments on commit 2fc51a5

Please sign in to comment.