#directory-structure #sorting #plex #folders #media-file

app msort

A command line application to sort media files

3 releases

new 0.1.2 Jan 16, 2025
0.1.1 Jan 15, 2025
0.1.0 Jan 15, 2025

#197 in Command line utilities

Download history 63/week @ 2025-01-10

63 downloads per month

MIT license

42KB
999 lines

msort

msort is a powerful command-line tool designed to organize your movie and TV show files into a folder structure ideal for use with Plex Media Server. It processes file metadata to ensure your media library is clean, consistent, and easy to navigate.

Features

  • Automatically detects and organizes movies and TV shows.
  • Creates a Plex-friendly folder structure:
    • Movies: Movies/<Movie Title> (<Year>)/<Movie File>
    • TV Shows: TV Shows/<Show Title>/Season <Number>/<Episode File>
  • Handles common naming conventions and formats.
  • Supports additional metadata like release year, season, and episode numbers.
  • Safe operation with a dry-run mode to preview changes.

Installation

Requirements

Rust programming language installed. Use the Rust toolchain installed.

Steps

Install the application via cargo (Rust's package manager):

cargo install msort

Usage

Basic Command

msort --input <source_file_path> --base-dir <destination_directory> --api-key

Options

  • --input (required): Path to the media file
  • --base-dir (required): Path to the directory where organized files will be saved.
  • --dry-run: Preview changes without moving any files.
  • --overwrite: Replace existing files in the destination folder.
  • --verbose: Enable detailed logging for debugging.

Examples

Organize Media Files

msort --input ~/Downloads/Media/house.s01e02.mkv --base-dir ~/MediaLibrary

Enable Verbose Logging

msort --input ~/Downloads/Media/house.s01e02.mkv --base-dir ~/MediaLibrary -vv

Folder Structure

The application creates a Plex-compatible folder structure:

Movies

Movies/
  Inception (2010)/
    Inception (2010).mp4
  The Matrix (1999)/
    The Matrix (1999).mkv

TV Shows

TV Shows/
  Breaking Bad/
    Season 01/
      Breaking Bad - S01E01 - Pilot.mp4
      Breaking Bad - S01E02 - Cat's in the Bag.mp4
    Season 02/
      Breaking Bad - S02E01 - Seven Thirty-Seven.mp4

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature-name.
  3. Commit your changes: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature-name.
  5. Open a pull request.

License

This project is licensed under the MIT License.

Acknowledgments

  • Thanks to the Plex community for guidelines on media organization.
  • Inspired by tools like FileBot.

Contact

For questions or support, open an issue on the GitHub repository.

Dependencies

~8–19MB
~263K SLoC