Skip to content

fischy667/torrentcleaner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

TorrentCleaner

TorrentCleaner is a Python script that automates the process of identifying and removing torrents that contain suspicious files (like .zipx or .lnk) from your qBittorrent download client. This ensures that unwanted or potentially harmful files are filtered out and deleted during the download process, keeping your system clean.

Features

  • Fetches the list of torrents from Sonarr's queue.
  • Identifies torrents managed by qBittorrent.
  • Inspects torrent contents to find suspicious file extensions (.zipx or .lnk).
  • Automatically removes torrents containing suspicious files.
  • Deletes associated files on disk using qBittorrent's API.

Requirements

  • Sonarr API key and URL
  • qBittorrent URL and credentials (if required)
  • Python 3.x
  • Python packages:
    • requests
    • python-qbittorrent

Installation

  1. Clone the repository:

    git clone https://github.com/fischy667/torrentcleaner.git
    cd TorrentCleaner
  2. Install the required dependencies:

    pip install requests python-qbittorrent
  3. Set up your environment variables (or hardcode the values in the script):

    • Sonarr API key
    • qBittorrent username and password (if authentication is required)
    • Hostnames and ports for Sonarr and qBittorrent
    sonarr_host = 'XXXX'  # Update with your actual Sonarr host (e.g., 'localhost', '192.168.1.10', etc.)
    sonarr_port = '8989'  # Update with the actual port where Sonarr is running
    sonarr_url = f'http://{sonarr_host}:{sonarr_port}/api/v3/queue'
    sonarr_api_key = 'XXXX'  # Replace with your actual Sonarr API key
    
    qbit_url = 'http://xxxx:8080'  # Replace with your qBittorrent host and port
    qbit_password_needed = False # Is password needed? e.g. bypass localhost, ...
    qbit_username = 'username'  # If qBittorrent has authentication
    qbit_password = 'password'

Usage

Once configured, you can run the script to automatically check for torrents with .zipx or .lnk files and remove them from qBittorrent.

  1. Run the script:

    python sonarr_queue_clearner.py
  2. The script will:

    • Fetch all torrents from Sonarr's queue.
    • Inspect the files in each torrent.
    • If any .zipx or .lnk files are found, the torrent will be removed and the files deleted.

Example Output

Checking torrent contents for: TVShow.S02E08
Identified suspicious file: TVShow.S02E08/TVShow.S02E08.zipx. Marking download for removal...
Successfully removed download XXXX from Sonarr's queue.

Customization

You can modify the file types that trigger removal by editing the filename.endswith() checks in the script:

if filename.endswith('.zipx') or filename.endswith('.lnk'):

Contributing

Feel free to contribute by submitting a pull request or opening an issue. All contributions and suggestions are welcome.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%