Spaces:
Running
Running
Download app/core/video_queue.py from MonteeqOrg/backend: direct link, hf CLI and curl.
- Browser
- Download file 642 Bytes
-
https://huggingface.co/spaces/MonteeqOrg/backend/resolve/main/app/core/video_queue.py
- Command line
-
hf download hf://spaces/MonteeqOrg/backend/app/core/video_queue.py
-
curl -L -o video_queue.py https://huggingface.co/spaces/MonteeqOrg/backend/resolve/main/app/core/video_queue.py
642 Bytes
| import json | |
| from app.core.redis import redis_client | |
| class VideoQueue: | |
| def __init__(self): | |
| self.redis = redis_client | |
| self.queue_name = "video_tasks" | |
| def push_task(self, video_id: str, task_id: str, target_format: str = "home"): | |
| """ | |
| Pushes a video transcoding task to the Redis queue for the Rust worker. | |
| """ | |
| task_data = { | |
| "video_id": str(video_id), | |
| "task_id": str(task_id), | |
| "target_format": target_format | |
| } | |
| self.redis.lpush(self.queue_name, json.dumps(task_data)) | |
| return task_id | |
| # Global instance | |
| video_queue = VideoQueue() | |