A Django-based application for managing and tracking TV shows and movies from your Plex server. Syncs metadata from Plex and TVDB, tracks episode availability, and provides a web interface for browsing your media library.
Media Library Management
- Sync TV shows, episodes, and movies from Plex server
- Import detailed metadata from TVDB (The Movie Database)
- Track which episodes are available on disk
- Anime detection via genre classification
- Cast member tracking
Data Quality & Integrity
- Automatic duplicate media detection and cleanup
- Quality-based ranking for duplicate versions (resolution, codec, bitrate)
- Plex API-based deletion for remote NAS file management
- Season number normalization (handles "S01", "Season 1", etc.)
- Title aliasing for shows with multiple names
- Three-tier episode matching (TVDB ID → season/episode → normalized title)
Automation & Workflow
- Post-download processing with Plex connectivity checks
- Automatic file movement from download directory to Plex libraries
- Django database sync after new media added
- NZBGet post-processing integration (optional)
- Windows Task Scheduler support
- Manual processing commands with dry-run capability
User Interface
- Health status dashboard for TV shows with visual episode availability tracking
- Season-by-season progress bars with completion percentages
- Episode grids showing available (green) vs missing (red) episodes
- Genre and director filtering for movies
- Browse shows and movies with poster art
- View episode lists and availability
- Search functionality
- Missing episode tracking
- Detailed cast information pages
- Clickable genre tags and director links
- Python 3.12+
- PostgreSQL 16
- Plex Media Server
- TVDB API key
Clone the repository:
git clone https://github.com/kcinnick/nstv.git cd nstv
Create virtual environment:
python -m venv venv venv\Scripts\activate # Windows source venv/bin/activate # Linux/Mac
Install dependencies:
pip install -r requirements.txt
Configure environment variables:
cp .env.example .env # Edit .env with your credentials: # - DJANGO_DB_PASSWORD # - PLEX_EMAIL, PLEX_API_KEY, PLEX_SERVER # - TVDB_API_KEY
Run migrations:
python manage.py migrate
Create superuser:
python manage.py createsuperuser
Sync from Plex:
python nstv/plexController/add_shows_to_nstv.py python nstv/plexController/add_movies_to_nstv.py
Run development server:
python manage.py runserver
Audit Episode Duplicates:
# Check for duplicates (dry run) python manage.py audit_episode_duplicates # Fix duplicates by merging python manage.py audit_episode_duplicates --fix # Audit specific show python manage.py audit_episode_duplicates --show-id 123
Run the test suite:
pytest
Run specific test file:
pytest nstv/tests/testAddShowPage.py
Check for Django issues:
python manage.py check
nstv/- Main Django appmodels.py- Database models (Show, Episode, Movie, CastMember)views.py- Web interface viewsplexController/- Plex sync scriptsget_info_from_tvdb/- TVDB metadata importmanagement/commands/- Django management commandstests/- Test suite
djangoProject/- Django project settingstemplates/- HTML templatesdocs/- Documentation and runbooks
instructions.md- Claude Sonnet 4.5 backend development guidelinesfrontend-design-guidelines.md- UI/UX design system and component patternsdocs/plex-rebuild-runbook.md- Step-by-step Plex sync instructions.env.example- Environment variable template
MIT License