# plexcleaner **Repository Path**: mirrors_nap/plexcleaner ## Basic Information - **Project Name**: plexcleaner - **Description**: PlexCleaner will read the Plex Media Server database and generate a library with the metadata of matched media. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-25 - **Last Updated**: 2025-09-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README plexcleaner =========== .. image:: https://travis-ci.org/nap/plexcleaner.svg?branch=master :target: https://travis-ci.org/nap/plexcleaner .. image:: https://coveralls.io/repos/nap/plexcleaner/badge.svg?branch=master&service=github :target: https://coveralls.io/github/nap/plexcleaner?branch=master **Require python >= 2.7** This application will read the content of a Plex Media Server database and will generate a new library, composed of the same files, with suggested directory, filename, and jaket for each media. The application use the metadata generated by matching movies with agent in the Plex Media Server. This application rely on a working ``sqlite3`` database found in the Plex Media Server directory tree to fetch information about files contained in the media library folder. If a file has default value as metadata, the application will assume that the media file was not correctly matched by Plex. Therefore, the application will not process that particular file. Note ---- Plex Database is usually set with ``rw-r--r--`` permissions and has group and owner set with ``plex`` user. You can run this script as the ``plex`` user or as ``root`` but you will need to ``chmod`` the database file and the containing folder with ``777`` otherwise. **DO NOT** run this script with a Plex Database that is out of sync with the content of the media library. Limitation ---------- This application does not support **TV Shows** or Movies with **multiple files**. Those files will be filtered out of the data retrieval. No processing wil be done on them. Requirement ----------- Plex create databases using ``SQLite 3.7+``, you will need to have installed on your PMS host the proper version or have an alternate version of ``SQLite3`` installed. You can then run ``plexcleaner`` loading the specific SQLite library. On CentOS, they're located in the local lib folder: ``LD_LIBRARY_PATH=/usr/local/lib``. To execute as plex with the proper library after installing an updated version of ``SQLite``, run the following command. :: su -s /bin/bash -l plex -c "LD_LIBRARY_PATH=/usr/local/lib python27 plexcleaner/cleaner.py" Help ---- :: $ python plexcleaner/cleaner.py --help Usage: cleaner.py [OPTIONS] Options: --plex-home PATH Installation location of the Plex Media Server. [default: /var/lib/plexmediaserver] --export PATH Move the updated library format in a new folder. --update / --no-update Update Plex database with renamed and moved media. --jacket TEXT Name that each movie jacket will have. [default: poster.jpg] --no-skip-jacket Should the copy of movie jacket be skipped if it's already present. --interrupt Interrupt the whole process if a movie file is not found on the filesystem. --log-level [error|debug|info|critical|warning] Application verbosity, default is INFO --database-override PATH Override the expected Plex Database location. --help Show this message and exit. Suggested Media Library Format ------------------------------ :: . $NEW_LIBRARY/Movies |- /Avatar (2009) | |- Avatar (2009).mkv | `- poster.jpg | `- /Batman Begins (2005) |- Batman Begins (2005).mp4 |- Batman Begins (2005).eng.srt `- poster.jpg :Version: 0.1 of 2015-09-19