Use an LLM to derive titles for Plex videos from filenames
1.7K
Use an LLM to generate human-readable titles for Plex media items based on their filenames. This tool only processes media items with unlocked title fields, so you can lock titles you want to preserve.
Docker images are available from Docker Hub at cdzombak/plex-ai-titler.
The Docker image stores credentials in /data/.creds.json and reads config from /data/config.yaml. Mount a volume to /data:
# Create a local directory for credentials and config
mkdir -p ~/.plex-ai-titler
# Copy and edit the example config
cp config.example.yaml ~/.plex-ai-titler/config.yaml
# Edit ~/.plex-ai-titler/config.yaml with your AI settings
# Run interactively
docker run -it --rm \
-v ~/.plex-ai-titler:/data \
cdzombak/plex-ai-titler
On first run, you'll be prompted for Plex.tv credentials. After authentication, the token is saved to the mounted volume and reused automatically on subsequent runs.
docker run -it --rm \
-v ~/.plex-ai-titler:/data \
cdzombak/plex-ai-titler \
--url http://192.168.1.100:32400 \
--token YOUR_PLEX_TOKEN
docker build -t plex-ai-titler .
Requires Python 3.10+.
git clone https://github.com/cdzombak/plex-ai-titler.git
cd plex-ai-titler
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Copy the example config and edit it:
cp config.example.yaml config.yaml
Edit config.yaml to set your AI endpoint, model, and system prompt. The API key can be set in the config file or via the OPENAI_API_KEY environment variable.
python plex_ai_titler.py
The program will interactively:
After successful MyPlex authentication, your auth token is cached in .creds.json. On subsequent runs, the cached token is used automatically.
Set the PLEX_CREDS_FILE environment variable to change the credentials file location. Delete .creds.json to clear cached credentials.
The config file (config.yaml) supports the following options:
ai:
# OpenAI-compatible API endpoint
endpoint: "https://api.openai.com/v1"
# Model to use
model: "gpt-4"
# API key (can also use OPENAI_API_KEY env var)
api_key: "sk-..."
# Temperature (0.0 = deterministic)
temperature: 0
# System prompt for title generation
system_prompt: |
You will be given a filename of a video...
-v, --version Show version and exit
-c, --config PATH Path to YAML config file (default: config.yaml)
Direct connection:
--url URL Plex server URL
--token TOKEN Plex authentication token
MyPlex authentication:
-u, --username USER Plex.tv username
-p, --password PASS Plex.tv password
GNU GPL v3; see LICENSE in this repository.
Chris Dzombak
Content type
Image
Digest
sha256:5ea2b9f5c…
Size
52.6 MB
Last updated
9 months ago
docker pull cdzombak/plex-ai-titler