3.3 KiB
3.3 KiB
Plex Export Project
Goal
Create a one-off local Python workflow that exports Michael's Plex library into two JSON files so Soren can analyse what is available and later help with recommendations, unwatched content, abandoned shows, and similar watch guidance.
Why this approach
- Local-first and low-drama
- Avoids direct ongoing live access where possible
- Keeps Plex credentials limited to a local
.envfile - Produces reusable snapshots Soren can read repeatedly without re-querying Plex every time
Current project location
projects/plex-export/
Files created
projects/plex-export/export_plex_library.pyprojects/plex-export/.env.exampleprojects/plex-export/README.md
Current script behaviour
- Connects to a Plex server using:
PLEX_BASE_URLPLEX_TOKEN- optional
PLEX_VERIFY_SSL
- Automatically fetches Plex library sections
- Exports all sections of type:
movieshow
- Writes output to:
projects/plex-export/exports/movies.jsonprojects/plex-export/exports/shows.json
- Groups content by Plex section/library
- Includes useful metadata such as:
- title
- year
- summary
- genres
- ratings
- watched/view count
- last viewed
- added date
- show episode counts
- unwatched episode count
- media/codec/file metadata
Important decisions made
- Do not store this under
knowledge/; keep it as a standalone project under top-levelprojects/ - Separate exports into movies and TV shows
- Section IDs are optional and should be left unset if Michael wants access to all movie/show libraries
- Preferred model is a one-off/local export snapshot, not full-time live Plex integration (at least initially)
Current blocker
The script is ready but not yet configured because Plex credentials are not in place yet.
Missing local config file:
projects/plex-export/.env
Required values:
PLEX_BASE_URLPLEX_TOKEN
Optional values:
PLEX_VERIFY_SSL=true|falsePLEX_MOVIE_SECTION_IDS=...PLEX_SHOW_SECTION_IDS=...
What Michael asked about
- How to find the Plex token
- Whether section IDs are necessary
Answers established
- Section IDs are not needed if the goal is to export everything available; the script already exports all
movieandshowsections by default - Best token acquisition method suggested:
- Open Plex Web
- Open browser developer tools
- Use the Network tab
- Refresh the page
- Inspect a request for
X-Plex-Token
Next steps for tomorrow
- Michael obtains Plex token
- Create
projects/plex-export/.env - Add at least:
PLEX_BASE_URL=http://<plex-host>:32400PLEX_TOKEN=<token>
- Leave section IDs unset unless filtering is desired
- Run:
cd /home/openclaw/.openclaw/workspace/projects/plex-export python3 export_plex_library.py - Read and analyse:
projects/plex-export/exports/movies.jsonprojects/plex-export/exports/shows.json
Intended outcomes after export
Use the exported library snapshot to support conversations like:
- what should we watch tonight?
- what good stuff do we own but haven’t watched?
- what shows were started and abandoned?
- what comfort-watch or sci-fi options are already in the library?
- what’s similar to a given film/show from what is already available locally?