Implementation:869413421 Ai moive studio TransitionService sync transition video status
| Knowledge Sources | |
|---|---|
| Domains | Video, Task_Management |
| Last Updated | 2026-10-23 12:00 GMT |
Overview
Service that polls all processing transition video tasks for completion, downloads completed videos, and uploads them to MinIO storage with status normalization.
Description
TransitionService.sync_transition_video_status queries all MovieShotTransition records with status processing and a non-null video_task_id. For each, it creates a provider via ProviderFactory.resume_video using the saved provider_context_json, polls the task status, and handles the result:
- processing/pending: Skip (still in progress)
- completed: Download the video URL, upload to MinIO, update transition status to completed and set video_url
- failed: Update transition status to failed
The service normalizes various provider status formats to a common vocabulary.
Usage
Import when polling for completed transition videos. Called periodically by the movie generation pipeline or a sync Celery task.
Code Reference
Source Location
- Repository: ai-moive-studio
- File: backend/src/services/transition_service.py:L592-768
Signature
class TransitionService(BaseService):
async def sync_transition_video_status(self, api_key_id: str = None) -> dict:
"""
Args:
api_key_id: optional API key ID (falls back to transition record's api_key_id)
Returns:
Dict with synced, completed, failed
"""
Import
from src.services.transition_service import TransitionService
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| api_key_id | str | No | API key ID (falls back to transition's api_key_id) |
Outputs
| Name | Type | Description |
|---|---|---|
| return value | dict | {synced, completed, failed} |
| DB side effects | — | Updates transition status and video_url for completed tasks |
Usage Examples
Syncing Transition Status
from src.services.transition_service import TransitionService
service = TransitionService(db_session)
result = await service.sync_transition_video_status()
print(f"Synced {result['synced']}, completed {result['completed']}, failed {result['failed']}")