Skip to content

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

Closed
RileyXX wants to merge 1 commit into
blacktwin:masterfrom
RileyXX:master
Closed

Add new Plex python script to change subtitle settings for all movies and shows in library to "prefer non-forced subtitles"#369
RileyXX wants to merge 1 commit into
blacktwin:masterfrom
RileyXX:master

Conversation

@RileyXX

@RileyXX RileyXX commented Jan 8, 2023

Copy link
Copy Markdown

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:

  • Forced subs without the "forced" tag will be treated as non forced subs. This could be fixed in the script by checking the subtitle "title" tag for some variation of the word "forced".
  • Python-PlexAPI has a method to set the default subtitle stream. No need to manually call the API using requests.
  • Several lines of redundant code can be shorted and/or removed
  • Plans to print out neat colored data tables when the script runs

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

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.
@RileyXX RileyXX changed the title Add files via upload Add new Plex python script to change subtitle settings for all movies and shows in library to "prefer non-forced subtitles" Jan 8, 2023
Comment thread utility/PlexPreferNonForcedSubs.py
Comment thread utility/PlexPreferNonForcedSubs.py
Comment thread utility/PlexPreferNonForcedSubs.py
Comment thread utility/PlexPreferNonForcedSubs.py
@blacktwin

Copy link
Copy Markdown
Owner

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.

Comment thread utility/PlexPreferNonForcedSubs.py
Comment thread utility/PlexPreferNonForcedSubs.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants