Skip to content

Organizing Your Torrents Made Easy

Ben Adrian Sarmiento edited this page Nov 3, 2024 · 2 revisions

Managing a large collection of torrents can feel like trying to organize a messy closet. Just as you’d sort clothes by type or season, you can organize your torrents into specific folders using directory configurations. This document will guide you to set up an efficient media collection.

Understanding Directory Configuration

Think of directory configuration as setting up labeled bins in your closet. Each bin (directory) holds specific types of items (torrents) based on rules you define. These rules ensure that every torrent finds its rightful place automatically, keeping your collection neat and accessible.

Key Configuration Fields

Directories

Directories are like the labeled bins in your closet. Each directory name represents a specific category where related torrents will be stored.

directories:
  movies:
    ...
  music:
    ...

Group

Groups are broader categories that help organize directories into larger sections. For example, both movies and music can belong to a "Media" group, similar to having a media section in your closet.

group: media

Group Order

Group order determines the priority of directories within a group. Lower numbers mean higher priority, ensuring that torrents are sorted into the most specific bins first.

group_order: 10

Filters

Filters are the rules that decide which torrents go into which directories. They act like sorting criteria, such as size, type, or name patterns.

filters:
  - regex: /pattern/
  - size_gte: 1000000000

Additional Options

Additional options provide extra control over how torrents are organized, such as only showing the largest file in a torrent.

only_show_the_biggest_file: true

Defining Directories and Groups

Step 1: Define Your Directories

Start by listing all the categories you want to organize your torrents into. Each directory represents a specific type of torrent.

directories:
  movies:
    ...
  music:
    ...
  shows:
    ...
  anime:
    ...

Step 2: Assign Directories to Groups

Group similar directories together to keep your configuration tidy. For instance, all media-related directories can be part of the "Media" group.

movies:
  group: media

music:
  group: media

Step 3: Set the Group Order

Determine the sorting priority within each group. Directories with lower group_order values are processed first, ensuring that torrents are sorted into the most specific category available.

movies:
  group_order: 10

music:
  group_order: 20

Creating Filters

Filters are the criteria that torrents must meet to be placed in a specific directory. Think of them as the rules you set for what goes into each bin.

Types of Filters

  • Regex Filters: Match torrent or file names based on specific patterns.

    Analogy: Like recognizing shirts with a certain logo.

    - regex: /\b\d{4}\b/ # Matches a 4-digit year
  • Contains Filters: Look for specific substrings in torrent names.

    Analogy: Sorting shirts that contain the word "Sale".

    - contains: "mp3"
  • Size Constraints: Filter torrents based on their size.

    Analogy: Putting bulky winter coats in a separate bin.

    - size_gte: 5000000000 # Files larger than 5GB
  • Media Information Filters: Use metadata like resolution or bitrate.

    Analogy: Sorting clothes by fabric quality.

    - media_info_resolution: "1080p"

Combining Filters with AND/OR

Use logical operators to create complex rules.

  • AND: All conditions must be true.

    Analogy: A shirt must be both red AND have a logo.

    - and:
        - contains: "1080p"
        - size_gte: 1000000000
  • OR: At least one condition must be true.

    Analogy: A shirt can be either red OR blue.

    - or:
        - contains: "1080p"
        - contains: "720p"

Example Configurations

1. Music Directory

Organize music files by their extensions.

music:
  group_order: 5
  group: media
  filters:
    - any_file_inside_regex: /.+\.mp3$/i
    - any_file_inside_regex: /.+\.flac$/i

Explanation: Torrents containing .mp3 or .flac files go into the music directory.

2. Anime Directory

Sort anime torrents using unique naming patterns.

anime:
  group_order: 10
  group: media
  filters:
    - regex: /\b[a-fA-F0-9]{8}\b/
    - any_file_inside_regex: /\b[a-fA-F0-9]{8}\b/

Explanation: Torrents with an 8-character hexadecimal code in their name are placed in the anime directory.

3. Shows Directory

Automatically sort TV show episodes.

shows:
  group_order: 20
  group: media
  filters:
    - has_episodes: true

Explanation: Torrents detected to contain episodes (like TV shows) go into the shows directory.

4. Movies Directory

Catch-all for movie torrents, showing only the main file.

movies:
  group_order: 30
  group: media
  only_show_the_biggest_file: true
  filters:
    - regex: /.*/

Explanation: All other torrents are assigned to movies, displaying only the largest file, typically the main movie.

5. Large Files Directory

Manage storage by separating large torrents.

large_files:
  group_order: 40
  group: sizes
  filters:
    - size_gte: 5000000000 # Files larger than 5GB

Explanation: Torrents larger than 5GB are placed in the large_files directory.

Step-by-Step Tutorial

Step 1: Define Your Directory Structure

Decide how to categorize your torrents. Common categories include:

  • Media: Movies, TV Shows, Music, Anime
  • Documents: eBooks, PDFs
  • Software: Applications, Games

Step 2: Create Configuration Entries

For each category, create a directory entry in your YAML configuration.

directories:
  movies:
    group_order: 10
    group: media
    filters:
      - regex: /\b\d{4}\b/ # Matches a 4-digit year
  music:
    group_order: 20
    group: media
    filters:
      - any_file_inside_regex: /.+mp3$/i
      - any_file_inside_regex: /.+flac$/i

Step 3: Define Filters

Set up rules to specify what goes into each directory.

  • Movies: Look for torrents with a year in the name.

    - regex: /\b\d{4}\b/
  • Music: Match files ending with .mp3 or .flac.

    - any_file_inside_regex: /.+mp3$/i
    - any_file_inside_regex: /.+flac$/i

Step 4: Set Group Orders

Assign group_order values to prioritize directories.

group_order: 5 # Higher priority
group_order: 10 # Lower priority

Step 5: Test Your Configuration

Download a few torrents that match your criteria to ensure they're assigned correctly. Check the logs if torrents aren't being placed as expected.

Step 6: Refine and Expand

Based on your experience, tweak your filters or add new directories to cover additional categories.

Tips and Best Practices

  • Start Simple: Begin with broad categories and add specific rules as needed.
  • Use Descriptive Names: Clearly name your directories and groups for easy identification.
  • Test Regular Expressions: Ensure your regex patterns accurately match the intended torrent names.
  • Prioritize Carefully: Assign lower group_order values to directories with stricter criteria to avoid overlaps.
  • Avoid Overlapping Filters: Make sure each filter is distinct to prevent torrents from being assigned to multiple directories unintentionally.
  • Use Case Sensitivity Wisely: Add /i to regex patterns to make them case-insensitive when necessary.

Advanced Tips

  • Combine Logical Operators: Create complex filtering rules using and and or.

    filters:
      - and:
          - regex: /pattern1/
          - contains: "specific_word"
      - or:
          - size_gte: 1048576
          - has_episodes: true
  • Leverage Media Metadata: Filter based on resolution, bitrate, duration, or language.

    media_info_resolution: "1080p"
    media_info_bit_rate_gte: 5000000 # 5 Mbps
  • Manage File Sizes: Control storage by filtering torrents based on file sizes.

    only_show_files_with_size_lte: 2147483648 # 2GB
  • Create Custom Groups: Organize directories into broader categories beyond the default ones.

    group: entertainment

Conclusion

Organizing your torrents with directory configurations is like setting up a well-organized closet—everything has its place, making it easy to find what you need. By defining directories, assigning them to groups, and creating effective filters, you can automate the sorting process, saving time and reducing clutter. Start with simple rules, test thoroughly, and gradually incorporate more advanced configurations to tailor the system to your specific needs. Happy organizing!