Ahoy fellow pirates! I don’t know if this is the best place to ask, but I’m having issues getting qBittorrent to automatically unrar files so that Sonarr\Radarr can import. I’m running qbittorrent-nox with the *arr stack natively on Ubuntu 22.04 LTS

I have the following in “Run external program on torrent finished”
/usr/bin/unrar x -o- -r "%F"/*.rar "%F"/
But nothing happens when a torrent completes. When I check the qBittorrent logs, there is one line with:
Running external program. Torrent: "Name of Torrent". Command: `/usr/bin/unrar x -o- -r "/path/to/torrent/directory"/*.rar "/path/to/torrent/directory"/`

If copy and paste the above code into a terminal as the qbittorrent user, it extracts the rar files as expected. Is there anything I can check to get qBittorrent to unrar files automatically?

  • technomage1@lemmy.dbzer0.comOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Ok after a bit of testing and research, I came up with this script that seems to be working
    #!usr/bin/bash

    # Define the directory where you want to start searching for rar files
    start_directory="/root/of/torrent/download/folder/"

    # Locate all rar files in subdirectories
    find "$start_directory" -type f -name "*.rar" | while read rar_file; do
    # Extract the rar file into the same directory, skip if it already exists
    unrar x -o- "$rar_file" "$(dirname "$rar_file")"
    echo "Extracted $rar_file to $(dirname "$rar_file")"
    done

    I chown’ed it to the qBittorrent user and gave it execute permissions. In qBittorrent I added the following to “Run external program on torrent finished”
    bash /path/to/script.sh