Plex CLI
Unified Plex management. Replaces plex-stats, plex-recommend, plex-cleanup, pmc-recently-added.
Quick Reference
plex.py stats # Server overview
plex.py watching # Who's streaming now
plex.py top [--days N] [--limit N] # Most watched content
plex.py recently-added [--days N] # New content
plex.py user-stats [--days N] # Per-user watch time
plex.py info # Server details
Setup
PLEX_URL="http://10.0.0.100:32400"
PLEX_TOKEN="C6DFr9z3gxx7CvyxsByc"
TAUTULLI_URL="http://10.0.0.100:8181"
TAUTULLI_API_KEY="wcPgAWR0P1P4necyrRCg3Jwirg7ZsnML"
Hardcoded defaults work without env vars.
Commands
stats
Server overview: library counts, active streams, version info.
watching
Current active sessions: who, what, device, quality, progress %.
top
Most watched movies/shows. Uses Tautulli history.
plex.py top --days 30 --limit 10
recently-added
New content added to libraries.
plex.py recently-added --days 7 --limit 20
user-stats
Per-user watch time and play counts.
plex.py user-stats --days 30
info
Server version, platform, last update.
Output
Auto-detects: JSON when piped, human in terminal. Force with --json.
APIs Used
- Plex API (
/status/sessions,/library/sections,/): XML responses - Tautulli API (
/api/v2): JSON responses, richer stats - Plex alone gives basic info; Tautulli adds history and analytics
Notes
- Library counts may show 0 if Plex XML attributes change
- Tautulli required for top/recently-added/user-stats
- Plex token expires if server is reset
--jsonauto-activates when not a TTY