Skip to content
Zhaoyu Gan edited this page May 25, 2018 · 15 revisions

Auto Remove Torrents Wiki

Catalog

How to make a configuration file

The script uses the YAML language as the language of the configuration file. The YAML language has a clear structure, so I think it's more friendly than the JSON and easy to learn.

Look at the example please, the task block can be divided into 3 parts.

# A task block
my_task:                       # Part 1: Task Name
  # Part 2: Login Information
  client: qbittorrent
  host: http://127.0.0.1:9091
  username: admin
  password: adminadmin
  # Part 3: Strategies Block (Remove Conditions)
  strategies:
    strategy1:    # Part I: Strategy Name
      # Part II: Filters
      categories:
        - IPT
      # Part III: Remove Condition
      ratio: 1
      seeding_time: 1209600
    strategy2:
      all_categories: true
      excluded_categories:
        - IPT
      seeding_time: 259200
    # Add more strategies here...
  # Part 4: Decide whether to remove and delete data (optional)
  delete_data: true

# Add more tasks here...

Centainly, the configuration file can contain more than one task blocks, and a task block can contain more than one strategy blocks. Each task block represents a BT client, and each strategy block represents a kind of torrents.

Part 1: Task Name

Just name your task. Note that there can be no space on the left.

Part 2: Login Information

This script works with your client's WebUI, and this part is your login inforamtion.

  • client: Your client name. Now it supports qbittorrent/transmission/μTorrent.
  • host: The URL of your client's WebUI, and the URL must have a socket (http:// or https://).
  • username: The username of the WebUI.
  • password: The password of the WebUI.

Part 3: Strategy Block

This part contains strategy blocks. Each strategy block can be divided into 3 parts, too.

Part I: Strategy Name

Just name your strategy like the task name.

Part II: Filters

This strategy is available only for the torrents you chosen. There are 6 filters available.

  • all_trackers/all_categories: Choose all the trackers/categories.
  • categories: Choose those torrents whose category is in the list.
  • excluded_categories: Don't choose these torrents whose category is in the list.
  • trackers: Choose those torrents whose tracker is in the list.
  • excluded_trackers: Don't choose these torrents whose tracker is in the list.

The result of each filter is a set of torrents. Note that if the categories and the trackers filter are both specificed, the script will take the intersection of the two sets, and subtracts set excluded_categories and set excluded_trackers.

Part III: Remove Condition

There are 4 remove conditions. Note that as long as a chosen torrent satisfies one of these conditions, it will be removed.

  • ratio: Maximum ratio.
  • create_time: The maximum time elapsed since the torrent was added to the client, in seconds. When a torrent reaches the limit, it will be removed (no matter what state it is).
  • seeding_time: Maximum seeding time of a torrent.
  • seed_size: Calculate the total size of the torrents you chosen. If the total size exceeds the limit, some of the torrents will be removed. The following two properties must be specificed.
    • limit: Limit of the total size, in GiB.

    • action: Determine which torrents will be removed. Can be the following values:

      Value Description
      remove-old-seeds Try to remove old seeds.
      remove-new-seeds Try to remove new seeds.
      remove-big-seeds Try to remove large seeds.
      remove-small-seeds Try to remove small seeds.

Part 4: Delete data

Determine whether to delete data at the same time. If this field isn't specificed, the default value is false.

The Last Step...

Remember to check your configuration file and make sure it works as you think. Use the following command line to see the torrents that will be removed (but not really remove them).

    python3 main.py --view

Uninstall

If your autoremove-torrents was installed via pip, you can simply uninstall it using:

    pip uninstall autoremove-torrents

However, if it was installed by setup.py, you need to remove all the files manually.

Step1

    cd autoremove-torrents

Step2

Reinstall the program and record a list of installed files:

    python3 setup.py install --record files.txt

Step3

Use xargs to remove each file:

    cat files.txt | xargs rm -rf

Or if you're running Windows, use Powershell::

    Get-Content files.txt | ForEach-Object {Remove-Item $_ -Recurse -Force}

Reference: https://stackoverflow.com/questions/1550226/python-setup-py-uninstall

Clone this wiki locally