# Boys_Streaming 📺 > A simplified, kid-friendly Chromecast controller for the bedtime ritual. ## 🎯 Overview Boys_Streaming is a Python-based Streamlit application designed to run in a Docker container. It interfaces with a NAS-mounted video library to cast a specific sequence of content to a Chromecast device: **3 Stories (< 15m) followed by 1 Calm Music track (> 2h).** ## 🛠 Tech Stack * **Language:** Python 3.11+ * **Framework:** Streamlit (UI/UX) * **Casting Lib:** `pychromecast` * **Media Handling:** `ffmpeg-python` (for thumbnails and duration) * **Infrastructure:** Docker & Docker Compose * **Storage:** Local Bind Mounts (NAS source) ## 📂 Project Structure ```text . ├── app/ │ ├── main.py # Streamlit entry point & UI │ ├── cast_logic.py # Chromecast discovery & playback functions │ ├── library.py # File scanning & metadata (thumbnail) logic │ ├── server.py # Local HTTP server to serve media │ └── utils.py # DevOps helpers (logging, env vars) ├── config/ # Persistent storage mount (thumbnails, state) ├── videos/ # Mounted NAS directory (Read-only) ├── Dockerfile # Multi-stage build ├── docker-compose.yml # Portainer-ready deployment └── GEMINI.md # Project soul & context ``` ## 📜 Development Rules ### 🚀 DevOps Mindset * Clean, functional Python with strict type hints. * Robust logging for network discovery and Chromecast connectivity issues. * Environment-based configuration (use `.env` for local dev). ### 🧠 State Management * Use `st.session_state` to track the playlist selection and casting status. * Cache library scans (using `st.cache_data`) to mitigate NAS latency. * Persistence: Use the `/config` folder to track "already watched" or "random seed" state. ### 🎨 UI for Kids * **Thumbnails:** Primary selection tool. Large, high-quality previews. * **Large Buttons:** Touch-friendly and easy to read. * **Workflow:** Pick 3 Stories -> Auto-append Music -> Single "Cast" button. ### ⚖️ Logic Constraints * **"Stories":** Files strictly < 15 minutes. * **"Calm Music":** Files strictly > 2 hours. * **Sequence:** Always exactly 3 Stories + 1 Music (forced). ## 🚀 Commands | Task | Command | | :--- | :--- | | **Build** | `docker build -t boys_streaming:latest .` | | **Deploy** | `docker-compose up -d` | | **Logs** | `docker logs -f boys_streaming` | | **Stop** | `docker-compose down` | ## 🧠 Context & Edge Cases * **Networking:** Must use `network_mode: host` in Docker to allow mDNS/Chromecast discovery. * **Media Server:** Chromecast requires a URL. We must run a sidecar or internal HTTP server to serve `/videos`. * **Thumbnails:** Generate and store thumbnails in `/config/thumbnails` to avoid re-processing. * **Non-Negotiable:** The calm music video is the "exit strategy" and cannot be unselected.