How thevickypedia/pystream works
Project type and purpose
• PyStream is a self-hosted Python video‐streaming service built on FastAPI and Uvicorn.
• It exposes both REST endpoints and server‐side rendered HTML pages (via Jinja2 templates) to securely stream videos from a local folder.
File structure
• Top level contains CI/CD configs, documentation folders, pyproject.toml, and the pystream/ package.
• Inside pystream/:
• main.py – the start() entrypoint that spins up Uvicorn & FastAPI
• logger.py – centralized logging setup
• utils.py – helpers (e.g., get_local_ip)
• models/ – core logic modules:
– config.py (env var loader)
– authenticator.py & secure.py (session & auth)
– stream.py & squire.py (range‐request video chunking)
– images.py (thumbnail generation)
– subtitles.py (subtitle serving)
• routers/ – FastAPI routers for auth, basic pages, and video endpoints
• templates/ – Jinja2 HTML for login, listing, streaming pages
README for additional insights
• Configurable via environment variables (AUTHORIZATION, VIDEO_SOURCE, optional SSL, CORS, etc.).
• Uses Uvicorn workers, FastAPI dependency injection, CORS middleware, thumbnails, secure cookies.
Detail
• Break out each router+model pairing rather than lumping under “API.”
• Explicitly show config loading & session cookie issuance.
• HTTP Range negotiation via Squire.
• Call out optional flows (AUTO_THUMBNAIL, SECURE_SESSION) with annotations.