A Python app, to extract movie information from Plex and push to Postgres
233
Export and analyze Plex Media Server data. Run it once or put it on a schedule. Funky, but not flashy.
# One-off run (no scheduling)
docker run --rm \
--name plex-export \
-e PLEX_BASE_URL=http://your-plex:32400 \
-e PLEX_TOKEN=your_plex_token \
-e DB_HOST=host.docker.internal \
-e DB_PORT=5432 \
-e DB_NAME=plex_stats \
-e DB_USER=myuser \
-e DB_PASSWORD=supersecret \
thorgilis/plex-export:latest
# Scheduled run (daily at 03:00)
docker run -d \
--name plex-export \
--restart=no \
--env-file .env \
-e CRON_SCHEDULE="0 3 * * *" \
thorgilis/plex-export:latest
python:3.12-slimcron for hands-off runsCRON_SCHEDULE is unset/empty: the container runs python app/main.py once, then exits.CRON_SCHEDULE is set: a cron job runs /usr/local/bin/run-etl.sh (which calls python app/main.py) on the schedule. Logs stream to stdout via /var/log/cron.log.| Name | Required | Description |
|---|---|---|
PLEX_BASE_URL | Yes | Plex server base URL |
PLEX_TOKEN | Yes | Plex auth token |
DB_HOST | Yes | Postgres host |
DB_PORT | Yes | Postgres port |
DB_NAME | Yes | Database name |
DB_USER | Yes | Database user |
DB_PASSWORD | Yes | Database password |
CRON_SCHEDULE | No | Cron expression for scheduled runs |
Pro tip: Use an .env file to avoid putting secrets in your shell history.
.envPLEX_BASE_URL=http://your-plex:32400
PLEX_TOKEN=your_plex_token
DB_HOST=host.docker.internal
DB_PORT=5432
DB_NAME=plex_stats
DB_USER=myuser
DB_PASSWORD=supersecret
# Leave empty to run once, or set a schedule:
CRON_SCHEDULE=0 3 * * *
services:
plex-export:
image: thorgilis/plex-export:latest
container_name: plex-export
environment:
- PLEX_BASE_URL=http://your-plex:32400
- PLEX_TOKEN=your_plex_token
- DB_HOST=host.docker.internal
- DB_PORT=5432
- DB_NAME=plex_stats
- DB_USER=myuser
- DB_PASSWORD=supersecret
- CRON_SCHEDULE=0 3 * * *
restart: "no"
# One-off run: logs print to stdout automatically
# Scheduled run: follow cron output
docker logs -f plex-export
latestlatest.--env-file .env over long -e listsMIT. See the project repository for details.
Content type
Image
Digest
sha256:1918fb6ef…
Size
61.2 MB
Last updated
about 1 year ago
docker pull thorgilis/plex-movie-export