Skip to content

Repository files navigation

Unofficial Plex Server CLI Script

🎥 A simple CLI interface for interacting with your Plex server! 🎬

-----------------------------------------------------

💫 Overview

The plex-cli.py is a python wrapper script for interacting with your Plex Server's API via the CLI. It uses the plexapi pip module to get info about libraries, search libraries, list current library contents, refresh library data, and more!

-----------------------------------------------------

👇 Install & Setup

First clone this repo:

git clone https://github.com/BlueSquare23/plex-cli.git

Then install the pip requirements:

pip install -r requirements.txt

Finally setup your plex-cli.conf file:

  • Example:
[server]
server = YOUR_PLEX_SERVER_URL
token = YOUR_TOKEN_HERE

📍 Note: You may need to edit the hardcoded CONF var path in the actual plex-cli.py if you plan on moving these files elsewhere on your system.

-----------------------------------------------------

❔ Usage

usage: plex-cli.py [-h] [-i] [-j] [-l] [-r] [-m {all,doc_movies,doc_tv_shows,movies,tv_shows,web_series} [{all,doc_movies,doc_tv_shows,movies,tv_shows,web_series} ...]] [-s SEARCH] [-t TITLE] [-y YEAR]
[-g GENRE] [-a ACTOR] [-p] [-v] [-d]
A simple CLI script for interacting with your plex server
options:
-h, --help show this help message and exit
-i, --info Get info on libraries
-j, --json Get output in json format
-l, --list List contents of specified library
-r, --refresh Refresh specified libraries data
-m {all,doc_movies,doc_tv_shows,movies,tv_shows,web_series} [{all,doc_movies,doc_tv_shows,movies,tv_shows,web_series} ...], --library {all,doc_movies,doc_tv_shows,movies,tv_shows,web_series} [{all,doc_movies,doc_tv_shows,movies,tv_shows,web_series} ...]
Library to interact with (default: All)
-s SEARCH, --search SEARCH
Search for media matching input
-t TITLE, --title TITLE
Search for media by title (default search)
-y YEAR, --year YEAR Search for media by year
-g GENRE, --genre GENRE
Search for media by genre
-a ACTOR, --actor ACTOR
Search for media by actor
-p, --sessions List currently playing media sessions info
-v, --verbose Verbose mode - Print additional output
-d, --debug Debug mode - Print additional debug output

-----------------------------------------------------

🔰 Examples

  • List Libraries Info
plex-cli.py --info
  • Refresh Documentary TV Shows Library
plex-cli.py --refresh --library doc_tv_shows
  • List Current Sessions
plex-cli.py --sessions --verbose
  • List All Movies Verbose
plex-cli.py --list --library movies -v
  • List All TV Show w/ JSON Output
plex-cli.py --list --library tv_shows -v --json
  • Search for Movie by Actor and Year
plex-cli.py --year 1970 --actor "Charlton Heston" --library movies -v

-----------------------------------------------------

🔐 Additional Auth Scripts

If you'd like to ensure that the plex api auth key in your plex-cli.conf stays up to date you can use the scripts linked below. Not written by me, but they should do the needful. Just be aware he calls the conf plex_config.ini, but yeah same file as what I call plex-cli.conf.

Plex Auth Token Rotate Scripts

Maybe some day I'll rip those off tweak em a bit and include them in this repo.

-----------------------------------------------------

🆓 License MIT

MIT License Text

-----------------------------------------------------

✍️ Author

John L. Radford

"Buy Me A Coffee"

About

A simple python wrapper script for interacting with your Plex Server's API via the CLI.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages