Home/Projects/Media Library Organizer
Python 3RichJellyfinIn daily use

Media Library Organizer

New downloads, sorted the way Jellyfin wants them.

NewMediaSorter, the organiser's engine, takes whatever lands in an incoming folder and works out what it is: a film, a TV season, an album, a compilation, an audiobook or an eBook. It matches it against online catalogues and files it under a clean, consistent name. It shows you the whole plan first, and moves nothing until you agree.

Sorts into6 libraries
MatchingTMDB · Discogs · Gemini
InterfaceRich terminal UI
SafetyPlan first, then move
ScreensModesHow a sort worksLibrariesMatchingEdge casesSetup

On screen

Every decision is laid out in a table before anything moves.

NewMediaSorter plan phase listing each incoming item, its destination, how it was matched and what will happen to it.
Phase 1: each incoming item matched and given a destination.
NewMediaSorter clean-up scan listing naming and folder problems found in an existing library.
Clean-up: a read-only scan of the existing library.

Example screens with sample titles and paths.

Three ways to run it

Start it with no options for a menu, or go straight to a mode.

--sort

Sort new downloads

The everyday run. Reads the incoming folders, plans every move, waits for your go-ahead, then files everything and tidies up the leftovers.

clean mode

Clean existing library

Scans libraries you already have for misnamed folders, missing years, loose files, stray featurettes and split compilations, and fixes them in bulk.

--backfill

Fill in missing artwork and info

Walks the music library and adds whatever is missing: album covers, album info files, artist pictures and artist info files that Jellyfin reads.

How a sort works

Two phases, so you always see the result before it happens.

Scan

Reads every item in the incoming folders.

Identify

Works out the media type from names, tags and structure.

Match

Looks each item up to get the proper title and year.

Plan

Shows every destination, duplicate and item it is unsure of.

Move

After you confirm, files everything with its subtitles.

Tidy

Removes samples and junk, then clears emptied folders.

Where things go

Each type has its own library and naming pattern.

MoviesTitle (Year)/
TVShow/Season 01/
MusicArtist/Album (Year)/
CompilationsMusic/VA/
AudiobooksAuthor/Title/
eBooksAuthor/Title

Matching sources

Free catalogues do most of the work. API keys unlock the rest.

SourceUsed forNeeds a key
TMDBFilm and TV titles, years and IDskeyTMDB.txt
TVMazeTV show and episode detailsNo
MusicBrainzAlbum and artist detailsNo
Cover Art ArchiveAlbum artworkNo
DiscogsAlbum title search and release detailsdiscogsToken.txt for search
GeminiA second opinion on albums and items it is unsure aboutkeyGemini.txt

Key files sit next to the script and are read only when a lookup needs them, so a key can be added or changed without touching code. A missing key gives one clear warning and that lookup is skipped. BuntuOps can copy the key files beside the script for each run.

The awkward cases, handled

Film and TV

  • Duplicates two copies of the same title: the larger is kept, the smaller discarded
  • Featurettes extras go to the film's Featurettes folder instead of being mistaken for the film
  • Subtitles matching, loose and Subs/ folder subtitles move with their video
  • Season packs split into the right season folder, subtitles per episode
  • Samples and junk sample clips, release notes and stray images are removed

Music and books

  • Compilations various-artist albums detected and kept together under VA
  • Box sets multi-disc releases filed as one album with numbered discs
  • Folder patterns common naming styles from different sources recognised
  • Audiobooks filed by author and title from their tags
  • Unsure items flagged for your review instead of guessed

Usage

# menu (Enter = sort new downloads)
python3 new_media_sorter.py

# sort new downloads
python3 new_media_sorter.py --sort

# fill in missing music artwork and info
python3 new_media_sorter.py --backfill

Requirements

  • Python 3 with rich and mutagen
  • Library folders set once in the configuration block at the top of the script
  • API keys for TMDB and Gemini, plus an optional Discogs token
  • Jellyfin or any media server that reads the same folder layout

Explore the other projects