routes/plex/browse.py was a 1693-line god-module (libraries + facets + collections + playlists + show/item detail + people). Split it into focused sibling routers under the same /api/plex prefix — pure code motion, no SQL / route-path / response-shape changes: browse.py 1693 -> 469 (list_libraries, unified_library, facets) collections.py (new 253) browse + admin collection editor; owns _collection_source playlists.py (new 405) the user's orderable playlists detail.py (new 438) show/item detail + enrichment; _lib_key lives here people.py (new 139) cast/crew chips + person filmography Cross-module helpers _norm_lang + _content_libs move to _shared.py (their one home); detail imports _collection_source from collections (one-way, no cycle). __init__.py includes the four new routers. Three DB-lane tests follow the moved symbols (import path for _content_libs; monkeypatch targets for PlexClient / _show_enrichment now on detail). Behaviour-equivalent: ruff clean, 348 DB-lane pass (unchanged), parity net green.
31 lines
980 B
Python
31 lines
980 B
Python
"""Plex route package — assembles the admin/browse/playback sub-routers.
|
|
|
|
Read endpoints (libraries/browse/show/image) are available to ANY authenticated user (demo +
|
|
pure-Siftlode included) — this is an access layer to the Plex library WITHOUT requiring a plex.tv
|
|
account, and playback is a local file. Admin endpoints test the connection and run the catalog sync.
|
|
|
|
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,
|
|
collections,
|
|
detail,
|
|
people,
|
|
playback,
|
|
playlists,
|
|
)
|
|
|
|
router = APIRouter()
|
|
router.include_router(admin.router)
|
|
router.include_router(browse.router)
|
|
router.include_router(collections.router)
|
|
router.include_router(detail.router)
|
|
router.include_router(people.router)
|
|
router.include_router(playback.router)
|
|
router.include_router(playlists.router)
|