# Auto Remove Torrents

This unofficial app installation script is provided for your convenience. The script is provided as-is and may not be updated or maintained by Ultra.cc. Clients are welcome to use and customize unofficial app installers for their unique needs and requirements. Unofficial support may be offered via Discord only and at the sole discretion of Ultra.cc staff. Use at your own risk and only proceed if you are comfortable managing the application on your own.

Autoremove Torrents is an open-source Python project that allows the automatic removal of torrents from various torrent clients based on configurable criteria. It can help manage disk space by deleting torrents when they are finished seeding. [Here's](https://github.com/jerrymakesjelly/autoremove-torrents) the GitHub page of the project. ## Features - Remove torrents automatically based on ratio, seeding time, inactivity and more - Monitor disk space and remove torrents if space runs low - Remove oldest, biggest, smallest torrents first - Support for all major torrent clients - Dry run mode to test without removing - Schedule via crontab for hands-off automation ## Supported Clients Autoremove Torrents works with the following torrent clients: - [qBittorrent](https://docs.ultra.cc/books/qbittorrent) - [Transmission](https://docs.ultra.cc/books/transmission) - [Deluge](https://docs.ultra.cc/books/deluge) - It supports connecting to the web UI for qBittorrent and Transmission. - For Deluge, it connects directly to the daemon via the RPC protocol. ## Installation - Connect to your Ultra.cc service via [SSH](https://docs.ultra.cc/books/secure-shell-%28ssh%29/page/how-to-connect-to-your-ultracc-slot-via-ssh) - Execute the following command: ```sh bash <(wget -qO- https://scripts.ultra.cc/main-v2/AutoRemove-Torrents/main.sh) ``` - Type `1` and press `ENTER` to proceed with the installation. - Done! ## Configuration Autoremove Torrents uses a YAML configuration file to define the torrent clients and removal rules. By default, Autoremove Torrents will look for a configuration file in the shell's current working directory. But, you can store the configuration file somewhere else and point to it while using Autoremove Torrents. See the below [usage instructions](https://docs.ultra.cc/link/403#bkmrk-usage) for more information. ### Client Configuration The script will create a bare minimum configuration file located at `~/.config/autoremove-torrents/config.yml`. You will need to edit the configuration file with your login credentials and removal task/strategies. - Open the configuration file with the editor by executing the following command. ```sh nano ~/.config/autoremove-torrents/config.yml ``` - Find `username` and `password` and replace with the login credentials of your torrent client. - Login credentials can be found on the **Apps** tab of the [UCP](https://cp.ultra.cc). - Make any other changes specific to your setup, such as removal task/strategies. Documentation can be found [here](https://autoremove-torrents.readthedocs.io/en/latest/). - Exit the editor with `ctrl+x` and `y`, press `ENTER` to confirm. - You can test your configuration with a preview dry-run. To do so, execute the following command. - Make sure to replace `username` with your specific Ultra service username. ```sh autoremove-torrents --conf=/home/username/.config/autoremove-torrents/config.yml --view ``` ### Removal Strategies Next, define removal strategies under each client. For example: ``` strategies: delete_seeds: remove: ratio > 2 clear_space: free_space: min: 10 path: /downloads action: remove-big-seeds ``` * You can customize removal rules based on ratio, seed time, activity, disk space and more. See the [full documentation](https://autoremove-torrents.readthedocs.io/en/latest/) for details on all available options. * Strategies will only apply to the client they are defined under. You can create multiple strategies per client. ## Usage * Specify a custom config path: ``` autoremove-torrents --conf=/path/to/config.yml ``` * Single Task: ``` autoremove-torrents --conf=/path/to/config.yml --task transmission ``` * Dry run: ``` autoremove-torrents --view --conf=/path/to/config.yml --task transmission ``` Dry run allows you to see what would be deleted without actually removing anything. ## Automation * Open Crontab using `crontab -e`. * Select `1` for the nano editor. * You can setup a cron job or scheduled task to run autoremove-torrents automatically. For example: ``` # Run at 2AM every day 0 2 * * * /home/username/.pyenv/shims/autoremove-torrents --conf=/path/to/config.yml ``` * Save the crontab file using `ctrl + o` & exit using `ctrl + x`. * A simple and quick resource for cron schedule expressions: [Crontab Guru](https://crontab.guru/) ## Uninstallation - Connect to your Ultra.cc service via [SSH](https://docs.ultra.cc/books/secure-shell-%28ssh%29/page/how-to-connect-to-your-ultracc-slot-via-ssh) - Execute the following command: ```sh bash <(wget -qO- https://scripts.ultra.cc/main-v2/AutoRemove-Torrents/main.sh) ``` - Type `2` and press `ENTER` to proceed with the uninstallation.