Spaces:
Running
Running
Tilawa Enhancer commited on
Commit ·
15d2ec0
1
Parent(s): 89a1549
S167: always expose engine_log/engine_rc/engine_error/used_fallback
Browse files
app.py
CHANGED
|
@@ -372,6 +372,7 @@ def _run_engine(job_id):
|
|
| 372 |
except Exception as exc:
|
| 373 |
job["engine_error"] = str(exc)
|
| 374 |
if not success:
|
|
|
|
| 375 |
try:
|
| 376 |
job["label"] = "معالجة أساسية (fallback)..."
|
| 377 |
job["progress"] = 50
|
|
@@ -395,7 +396,8 @@ def _run_engine(job_id):
|
|
| 395 |
|
| 396 |
def _add_history(job):
|
| 397 |
entry = {k: job[k] for k in
|
| 398 |
-
["engine","filename","score","lufs","rms","crest","lra","timestamp"
|
|
|
|
| 399 |
if k in job}
|
| 400 |
with HISTORY_LOCK:
|
| 401 |
HISTORY.insert(0, entry)
|
|
@@ -410,9 +412,11 @@ def status(job_id):
|
|
| 410 |
if k in job}
|
| 411 |
resp["queue_position"] = _get_queue_position(job_id) if job.get("status") == "queued" else 0
|
| 412 |
if "error" in job: resp["error"] = job["error"]
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
|
|
|
|
|
|
| 416 |
return jsonify(resp)
|
| 417 |
|
| 418 |
@app.route("/download/<job_id>")
|
|
|
|
| 372 |
except Exception as exc:
|
| 373 |
job["engine_error"] = str(exc)
|
| 374 |
if not success:
|
| 375 |
+
job["used_fallback"] = True
|
| 376 |
try:
|
| 377 |
job["label"] = "معالجة أساسية (fallback)..."
|
| 378 |
job["progress"] = 50
|
|
|
|
| 396 |
|
| 397 |
def _add_history(job):
|
| 398 |
entry = {k: job[k] for k in
|
| 399 |
+
["engine","filename","score","lufs","rms","crest","lra","timestamp",
|
| 400 |
+
"used_fallback","engine_rc","engine_error","engine_log"]
|
| 401 |
if k in job}
|
| 402 |
with HISTORY_LOCK:
|
| 403 |
HISTORY.insert(0, entry)
|
|
|
|
| 412 |
if k in job}
|
| 413 |
resp["queue_position"] = _get_queue_position(job_id) if job.get("status") == "queued" else 0
|
| 414 |
if "error" in job: resp["error"] = job["error"]
|
| 415 |
+
# S167: always expose engine diagnostics (incl. fallback runs)
|
| 416 |
+
resp["engine_log"] = job.get("engine_log", [])
|
| 417 |
+
resp["engine_rc"] = job.get("engine_rc")
|
| 418 |
+
resp["engine_error"] = job.get("engine_error")
|
| 419 |
+
resp["used_fallback"] = job.get("used_fallback", False)
|
| 420 |
return jsonify(resp)
|
| 421 |
|
| 422 |
@app.route("/download/<job_id>")
|