Add transcode/packaging worker, job slugs, deletes and zip downloads
Worker: - manage.py run_worker polls the database for pending transcode jobs (ffmpeg) and packaging jobs (Bento4 mp4fragment + mp4hls). Jobs are claimed with a conditional UPDATE, a heartbeat thread marks progress, stale jobs are failed, and SIGTERM returns an interrupted job to the queue. - SQLite runs in WAL mode with IMMEDIATE transactions and a busy timeout so the web server and worker can share the database. - transcode.py exposes a reusable transcode() and the HW->CPU fallback works. - Docker image includes ffmpeg and a checksum-verified Bento4 SDK. Jobs and storage: - TranscodeJob and PackagingJob have slugs, set explicitly on creation; outputs go to transcodes/<slug>/ and packages/<slug>/hls/. Migrations regenerated. - Uploads into transcodes/ and packages/ are refused; the uploader defaults to the videos/raw folder. UI: - New packaging job button on transcode jobs. - Delete views for packaging jobs, transcode jobs, uploaded files and content entries, each removing files before records and refusing while referenced. TranscodeJob.asset is now SET_NULL so deleting a source keeps its jobs. - Streamed zip downloads for completed transcode jobs and packages, rooted at the job slug; the content page lists packages with download buttons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1e7483d9c6
commit
73b549cb18
@@ -59,6 +59,8 @@ Settings live in the `privatestudio.settings` package. Choose one with `DJANGO_S
|
||||
| `UPLOAD_PART_SIZE_MB` | all | Part size for browser uploads (default `16`). Files that would need over 10,000 parts use larger parts |
|
||||
| `UPLOAD_MAX_SIZE` | all | Largest multipart upload in bytes (default `0`, no limit) |
|
||||
| `UPLOAD_EXPIRY_DAYS` | all | `cleanup_uploads` removes unfinished uploads idle for this many days (default `7`) |
|
||||
| `BENTO4_BIN` | all | Directory with the Bento4 tools used by `run_worker` (default: find them on `PATH`) |
|
||||
| `WORKER_STALE_SECONDS` | all | A running job without a worker heartbeat for this long is marked failed (default `300`) |
|
||||
| `DJANGO_TIME_ZONE` | all | Time zone (default `UTC`) |
|
||||
| `SECRET_KEY` | production | Django secret key |
|
||||
| `ALLOWED_HOSTS` | production | Comma-separated host names |
|
||||
@@ -155,6 +157,8 @@ curl -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/yaml"
|
||||
--data-binary @job.yaml http://localhost:8000/api/studios/demo/transcode
|
||||
```
|
||||
|
||||
Pending jobs are run by `python manage.py run_worker` (see [README_SERVE.md](README_SERVE.md)).
|
||||
|
||||
## Storage
|
||||
|
||||
Files are stored under `STORAGE_PATH/<bucket_name>/<key>`. Keys that resolve outside the bucket directory are rejected.
|
||||
|
||||
Reference in New Issue
Block a user