/tqm

CLI application to manage torrent client queues and remove torrents that meet a specific criteria

Primary LanguageGoGNU General Public License v3.0GPL-3.0

made-with-golang License: GPL v3 Discord Contributing Donate

tqm

CLI tool to manage your torrent client queues. Primary focus is on removing torrents that meet specific criteria.

Example Configuration

clients:
  deluge:
    enabled: true
    filter: default
    download_path: /mnt/local/downloads/torrents/deluge
    free_space_path: /mnt/local/downloads/torrents/deluge
    download_path_mapping:
      /downloads/torrents/deluge: /mnt/local/downloads/torrents/deluge
    host: localhost
    login: localclient
    password: password-from-/opt/deluge/auth
    port: 58846
    type: deluge
    v2: true
  qbt:
    download_path: /mnt/local/downloads/torrents/qbittorrent/completed
    download_path_mapping:
      /downloads/torrents/qbittorrent/completed: /mnt/local/downloads/torrents/qbittorrent/completed
    enabled: true
    filter: default
    type: qbittorrent
    url: https://qbittorrent.domain.com/
    user: user
    password: password
filters:
  default:
    ignore:
      # general
      - TrackerStatus contains "Tracker is down"
      - Downloaded == false && !IsUnregistered()
      - SeedingHours < 26 && !IsUnregistered()
      # permaseed / un-sorted (unless torrent has been deleted)
      - Label startsWith "permaseed-" && !IsUnregistered()
    remove:
      # general
      - IsUnregistered()
      # imported
      - Label in ["sonarr-imported", "radarr-imported", "lidarr-imported"] && (Ratio > 4.0 || SeedingDays >= 15.0)
      # ipt
      - Label in ["autoremove-ipt"] && (Ratio > 3.0 || SeedingDays >= 15.0)
      # hdt
      - Label in ["autoremove-hdt"] && (Ratio > 3.0 || SeedingDays >= 15.0)
      # bhd
      - Label in ["autoremove-bhd"] && (Ratio > 3.0 || SeedingDays >= 15.0)
      # ptp
      - Label in ["autoremove-ptp"] && (Ratio > 3.0 || SeedingDays >= 15.0)
      # btn
      - Label in ["autoremove-btn"] && (Ratio > 3.0 || SeedingDays >= 15.0)
      # hdb
      - Label in ["autoremove-hdb"] && (Ratio > 3.0 || SeedingDays >= 15.0)
    label:
      # btn 1080p season packs to permaseed (all must evaluate to true)
      - name: permaseed-btn
        update:
          - Label == "sonarr-imported"
          - TrackerName == "landof.tv"
          - Name contains "1080p"
          - len(Files) >= 3

      # cleanup btn season packs to autoremove-btn (all must evaluate to true)
      - name: autoremove-btn
        update:
          - Label == "sonarr-imported"
          - TrackerName == "landof.tv"
          - not (Name contains "1080p")
          - len(Files) >= 3

Optional - Tracker Configuration

trackers:
  bhd:
    api_key: your-api-key
  ptp:
    api_user: your-api-user
    api_key: your-api-key

Allows tqm to validate if a torrent was removed from the tracker using the tracker's own API.

Currently implements:

  • Beyond-HD
  • PTP

Supported Clients

  • Deluge
  • qBittorrent

Example Commands

  1. Clean - Retrieve torrent client queue and remove torrents matching its configured filters

tqm clean qbt --dry-run

tqm clean qbt

  1. Relabel - Retrieve torrent client queue and relabel torrents matching its configured filters

tqm relabel qbt --dry-run

tqm relabel qbt

  1. Orphan - Retrieve torrent client queue and local files/folders in download_path, remove orphan files/folders

tqm orphan qbt --dry-run

tqm orphan qbt


Notes

FreeSpaceSet and FreeSpaceGB() are currently only supported for the following clients (when free_space_path is set):

  • Deluge
  • qBittorrent

FreeSpaceGB() will only increase as torrents are hard-removed.

This only works with one disk referenced by free_space_path and will not account for torrents being on different disks.

Donate

If you find this project helpful, feel free to make a small donation to the developer: