Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 3.3.0 instead.
Reason given by maintainers: Obsoleted by later version.

plextool

Command line tools for Plex library maintenance, built on python-plexapi. They talk to the server through its API. Nothing here touches the Plex database file, which is too risky to edit by hand.

What it is useful for

plextool is a command line toolkit for looking after a Plex Media Server: fixing things Plex's web interface can't, and finding problems across a large library. Typical jobs:

  • Fix the Recently Added order. This is what it was first built for. Plex has no way to edit the Recently Added lists, so after you rebuild the database, delete duplicate files and rescan, or reorganise files on disk, everything shows up as "new" and the real newest content is buried. plextool recent changes the "added at" date of movies, shows, seasons and episodes: set each item back to its own release or air date, shift dates by an offset, or set one date for a whole batch. The date is locked so a rescan can't undo it.
    $ plextool recent --recent 20 --release              # preview: put the 20 newest back to their release dates
    $ plextool recent --title "Some Show" --shift=-30d --commit
    
  • Find and remove duplicate movies and episodes. plextool dupes lists every item Plex holds more than one file for, and can delete the extras you don't want.
  • Free up disk space. plextool stale finds large, never-watched or long-idle movies and shows.
  • Audit a library. plextool audit reports unmatched items, missing files, missing posters or summaries, low-resolution video, and missing subtitle or audio languages.
  • Copy, back up and restore watched status. plextool watched moves watched state between users (for example when a shared account is split), saves it to a file, and restores it after a rebuild or when someone closes and reopens their Plex account.
  • Clear a stuck Continue Watching list. plextool resume lists and removes entries that won't go away.
  • Back up and restore playlists. plextool playlists saves video playlists to a file and recreates them on the same or another server.
  • Get subtitles. plextool subs extracts the subtitle tracks inside MKV and MP4 files, searches Plex's subtitle providers for a language and downloads one, and, with --export, copies the subtitle Plex downloaded out of its database into a file beside the video so it works outside Plex too. Plex itself never writes that file.
  • Script Plex. Reports can print JSON, and exports can go through a pipe, so the output feeds other tools.

Everything that changes the server is a preview until you pass --commit. plextool uses Plex's API and never edits the Plex database file. It signs in through your browser with plextool auth, and works against a server on the same machine, across the internet, or directly with no internet access (plextool server).

Commands

Command What it does
plextool auth Sign in to Plex with a link or QR code, list and remove old sign-ins from your account, and wipe the saved login and keys.
plextool server Find servers on your account or network and choose the one to use. Covers working offline or directly against the server.
plextool status Server version, library sizes, who is watching what.
plextool scan Scan libraries or a single folder, refresh metadata, empty trash, optimize.
plextool recent Change "added at" dates to reorder Recently Added. Works on movies, shows, seasons and episodes.
plextool dupes List movies and episodes that have more than one file, and optionally delete the extras.
plextool stale Find large, unwatched or long-idle content to free up space.
plextool audit Find unmatched items, missing files, missing posters or summaries, low resolution, missing subtitle or audio languages.
plextool watched Copy watched state between users, back it up and restore it, or mark a show or movie watched.
plextool resume List or clear stuck Continue Watching entries.
plextool playlists Back up and restore video playlists.
plextool subs Extract subtitles from MKV and MP4 files, search Plex's subtitle providers for new ones and pick which to download, and copy subtitles Plex downloaded (kept in its database, not beside the video) out as files next to the video. Files are named for Plex, forced and SDH included.

The plextool commands that change anything do a dry run unless you pass --commit. Deleting files (dupes --keep) also asks you to type DELETE.

Quick start

Install it from PyPI. This needs python installed as a prerequisite:

$ python3 -m venv .venv && source .venv/bin/activate   # optional: keeps plextool's packages separate
$ pip install 'plextool[qr]'        # '[qr]' adds a QR code to the sign-in; leave it off if you don't want one
$ plextool auth login               # open the link it prints (or scan the QR code) and approve
$ plextool server find              # servers on your Plex account and on your network
$ plextool server use "My Server"   # one of the names from the list
$ plextool status                   # libraries, and who is watching what right now

status ends with what is playing:

Now playing (1 session, 0 transcoding)
  alice: Some Movie (2020) [playing] on Living Room TV

To get, say, Swedish subtitles for that movie from the subtitle providers Plex searches:

$ plextool subs fetch -t "Some Movie" --lang sv --list               # see what is available; nothing is downloaded
$ plextool subs fetch -t "Some Movie" --lang sv --choose --commit    # pick one; Plex downloads it
$ plextool subs fetch -t "Some Movie" --lang sv --choose --export --commit   # same, and also save a file beside the video

Where the subtitle ends up. When Plex downloads a subtitle from a provider, it keeps the copy in its own database. It does not put a file next to the video, so only Plex can show it: another player, or another Plex server, never sees it. The first two commands stop there, and you pick the subtitle from the player's subtitle menu.

--export gets around that. Once Plex has downloaded the subtitle, plextool copies Plex's stored copy out of the server and saves it as an ordinary file beside the video (<video name>.sv.srt), which any player can use. It doesn't read the video file, so the MKV or MP4 is never opened, and it doesn't contact the subtitle provider. (Subtitle tracks that are already inside an MKV or MP4 are a different job, for plextool subs extract.) For --export, the machine you run it on must be able to read the media files. If it sees them under a different path than Plex does, use --map. The subs page sets out where each kind of subtitle comes from.

For a TV show, -t "Some Show" covers every episode, which is a search for each one, so start with --list.

If the server is on the machine you are typing on, skip server find and server use: plextool tries http://localhost:32400 by default. Without internet access, see working offline.

Getting help

Every command explains itself, with options and examples:

$ plextool --help
$ plextool recent --help
$ plextool watched copy --help

A fuller page for each command is on Read the Docs (linked in the table above); its source is in docs/source/commands/.

Install

plextool is tested on Python 3.12. It declares Python 3.9 or later, so pip will install it on older versions. If something doesn't work on one, please open an issue with your Python version.

plextool subs also needs MKVToolNix (mkvmerge, mkvextract) for MKV files and FFmpeg (ffmpeg, ffprobe) for MP4 files. You only need the ones for the file types you use.

$ pip install plextool     # installs the `plextool` command
$ plextool --help

To install from a checkout instead (this needs git):

$ git clone https://github.com/milkmansson/plextool.git
$ cd plextool
$ pip install .

To run from a checkout without installing, pip install -r requirements.txt and use python3 -m plextool ... instead.

Connecting

Sign in once. This prints a link (and a QR code, if segno is installed) to approve in a browser:

$ plextool auth login
$ plextool server find                       # skip if the server is on this machine
$ plextool server use "My Server"            # or: server use http://myserver:32400

Without a saved choice, plextool uses http://localhost:32400, or $PLEX_URL or --base-url if given. plextool server explains the options, including working with no internet or directly on the server's machine.

That saves a Plex token in ~/.config/plextool/ (readable only by you). plextool auth explains exactly what is kept, how to wipe it with plextool auth wipe, and --type jwt, a short-lived token that plex.tv accepts but Plex Media Server doesn't yet.

If you would rather supply your own Plex token, plextool looks for one in this order: --token, --token-file FILE (- for standard input), $PLEX_TOKEN, the output of $PLEX_TOKEN_CMD, then the saved login. Prefer --token-file or the environment to --token, which leaves the token in your shell history.

Development

$ pip install -e '.[dev]'
$ pytest

Disclaimer

These tools only use the documented plexapi calls, but they do write to your server when you pass --commit. Check the dry run first. Use at your own risk.

Metadata

Release files for plextool 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plextool 3.0.1
File Size Uploaded Provenance Actions
plextool-3.0.1.tar.gz 65.5 kB With provenance Details for plextool-3.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plextool 3.0.1
File Interpreter ABI Platform Actions
plextool-3.0.1-py3-none-any.whl Python 3 none any Details for plextool-3.0.1-py3-none-any.whl

Total release size: 121.4 kB

Release files / plextool-3.0.1.tar.gz

Download URL plextool-3.0.1.tar.gz
Size 65.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6ce1493599e2ce77c23a6cac0dc26bb4a22e798405bd2ff53612e5ce77912a13
BLAKE2b-256 checksum
How to use checksums
d5f38d2c1b066f63f2ea9301dd51fce2667225d4fbb1c2d413eec028c230347f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Release files / plextool-3.0.1-py3-none-any.whl

Download URL plextool-3.0.1-py3-none-any.whl
Size 55.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da776b8f5c676a8e9fee19d9a69265f59f7d04a9d175f514470d1b303fe07eb1
BLAKE2b-256 checksum
How to use checksums
4baeab557889c978abf5eed9f129dd68dd0355d5f2ebed3e23f42537c75d1450
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

Security for plextool 3.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for plextool-3.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.0.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page