Enhance docker logging for debugging (Python unbuffered, GORM logger, yt-dlp debug wrapper)
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -3,13 +3,16 @@ import json
|
||||
import subprocess
|
||||
import os
|
||||
import argparse
|
||||
import traceback
|
||||
|
||||
def download_and_crop(url, output_dir, start_time=None, end_time=None):
|
||||
print(f"[DEBUG Worker] Starting download job for URL={url}, start={start_time}, end={end_time}", file=sys.stderr)
|
||||
try:
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# Get video info
|
||||
info_cmd = ["yt-dlp", "-J", url]
|
||||
print(f"[DEBUG Worker] Running info command: {' '.join(info_cmd)}", file=sys.stderr)
|
||||
result = subprocess.run(info_cmd, capture_output=True, text=True, check=True)
|
||||
info = json.loads(result.stdout)
|
||||
|
||||
@@ -53,14 +56,18 @@ def download_and_crop(url, output_dir, start_time=None, end_time=None):
|
||||
]
|
||||
|
||||
# Execute
|
||||
print(f"[DEBUG Worker] Executing download command: {' '.join(download_args)}", file=sys.stderr)
|
||||
subprocess.run(download_args, check=True)
|
||||
|
||||
print(json.dumps({"status": "success", "filepath": filepath, "title": title}))
|
||||
return True
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"[DEBUG Worker] Command Error Output: {e.stderr or e.output}", file=sys.stderr)
|
||||
print(json.dumps({"status": "error", "message": f"Command failed: {e.stderr or e.output}"}))
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"[DEBUG Worker] Unexpected Exception:", file=sys.stderr)
|
||||
traceback.print_exc()
|
||||
print(json.dumps({"status": "error", "message": str(e)}))
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user