Introduction
Plex Linter is a python script that looks for various potential issues in your library, such as
- Duplicate album titles (that could suggest albums that have been incorrectly split)
- Duplicate artists (for artists that have been split)
- Tracks without titles (sometimes Plex metadata deletes track titles)
- Tracks linked to artists with Plex metadata that differ from what the MP3 tags say.
Requirements
-
Python 3.8+.
-
Required Python modules (see below).
Installation
Note: Steps below are for OSX (other operating systems will require tweaking to the steps).
-
Clone the
plex_linter
repo.git clone https://github.com/karloskalcium/plex_linter
-
Create and configure virtual environment. Make sure you have the correct version of python. Pyenv manages python versions.
-
pyenv install 3.10.6
(use version in.python-version
) -
Make sure to configure your shell's environment for pyenv following instructions in step 2 here.
-
Once this is done, start a new shell and run
pyenv version
andpython --version
in the terminal from the root directory of the project, both should read3.10.6
-
Go into the Plex Linter folder.
cd plex_linter
-
Install the required python modules.
$ make python-install $ source ENV/bin/activate
1. Generate a `config.json` file.
./plex_linter.sh
1. Fill in Plex URL and credentials at the prompt to generated a Plex Access Token (optional).
Dumping default config to: ./config.json Plex Server URL: http://localhost:32400 Plex Username: your_plex_username Plex Password: your_plex_password Please edit the default configuration before running again!
1. Configure the `config.json` file.
open config.json
# Configuration
## Sample
```json
"PLEX_LIBRARIES": [
"Music",
"Audiobooks"
],
"PLEX_SERVER": "https://plex.your-server.com",
"PLEX_TOKEN": "<your-token>"
}
Plex
Plex Libraries
-
Go to Plex and get all the names of your Plex Music Libraries you want to run the linter on
-
Under
PLEX_LIBRARIES
, type in the Plex Library Name (exactly). Note that the linter only works for music libraries currently.-
Format:
"PLEX_LIBRARIES": [ "LIBRARY_NAME_1" "LIBRARY_NAME_2" ],
-
Plex Server URL
-
Your Plex server's URL.
-
This can be any format (e.g. http://localhost:32400, https://plex.domain.ltd).
Plex Token
-
Obtain a Plex Access Token:
-
Fill in the Plex URL and Plex login credentials, at the prompt, on first run. This only occurs when there is no
config.json
present.or
-
Visit https://support.plex.tv/hc/en-us/articles/204059436-Finding-an-authentication-token-X-Plex-Token
-
-
Add the Plex Access Token to
"PLEX_TOKEN"
so that it now appears as"PLEX_TOKEN": "abcd1234",
.- Note: Make sure it is within the quotes (
"
) and there is a comma (,
) after it.
- Note: Make sure it is within the quotes (
Usage
Simply run the script/command:
./plex_linter.py
Inspiration
This project started as a fork of https://github.com/l3uddz/plex_dupefinder and used a lot of that code as a starting point.