I run a pretty big PLEX library at home and it is mixed with english and korean tv shows and movies. Even with the built in maintenance job and cleanup jobs I like to keep things a bit more organized so I wrote the following script to help cleanup my plex instance
The script will find the TOKEN from your
Preferences.xml once the path is set and perform the following
- Optimize the database
- Update each library
- Empty the trash
- Clean the PhotoTranscoder Cache
I run this script via cron every 6 hours
0 */6 * * * <path>/plexdo.sh
I mentioned that I have a big library with both english and korean content. While the english content is generally scrapped well without issues the korean content has issues once in a while so that you'll have to go in and fix match it. Once its done it should stay like it is right? NO! whenever Plex is updated or scrapper is changed all the metadata gets a bit messedup.
I found a project named python-plexapi and wrote a script to lock my metadata for my korean movies so that it will not update the metadata any longer.
I cloned the repo first
git clone https://github.com/pkkid/python-plexapi.git
I followed this link and updated the source https://github.com/pkkid/python-plexapi/pull/861
Installed the module
cd python-plexai; pip3 install .
I created this script. Please make sure to update your baseurl, token, and your library name. You can get your token via the script above.
I run this once a month to lock the metadata fields via cron
0 0 1 * * /opt/bin/plex-lock.py
As you can see most of the metadata is locked.
I do have a commented section on the script to unlock all the fields for the full library as well, just uncomment and run it.
Thank you for this post – do you however, know a way to unlock the fields for an individual movie?