blacktwin / JBOPS

Just a Bunch Of Plex Scripts
1.66k stars 308 forks source link

Add new Plex python script to change subtitle settings for all movies and shows in library to "prefer non-forced subtitles" #369

Closed RileyXX closed 1 year ago

RileyXX commented 1 year ago

PlexPreferNonForcedSubs.py

Short description:

This python script will set all movies and shows in your local Plex library to English non forced subtitles by default. The subtitle selections will apply to your Plex profile and be remembered on other devices.

Long description:

This script was created with the help of ChatGPT Open AI and further edited and completed by me. It uses Plex Python Api. It will set all movies and shows in your local Plex library to English non forced subtitles by default. The subtitle selections will apply to your Plex profile and be remembered on other devices. Assuming your Plex subtitles settings are setup in your server settings Plex will default to Forced Subtitles by default when they are available for a given item. Plex will not allow you to prefer non forced subtitles natively hence why this script was created.

This script is confirmed tested and working. Feel free to use this code for your own purposes. Thanks to all who helped! If you use this script and run into any bugs feel free to open an issue. Cheers!

Known issues/future outlook:

What are "non-forced" subtitles?

Non-forced subtitles provide subtitles everytime a characters speaks.

What are "forced" subtitles?

Forced subtitles only provide subtitles when the characters speak a foreign or alien language.

Instructions:

Windows:

To use this script on Windows. Simply install latest version of Python.

  1. Download the latest PlexPreferNonForcedSubs.py script.
  2. Replace xxxxxxx in the script with your plex api token.
  3. Make sure Plex media server is running locally then run the script and watch it work its magic.
Note:

This script should work fine on any other operating system. No need to make any changes.

Also posted on:

Screenshots:

Plex subtitle dropdown after script is done running:

Plex Subtitle Dropdown

PlexPreferNonForcedSubs.py script in action:

PlexPreferNonForcedSubs.py Script in Action

blacktwin commented 1 year ago

The Movie and Show library loops share a lot of the same code. You can simplify this by having a separate method to grab the library items and another method for setting the subtitles for the library items that were grabbed.