Serverboi.org
Home DiscordTorrentManager - Torrent stuff with your friends
Post
Cancel

DiscordTorrentManager - Torrent stuff with your friends

DiscordTorrentManager is a Torrent seeker and manager that you can use with your friends.

The initial version of this project faced significant issues with maintainability and scope. This is the second iteration and aims to have a clearer scope and improved testability so it can be easily maintained and improved.

This program consists of a bot scirpt and a search wrapper. these two parts work together to find torrents and add magnets to qbittorrent.

Installation

  1. Clone the repository:

    1
    2
    
     git clone https://github.com/JakeTurner616/DiscordTorrentManager
     cd DiscordTorrentManager
    
  2. Create a virtual environment:

    1
    
     python -m venv venv
    
  3. Activate the virtual environment:

    • On Windows:

      1
      
        venv\Scripts\activate
      
    • On MacOS and Linux:

      1
      
        source venv/bin/activate
      
  4. Install the required packages:

    1
    
     pip install -r requirements.txt
    
  5. Run the bot:

    1
    
     python bot.py
    

    If you run into this error: ImportError: cannot import name 'Option' from 'discord', just run these commands:

    1
    2
    3
    4
    5
    
     pip uninstall discord -y
     pip uninstall py-cord -y
     pip install discord
     pip install py-cord
     pip uninstall discord -y
    

qBittorrent Setup

  1. Open qBittorrent and go to Tools -> Options.

  2. Navigate to the Web UI section under the Web UI tab.

  3. Check the Enable the Web User Interface (Remote control) box.

  4. Set a network interface to bind the webui in the IP Address text box.

  5. Set a username and password for the Web UI.

  6. Create torrent categories in qBittorrent to associate the downloaded content with the folders they should be saved to (for example: movies > Z://some/location/movies, tv > Z://some/location/tv). These are to be used with /magnet <magnet_link> <category> The category save paths could be set somwhere that has access to a media player like plex, jellyfin, or anything really.

Discord Bot Setup

  1. Go to the Discord Developer Portal and create a new bot application.

  2. Create and copy the bot token.

  3. Invite the bot to your server using the OAuth2 URL Generator under the OAuth2 tab. Make sure to give the bot the necessary permissions for slash commands, reactions, and text.

Configuration

Edit the config.ini file to include your specific environment settings for connecting to your discord bot and qBittorrent instance:

1
2
3
4
5
6
7
8
9
10
11
12
[Bot]
# change to your bot token
token = YOUR_DISCORD_BOT_TOKEN
# change to your server id
guild_id = YOUR_DISCORD_GUILD_ID

[qbit]
# change to your qBittorrent host and port:  http://host_ip:port 
host = http://10.0.0.123:8080
# qBittorrent WebUI login credentials
user = YOUR_QBITTORRENT_USERNAME
pass = YOUR_QBITTORRENT_PASSWORD

The bot can then be started by running the bot.py script.

Command Usage

Here are the commands included with the DiscordTorrentManager bot:

  • Add a Magnet Link:
    1
    
      /magnet <magnet> <category>
    

    This command adds a new torrent to qBittorrent using the provided magnet link and associates it with the specified category.

  • Search for Torrents:
    1
    
      /search <title>
    

    This command searches for torrents based on the provided title. The bot will list the results, and the user can select a result to automatically download it to the ‘movie’ category. Assumes the ‘movie’ category exists.


Edit this page’s markdown on github.


This post is licensed under GNU GPL-3.0 .
Contents