clove1002 commited on
Commit
08bdafe
·
verified ·
1 Parent(s): dd31f98

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -21
main.py CHANGED
@@ -67,28 +67,12 @@ def process_clips(input_file: str, timing: List[ClipTiming], job_id: str, webhoo
67
  else:
68
  print(f"[ERROR] FFmpeg failed on clip ID {clip.id}:\n{proc.stderr.decode()}")
69
 
70
-
71
- payload = {
72
- "status": "success"
73
- }
74
- r = requests.post(webhook_url, json=payload)
75
- r.raise_for_status()
76
- print(f"[INFO] Webhook sent successfully: {r.status_code}")
77
-
78
- except Exception as e:
79
- print(f"[ERROR] Task failed: {e}")
80
- print(traceback.format_exc())
81
- payload = {
82
- "status": "error",
83
- "detail": str(e)
84
- }
85
  try:
86
- r = requests.post(webhook_url, json=payload)
87
- r.raise_for_status()
88
- print(f"[INFO] Error webhook sent successfully: {r.status_code}")
89
- except Exception as e2:
90
- print(f"[ERROR] Failed to send error webhook: {e2}")
91
- print(traceback.format_exc())
92
 
93
 
94
 
 
67
  else:
68
  print(f"[ERROR] FFmpeg failed on clip ID {clip.id}:\n{proc.stderr.decode()}")
69
 
70
+ if webhook_url:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  try:
72
+ payload = {"status": "completed"}
73
+ requests.post(webhook_url, json=payload, timeout=10)
74
+ except Exception as e:
75
+ print(f"[WEBHOOK ERROR] Failed to call webhook: {e}")
 
 
76
 
77
 
78