refactor(plex): split routes/plex.py into an admin/browse/playback package

R12 S1 step B. The 2011-line routes/plex.py becomes an app/routes/plex/
package:

- admin.py     — connection test, catalog sync, owner watch-link config (5)
- browse.py    — libraries, facets, collections, playlists, show/item, people (23)
- playback.py  — image/subtitle proxies, HLS streaming, watch-state writes (10)
- _shared.py   — the two genuinely cross-module helpers (_item_or_404, log)
- __init__.py  — assembles `router` from the three sub-routers; the app wiring
                 (plex_routes.router in main.py) is unchanged.

Mechanically generated and proven behaviour-equivalent: every function/class
source relocated verbatim (get_source_segment equality) and the (method, path)
route set is identical to before. Endpoints keep the /api/plex prefix on each
sub-router. No SQL change (db.query untouched; 2.0 select() is the next step).

Gate: ruff clean, pytest 193 passed (pure-logic + DB lane).
This commit is contained in:
2026-08-11 21:30:01 +02:00
parent 4106bceb08
commit 99befa6e38
5 changed files with 634 additions and 683 deletions
+13
View File
@@ -0,0 +1,13 @@
"""Plex route package — assembles the admin/browse/playback sub-routers.
Split out of the former single routes/plex.py (R12 S1). `router` keeps the same shape the app
wiring expects (`plex_routes.router`), so main.py is unchanged.
"""
from fastapi import APIRouter
from app.routes.plex import admin, browse, playback
router = APIRouter()
router.include_router(admin.router)
router.include_router(browse.router)
router.include_router(playback.router)