A Plex Script I wrote to update an entire season's audio/subtitle settings, without having to leave plex.
This works by constantly polling active plex sessions using the plexapi module.
As you watch shows on plex, the script caches what media that active clients are watching. This includes information like the selected Audio and Subtitle streams.
If your audio/subtitle stream has changed since the last update, but you're still watching the same episode, the script will attempt to update the entire season.
Make sure you have Python 3 installed before continuing.
- Clone this repository using
git clone. - Modify
config.inito match your setup.- It's recommended to keep the script locally on your plex server. The script executes much faster.
- For help with finding your plex token, visit here
- Run
pip install -r requirements.txtto install the required modules. You can do this in a virtual environment as well. - Run
app.py. Having the script run at startup is ideal, but I haven't tried that just yet.
If you want to run this within a docker container, it's pretty straightforward.
- Clone this repository using
git clone. - Modify
config.inito match your setup. Leave the Plex API Token field as-is if you want to use environment variables.- It's recommended to keep the script locally on your plex server. The script executes much faster.
- In the case of docker for Windows, you can use
host.docker.internalas your plex host. - For help with finding your plex token, visit here
- Build the docker image using
docker build -t screwage/plex-scripts:auto-stream-swap . - Start up and run the container using
docker container run -d -e PLEX_API_TOKEN=<PLEX_TOKEN_HERE> --restart always --name plex-stream-swap screwage/plex-scripts:auto-stream-swap
- Clean up stale sessions
- Add support for multiple plex tokens
- Research ways to perform similar functionality without requiring tokens from each user
- Add logging to file
- Improve logging to include client identifier
- Rename this project to... literally anything else
- Check that the sessions picked up belong to the current user