PlexSorter is a Python script that organizes messy media folders into a Plex-compatible folder structure. It can automatically identify movies and TV shows, rename files, and place them in structured folders, making it easy to integrate with Plex Media Server.
- Detects and organizes TV shows and movies based on file names.
- Creates Plex-compatible folder structures:
- Movies:
Movies/<Movie Title> (<Year>)
- TV Shows:
TV Shows/<Show Name>/Season xx/<Show Name> - SxxEyy - <Episode Title>.ext
- Movies:
- Uses OpenAI to intelligently suggest file names and structures.
git clone https://github.com/robzilla1738/plexsorter.git
cd plexsorter
pip install -r requirements.txt
Create a .env file in the project directory and add your OpenAI API key:
echo "OPENAI_API_KEY=your_openai_api_key_here" > .env
- Open the plexsorter.py file.
- Update the source_directories and destination_root variables with the paths to your source and destination folders:
source_directories = ["path/to/source1", "path/to/source2"]
destination_root = "path/to/destination"
- Run the script:
python3 plexsorter.py
The script will scan your source directories, identify media files, and organize them into the destination directory.
Python 3.7 or higher OpenAI API Key
python-dotenv: For managing environment variables. openai: To interact with OpenAI's GPT API.
Contributions are welcome! Feel free to fork this repository, create a feature branch, and submit a pull request.