Plex Persist will take the music meta data from your Plex Server (artist name, track title, album, cover art, etc.) and update the files on your hard disk with that same information.
- Python 3 and Pip installed
- User access to Plex server
You will need to install the following packages:
- Plex API
pip3 install plexapi
- Python Magic
pip3 install python-magic
- Mutagen
pip3 install mutagen
- Pillow
pip3 install pillow
- Redis
pip3 install redis
Plex Persist is a python program, executed from the plex-persist.py
file. It is strongly recommended to create backup, or LVM snapshot, of your data before executing.
Run the plex-persist.py
file with Python 3, adding positional arguments for your server name, section, username and password. Execute the command python3 plex-persist.py --help
for more information on running.
The optional --artist-filter '<name>'
flag allows running only against artists who match the given search criteria. Note that this is not a strict match, nor case sensitive. For instance both the artist 'Mac Miller' and 'Macklemore' will match the flag --artist-filter 'mac'
. Additonally, the search results are based on Plex's search algorithm and the results of identical queries are subject to change at any point. It is strongly recommended you use the --dry-run
flag when attempting to filter to make sure no additional results are pulled in.
You can optionally configure a Redis server for Plex Persist to track the files it has seen. By default, Plex Persist will attempt to connect to Redis on localhost:6379
. You can change this by specifying the --redis-server
flag. You can also configure it via Unix socket with --redis-socket
.
This enables much faster (and safer) runs, as Plex Persist will only update the information for songs that have had their metadata changed on the Plex server. Without this enabled, Plex Persist will assume all files need to be updated, even if it is actually re-writing the same metadata.
- Plex Persist cannot currently handle
.m4a
files.
Plex Persist aims at persisting the music metadata that is auto-discovered by Plex.
Plex is a very powerful, (mostly) open-source media server. One of it's most impressive functions is the ability to automatically and intelligently look up metadata for your music library, and allow the user to add or correct this data as needed. However, this data is self-contained to the Plex server itself.
Unfortunately, the Plex team has made it clear that they will not include this functionality in the server - they stick to a strict code of "don't change the data," for better or for worse. However, there are many people who wish this was not the case.
- Let Plex write the metadata to the file
- Is there a way to automatically write metadata to media files?
- Can I take Plex metadata and attach it to files?
- Any way to provide metadata outside of the Plex database?
- Saving Metadata to local files
- Is there a way to 'save' metadata I've put in myself for Home Videos that can't be fetched from the internet?
- The list goes on...and on...and on. But you get the point.
There are a number of solutions that automatically attach metadata to files. But none of these fit the needs I wanted. Most did not integrate with Plex. Some integrated with Plex, but only did metadata for MP4 files in your video library. Some did music, but were limited by only working on certain operating systems.