Update app.py
Browse files
app.py
CHANGED
|
@@ -214,11 +214,11 @@ def upload_state_to_api(state: Dict[str, Any]) -> bool:
|
|
| 214 |
return True
|
| 215 |
|
| 216 |
except requests.exceptions.HTTPError as e:
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
except requests.exceptions.RequestException as e:
|
| 223 |
log_message(f"❌ Failed to upload state file to API ({url}): {str(e)}", "ERROR")
|
| 224 |
return False
|
|
@@ -544,7 +544,9 @@ def process_audio_file(audio_path: str, reference_map: Dict[str, str], output_fi
|
|
| 544 |
return False
|
| 545 |
|
| 546 |
# 3. Upload transcription to API
|
| 547 |
-
|
|
|
|
|
|
|
| 548 |
processing_status["transcribed_files"] += 1
|
| 549 |
# Clean up the local transcription file after successful upload
|
| 550 |
try:
|
|
|
|
| 214 |
return True
|
| 215 |
|
| 216 |
except requests.exceptions.HTTPError as e:
|
| 217 |
+
if hasattr(e, 'response') and e.response.status_code == 409:
|
| 218 |
+
log_message(f"⚠️ State file already exists on server (409 Conflict) - Lock failed.", "WARNING")
|
| 219 |
+
return False
|
| 220 |
+
log_message(f"❌ Failed to upload state file to API ({url}): {str(e)}", "ERROR")
|
| 221 |
+
return False
|
| 222 |
except requests.exceptions.RequestException as e:
|
| 223 |
log_message(f"❌ Failed to upload state file to API ({url}): {str(e)}", "ERROR")
|
| 224 |
return False
|
|
|
|
| 544 |
return False
|
| 545 |
|
| 546 |
# 3. Upload transcription to API
|
| 547 |
+
upload_success = upload_transcription_to_api(final_json_path, final_json_filename)
|
| 548 |
+
|
| 549 |
+
if upload_success:
|
| 550 |
processing_status["transcribed_files"] += 1
|
| 551 |
# Clean up the local transcription file after successful upload
|
| 552 |
try:
|