qBittorrent configuration - shyonae/selfhosted-anime GitHub Wiki

Initial configuration

Once the container is running, log in the UI with the username and password provided in the container logs, don't forget to change them later!

  • Example output of docker logs -f qbittorrent
******** Information ********
To control qBittorrent, access the WebUI at: http://localhost:8080

The WebUI administrator username is: admin
The WebUI administrator password was not set. A temporary password is provided for this session: EQncMM8u3
You should set your own password in program preferences.
Connection to localhost (127.0.0.1) 8080 port [tcp/http-alt] succeeded!
[ls.io-init] done.

NOTE: If you can't log in the qBittorrentVPN WebUi with user: admin / password: adminadmin, follow these steps.

Your will have to apply the following configurations in the Options.

images/qbittorrent-config.png

  • When adding a torrent: ☑️ Delete .torrent files afterwards
  • ☑️ Pre-allocate disk space for all files
  • Saving management section
    • Default Torrent Management Mode: Automatic
    • When Torrent Category changed: Relocate torrent
    • When Default Save Path changed: Relocate affected torrents
    • When Category Save Path changed: Relocate affected torrents
    • Default Save Path: /storage/downloads/torrents (change it to your own)
    • ☑️ Keep incomplete torrents in: /storage/downloads/torrents/temp (change it to your own)

External hardlink script configuration

Scroll a bit down, and you will find the Run external program section, here we'll make use of a custom script created by a good friend of mine, so shoutout to Bestfast.

  • ☑️ Run external program on torrent finished: python /config/qBittorrent/hardlinks.py "%F" "%L"

The script is the following and is called hardlinks.py:

  • It basically grabs two variables "%F" "%L" in input, which for qBittorrent they are %L: Category and %F: Content path (same as root path for multifile torrent) and creates an hardlink.
from os.path import splitdrive, split as dirsplit, basename, isdir
import sys
import shlex
import subprocess
from time import sleep
path = sys.argv[1]
category = sys.argv[2]

allowed_categories = ["tv-anime", "movies-anime"]

if category not in allowed_categories:
    exit()

allowed_folders = [
    "tv-anime",
    "movies-anime"
]

# The dest_folders NEED to point to the drop folders, more on them when we talk about Shoko.

dest_folders = [
    "/storage/drop/tv-anime",    # INTERNAL CONTAINER PATH
    "/storage/drop/movies-anime" # INTERNAL CONTAINER PATH
]

drive = splitdrive(path)[0]
folder = dirsplit(path)[0].split("/")[-1]
base = basename(path)
print(folder)
for x in zip(allowed_folders, dest_folders):
    if folder in x[0]:
        print(f"this should go to: {x[1]}")
        print(f"folder: {folder}")
        command = "cp -lRf "
        command += f'"{path}" "{x[1]}"'
        subprocess.run(shlex.split(command))
        print(f"is this correct? {command}")

NOTE: This script needs to be imported in the qBittorrent volume. Also, when it runs, you can check its logs by doing docker logs -f qbittorrent (doesn't work on the qBitVPN container).

By default, it should exist in this folder /var/lib/docker/volumes/qbittorrent-volume/_data/qBittorrent (corresponds /config/qBittorrent internally), but if you want to check your volume mountpoint you can do:

docker volume inspect qbittorrent-volume # or your own volume name

######### Sample output: #########
[
    {
        ...
        "Mountpoint": "/var/lib/docker/volumes/qbittorrent-volume/_data",
        "Name": "qbittorrent-volume",
        ...
    }
]

Category configuration

You'll then need to create the two categories listed in the script:

images/qbittorrent-categories.png

images/qbittorrent-edit-category.png

IMPORTANT! When downloading manually, be sure to set the category!

NOTE: if you don't like the names "tv-anime" and "movies-anime", be sure to change EVERYTHING that mentions these two names accordingly. This goes for categories, folders, references in scripts, references in the following pages and so on.

That's it for the qBittorrent config, move to the Autobrr one.