Skip to main content

Run configurable fixups against the media database of a Plex Media Server

Project description

Version on Pypi Travis test status (master)

Overview

The PlexMediaFixup project provides a command named plexmediafixup that performs certain changes in the media database of a Plex Media Server.

The functionality to perform these changes is organized in plugins called fixups. Each fixup can be enabled or disabled and configured as needed.

Currently supported fixups are:

  • sync_title:

    This fixup walks through the movie and episode items of the configured library sections of the Plex Media Server, and syncs the “title” field of each item by setting it to the value of the title tag found in the corresponding media files. The ffprobe command is used to get the title tag from the media files.

    Use this fixup if you properly maintain the title tags in your media files and are not happy with the titles that get set from the metadata sites.

  • sync_sort_title:

    This fixup walks through the movie, show and episode items of the configured library sections of the Plex Media Server, and syncs the “sort title” field of each item by setting it to the value of its “title” field.

    Use this fixup if you are not happy with the fact that PMS removes leading articles and other words from the sort title.

Look at the example plexmediafixup config file example_config_file.yml if you want to see what can be configured. It describes each parameter.

This project uses the python-PlexAPI package, and access to the Plex Media Server is specified in the PlexAPI config file. The plexmediafixup command supports a choice of using a direct connection to a network-accessible Plex Media Server (which is the faster choice) or using an indirect connection through the Plex web site (which works from anywhere but is slower).

Installation and configuration

  1. Install the latest released version of the plexmediafixup Python package into your active Python environment:

    $ pip install plexmediafixup
    

    This will also install any prerequisite Python packages, including the python-PlexAPI package.

  2. If this is the first time you use the python-PlexAPI package, create its PlexAPI config file as follows.

    If you want to use direct connections to a network-accessible Plex Media Server, specify the following parameters:

    [auth]
    server_baseurl = <URL of your PMS>
    server_token = <server auth token of your PMS>
    

    The server auth token of your PMS can be found as described in Finding your server auth token.

    If you want to use indirect connections through the Plex web site, specify the following parameters. This is simpler to set up compared to direct connections, but every request goes through the Plex web site and from there to your Plex Media Server:

    [auth]
    myplex_username = <your plex account username/email>
    myplex_password = <your plex account password>
    

    The PlexAPI environment variables can also be used.

  3. Create a plexmediafixup config file.

    A plexmediafixup config file is in YAML format and specifies some general parameters (such as whether to use direct or indirect connections, or the location of the PlexAPI config file) and the fixups that should be run, including any parameters for the fixups.

    An example plexmediafixup config file is provided as example_config_file.yml. This example config file contains descriptions for all parameters, and describes all supported fixups.

    Create your plexmediafixup config file by copying that example file and modifying it as needed.

    The copy of the example file should work without further modifications. By default, it uses a direct connection and has all fixups enabled and configured to process all items. However, please review your copy carefully and make changes as needed.

  4. Install the ffprobe command

    This command is only used by the sync_title fixup.

    On Windows with Chocolatey, on MacOS with HomeBrew, and on most Linux distros, the package containing this command is named ffmpeg. Alternatively, download it from https://ffmpeg.org/download.html.

Usage

To explore the command line options and general usage of the plexmediafixup command, invoke:

$ plexmediafixup --help

The following commands assume that my_config_file.yml is the plexmediafixup config file you have created.

First, invoke the plexmediafixup command in dry-run mode. This shows you what would be changed in a real run without actually doing any changes:

$ plexmediafixup my_config_file.yml --verbose --dryrun

If you are satisfied with what you see, perform the changes:

$ plexmediafixup my_config_file.yml --verbose

Bugs and features

Please report any bugs and request features via the issue tracker.

Contributing

Contributions to the PlexMediaFixup project are welcome; for details see Development.

License

The PlexMediaFixup project is provided under the Apache Software License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for plexmediafixup, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size plexmediafixup-0.2.0-py2.py3-none-any.whl (13.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size plexmediafixup-0.2.0.tar.gz (12.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page