Skip to content

feat: complete StreamTV remaining work — cache UI, tests, docs, cleanup#27

Open
roto31 wants to merge 10 commits into
mainfrom
cursor/streamtv-remaining-work-2b49
Open

feat: complete StreamTV remaining work — cache UI, tests, docs, cleanup#27
roto31 wants to merge 10 commits into
mainfrom
cursor/streamtv-remaining-work-2b49

Conversation

@roto31

@roto31 roto31 commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

Completes all Priority 1 and Priority 2 items from the StreamTV architecture document, based on the claude/vigilant-wright-6k8yga feature branch (which contains the download-first cache backend).

Commits

Commit Change
chore Remove 44 duplicate * 2.py / * 2.html backup files from api/, templates/, streaming/, importers/, middleware/, validation/
feat Add cache management UI page (streamtv/templates/cache.html), /cache route in main.py, and "Cache" nav link in base.html sidebar
feat Implement streamtv/utils/swiftdialog_credentials.py (macOS SwiftDialog credential provider with prompt_credentials, show_notification, prompt_text) and fix TVDB year filter TODO in metadata_providers.py
test Add full pytest suite: tests/conftest.py, test_cache_manager.py (10 tests), test_api_cache.py (9 tests), test_streaming_adapters.py (8 tests) — 27/27 passing
feat Wire AutoHealer into main.py lifespan startup/shutdown; wire metadata enrichment via create_metadata_manager() in channel_importer.py after MediaItem creation
docs Add docs/ARCHITECTURE.md with 17 Mermaid diagrams covering every subsystem; link from README.md; update .gitignore to track docs/
chore Run sync_distributions.py (65 paths → 7 platform variants); clean stale duplicate files from all distribution dirs

Architecture Diagrams Added (17 total)

  1. Repository layout
  2. System architecture overview
  3. Middleware request stack
  4. URL resolution flow
  5. MPEG-TS transcoding pipeline
  6. Hardware acceleration priority (macOS + Linux)
  7. Download-first cache lifecycle
  8. CachedMedia state machine
  9. Background download system
  10. Database entity relationships (ER)
  11. Configuration precedence
  12. Cache UI page data flow (new)
  13. Distribution sync flow
  14. Implementation roadmap
  15. Auto-healer lifecycle
  16. Metadata enrichment on import (new)
  17. Test coverage map (new)

Test Results

27 passed, 64 warnings in 3.89s
  • test_cache_manager.py — cache miss, hit, TTL eviction, LRU eviction, download pending check
  • test_api_cache.py — REST endpoint status codes (503 when cache disabled, 404 guards)
  • test_streaming_adapters.py — CacheFirstStreamManager hit/miss/disabled/non-cacheable, SwiftDialog no-op on non-macOS

Files Changed

  • streamtv/templates/cache.html — new
  • streamtv/templates/base.html — Cache nav link
  • streamtv/main.py/cache route, AutoHealer lifespan wiring
  • streamtv/utils/swiftdialog_credentials.py — implemented
  • streamtv/utils/metadata_providers.py — TVDB year filter
  • streamtv/importers/channel_importer.py — metadata enrichment hook
  • tests/conftest.py, tests/test_cache_manager.py, tests/test_api_cache.py, tests/test_streaming_adapters.py — new
  • pytest.ini — new
  • requirements.txt — added pytest/asyncio/cov dev deps
  • docs/ARCHITECTURE.md — new (17 diagrams)
  • README.md — Architecture section link
  • .gitignore — allow docs/ARCHITECTURE.md
  • All 7 platform distributions synced
Open in Web Open in Cursor 

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@roto31 roto31 marked this pull request as ready for review June 14, 2026 23:41
claude and others added 9 commits June 14, 2026 23:42
…ariants

Applies the complete cache system (previously only in docker-compose) to
every StreamTV deployment variant: macOS (priority), Linux, Windows, root,
docker, kubernetes, and podman.

All variants now have:
- streamtv/cache/ package (cache_manager, archive_org_downloader,
  youtube_downloader, download_queue, download_scheduler)
- streamtv/api/cache.py REST endpoints
- streamtv/streaming/cache_first_stream_manager.py
- Updated config.py, database/models.py, main.py, mpegts_streamer.py,
  api/__init__.py
- requirements.txt: apscheduler>=3.10, internetarchive>=4.0
- config.example.yaml: cache section with annotated examples

https://claude.ai/code/session_01KpHjxJt9VnasH1w7EFzyp4
…lan for Cursor AI

Comprehensive reference document covering:
- Complete current architecture (API endpoints, DB models, streaming pipeline)
- Full configuration reference with all 15 config sections
- Download-first cache system documentation (completed work)
- 12 remaining tasks with exact file paths, code, and implementation steps
- Quick-start checklist for Cursor AI pickup
- Distribution sync instructions

https://claude.ai/code/session_01KpHjxJt9VnasH1w7EFzyp4
…reaming, importers, middleware, validation

Co-authored-by: roto31 <roto31@users.noreply.github.com>
Co-authored-by: roto31 <roto31@users.noreply.github.com>
Co-authored-by: roto31 <roto31@users.noreply.github.com>
…ytest.ini

Co-authored-by: roto31 <roto31@users.noreply.github.com>
Co-authored-by: roto31 <roto31@users.noreply.github.com>
Co-authored-by: roto31 <roto31@users.noreply.github.com>
…tests

Co-authored-by: roto31 <roto31@users.noreply.github.com>
@cursor cursor Bot force-pushed the cursor/streamtv-remaining-work-2b49 branch from 9b56c28 to bf346ea Compare June 14, 2026 23:42
…, path traversal guard

- CWE-20 (Incomplete URL substring sanitization): replace all 'domain.com' in url
  substring checks with urllib.parse hostname comparisons in:
  cache/download_scheduler.py, cache/youtube_downloader.py,
  importers/channel_importer.py, streaming/mpegts_streamer.py
- CWE-79 (Reflected XSS): html.escape() on schedule_id in main.py HTMLResponse fallback
- CWE-22 (Path traversal): Path(file_path).resolve() + relative_to(cwd) guard in
  api/import_api.py before any filesystem operations on user-supplied path

Synced fixes to all 7 distribution variants via sync_distributions.py

Co-authored-by: roto31 <roto31@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants