How totallyle1gitaccount/media_service works
Media Service is a FastAPI backend for uploading, validating, processing, and managing video records. The upload route delegates to VideoService, which checks size and content, probes and validates metadata, normalizes video, and creates a database record; separate routes list, retrieve, and delete records. The README also describes PostgreSQL integration. The sampled service does not call its injected file saver, and it does not save the upload before probing the generated raw path, so no upload-to-saver link is shown. Some subsystems are represented from the README and tree rather than sampled implementation.
Main entry points: videos.py Video routes · dependencies.py Service dependencies · video_service.py Upload service · crud.py Video CRUD
Components 18
HTTP API
- FastAPI app
main.py - Video routes
API/routes/videos.py - Video schemas
API/core/schemas/video_schemas.py - API schemas
API/core/schemas/api_schemas.py - Service dependencies
API/core/dependencies.py
Video Processing
- Upload service
API/services/video_service.py - Video validator
API/services/validators/validation.py - Probe and normalize
API/services/processing/video_normalization.py - Path generator
API/utils/path_generator.py - File saver
API/services/file_storage.py
Persistence
- Video CRUD
data/crud.py - Video model
data/models.py - DB sessions
data/core.py - PostgreSQL
Media Integrations
- FFmpeg / ffprobe
- libmagic
- Local filesystem
Other components
- API client
Connections 23
- API client → FastAPI app: HTTP requests
- FastAPI app → Video routes: mounts routes
- Video routes → Service dependencies: resolves dependencies
- Video routes → Upload service: upload delegates
- Video routes → Video CRUD: CRUD calls
- Video routes → DB sessions: gets session
- Video routes → Video schemas: validates responses
- Video routes → API schemas: deletion response
- Service dependencies → Upload service: constructs
- Service dependencies → Video validator: injects
- Service dependencies → Probe and normalize: injects
- Service dependencies → File saver: injects
- Service dependencies → Video CRUD: injects
- Upload service → Path generator: generates paths
- Upload service → Video validator: validates upload
- Upload service → Probe and normalize: probes and normalizes
- Upload service → Video CRUD: creates record
- Video validator → libmagic: checks MIME
- Probe and normalize → FFmpeg / ffprobe: runs media tools
- Video CRUD → Video model: queries and writes
- Video CRUD → PostgreSQL: database operations
- DB sessions → PostgreSQL: opens sessions
- Video routes → Local filesystem: deletes video file