this post was submitted on 08 Sep 2023
2 points (100.0% liked)

Servarr - Sonarr/Radarr/Prowlarr

10 readers
1 users here now

Unofficial Lemmy Community for the Servarr suite of apps.

Lidarr, Prowlarr, Radarr, Readarr, Sonarr, and Whisparr collectively referred to as "*Arr" or "*Arrs". They are designed to automatically grab, sort, organize, and monitor your Music, Movie, E-Book, or TV Show collections for Lidarr, Radarr, Readarr, Sonarr, and Whisparr; and to manage your indexers and keep them in sync with the aforementioned apps for Prowlarr.

founded 1 year ago
MODERATORS
 

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?

top 1 comments
sorted by: hot top controversial new old
[–] technomage1@lemmy.dbzer0.com 1 points 1 year ago* (last edited 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