Organizing a Plex Library: Naming, Agents, and Metadata

Name movie and TV files so Plex matches them automatically, pick the right metadata agents, and fix wrong titles and broken sort order in an existing library.

A Plex server is only as good as the library behind it. Get the naming right and Plex matches almost everything automatically with correct posters, summaries, and sort order. Get it wrong and you’re staring at “The.Movie.2019.1080p.WEB-DL.x265” tiles and films filed under “T” for “The.”

This post covers the naming convention Plex expects, which metadata agents to assign, and how to repair an existing messy library — wrong titles, junk sort order, and all. It’s the third post in the Plex series, after installation and playback tuning.


The naming convention Plex expects

The scanner identifies content by name. Match this layout and matching becomes hands-off. It follows Plex’s official conventions for naming movies and naming TV shows.

Movie and TV folder layout

Movies/
The Matrix (1999)/
  The Matrix (1999).mkv
Dune (2021)/
  Dune (2021).mkv

TV/
Firefly/
  Season 01/
    Firefly - S01E01.mkv
    Firefly - S01E02.mkv

The rules that matter:

  • One folder per movie, named Title (Year). The year disambiguates remakes (there are several films called “The Mummy”).
  • The file inside repeats the folder name. Extra tags after it (resolution, group) are tolerated but keep them minimal.
  • TV uses show → Season NNShow - S01E02. The SxxEyy pattern is what maps a file to an episode.
Tip

If you download with Radarr or Sonarr, let them rename on import — their default format already matches this convention, so files land correctly named without manual work.


Task 1: Assign the right agents and scanners

Each library uses a scanner (finds and groups files) and an agent (looks up metadata). Set them per library in Settings → Libraries → Edit → Advanced.

Library Scanner Agent
Movies Plex Movie Plex Movie (uses TMDb/IMDb)
TV Shows Plex TV Series Plex TV Series
Anime Absolute Series Scanner a specialized anime agent (e.g. an MAL/AniDB agent)
Keep anime in its own library

Anime often uses absolute episode numbering that trips up the standard TV scanner. Put it in a separate library so you can assign a different scanner and agent without affecting your Western shows. Mixing them in one library forces a single agent on both.


Task 2: Fix files the scanner couldn’t match

Even with good naming, a few files land as “unmatched.” Two approaches:

1Match it manually in the UI1 min each

Hover the item → ⋯ → Match → Search. Pick the correct result. Plex applies it and remembers.

2Rename release-group folders in bulkvaries

If files are named after release groups (SPARKS, YIFY) with no clean title, the scanner has nothing to work with. Rename them to Title (Year) first, then refresh. A rename to the convention fixes far more than fighting the agent.

Watch out for folder-name mismatches

When adopting a messy library into Radarr, it can match a folder named after something other than the film (a rating folder like “PG” or “R”, or a collection name) to the wrong movie and rename the file accordingly. After a bulk adoption, audit for mislabels: compare each file’s actual runtime (ffprobe) against the movie’s expected runtime and flag any big mismatch. A 90-minute file matched to a 200-minute epic is a renamed-wrong file.


Task 3: Fix wrong or junk titles

Sometimes Plex matches the right item (correct poster and summary) but locks a raw filename as the title — so it sorts and displays as The.Worlds.End.2013.1080p.BluRay. The metadata is fine; only the title field is junk.

Fix it and lock the clean title so a rescan won’t undo it. This is easiest over the API on a headless server:

Set and lock a clean title (section 4 = your Movies library)

# ratingKey = the item's key (from the URL or /library/sections/4/all)
curl -X PUT "http://<server-ip>:32400/library/sections/4/all?\
type=1&id=<ratingKey>&title.value=The%20World%27s%20End&title.locked=1\
&X-Plex-Token=YOUR_PLEX_TOKEN"
Note

Not every dotted or numeric title is junk — “10 Things I Hate About You”, “When Harry Met Sally…”, and “The Man from U.N.C.L.E.” are legitimate. Compare the current title against a trusted source (the movie’s title in Radarr/TMDb) before overwriting, so you don’t “fix” a correct one.


Task 4: Fix alphabetical sort order

By default a library filled with “The …” titles clusters everything under T. Plex doesn’t reliably strip leading articles, so set the sort title explicitly — the title minus a leading The / A / An — and lock it:

Strip the leading article for sorting

# "The Matrix" -> sortTitle "Matrix" so it files under M
curl -X PUT "http://<server-ip>:32400/library/sections/4/all?\
type=1&id=<ratingKey>&titleSort.value=Matrix&titleSort.locked=1\
&X-Plex-Token=YOUR_PLEX_TOKEN"
Never blank the sort title

Setting titleSort.value to an empty string sorts the item before “A” — it jumps to the very top of the library. Always set the article-stripped title, never an empty value.


Task 5: Keep it clean automatically

Manual fixes are for the one-time cleanup. Going forward, prevent the mess:

  • Let Radarr/Sonarr rename on import so files arrive in the Title (Year) convention.
  • Enable “Update library on import” (a Plex notification from Radarr/Sonarr) so new media appears without a manual scan.
  • Lock titles and sort titles you’ve corrected, so a metadata refresh can’t revert them.
Tip

The whole download-to-Plex pipeline — Prowlarr, Radarr, Sonarr, and a torrent client behind a VPN — is what feeds correctly-named files into these libraries. See the VPN Torrent Stack playbook for the download client, and keep it shielded behind a VPN so your real IP never touches a swarm.


What’s next

A cleanly-named, correctly-matched library is the payoff of the whole Plex series: installation, smooth playback, and now tidy metadata. From here it’s just adding content — ideally through an automated pipeline that names everything correctly on the way in.


Related posts: