From b62c4c3cfa6a9dd8cfc7e0a0213746ab5826d01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20K=C3=A5berg?= Date: Fri, 7 Apr 2017 22:13:07 +0200 Subject: [PATCH] Updated Common Problems (markdown) --- Common-Problems.md | 66 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/Common-Problems.md b/Common-Problems.md index f4ffad7..9dfc920 100644 --- a/Common-Problems.md +++ b/Common-Problems.md @@ -53,4 +53,68 @@ Some sites cannot be logged into automatically and require you to login manually ![Chrome cookies](http://i.imgur.com/cpm31SO.png) * Firefox -![Firefox cookies](http://i.imgur.com/lI4pNfP.png) \ No newline at end of file +![Firefox cookies](http://i.imgur.com/lI4pNfP.png) + +## Unpack Torrents +Most torrent clients doesn't come with the automatic handling of compressed archives like their usenet counterparts. To solve this one could use a set of scripts. For this example I'll use Deluge, however aslong as the torrent client can execute an script you should be fine. + +**NOTE**: This guide applies only to Linux systems. + +Beforehand you should make sure that packages **unrar** and **unzip** is installed on your system. + +To setup Deluge you'd need the execute plugin which you can enable under Settings->Plugins (look for Execute). Once enabled you'll find Execute to the left in the Categories pane. In execute add an event like so: + +![Deluge Execute plugin](http://i.imgur.com/E9YOhLv.png) + +The /config/extract script looks like this: +``` +#!/bin/bash +formats=(zip rar) +commands=([zip]="unzip -u" [rar]="unrar -r -o- e") +extraction_subdir='deluge_extracted' + +torrentid=$1 +torrentname=$2 +torrentpath=$3 + +log() +{ + logger -t deluge-extractarchives "$@" +} + +log "Torrent complete: $@" +cd "${torrentpath}" +for format in "${formats[@]}"; do + while read file; do + log "Extracting \"$file\"" + cd "$(dirname "$file")" + file=$(basename "$file") + # if extraction_subdir is not empty, extract to subdirectory + if [[ ! -z "$extraction_subdir" ]] ; then + mkdir "$extraction_subdir" + cd "$extraction_subdir" + file="../$file" + fi + ${commands[$format]} "$file" + done < <(find "$torrentpath/$torrentname" -iname "*.${format}" ) +done +``` +And can be found at the [Deluge wiki pages](http://dev.deluge-torrent.org/wiki/Plugins/Execute#Extractarchivesscript). Make sure you set execution rights on the script (chmod +x /config/extract). + +Now Radarr will via it's automatic download handling find and move/copy or link the movie to it's destination for you. However this leaves us with unnecessary files laying around in our download folder. To mitigate this we'll make Radarr execute an cleanup script once it's done importing the movie. The cleanup script only deletes the folder deluge_extracted which is created by our extract script. + +First of create our script somewhere Radarr can find it. In my example: /config/cleanup +The content of our cleanup script is +``` +#!/bin/bash + +if [ -d "$radarr_moviefile_sourcefolder" ] && [ "$(basename $radarr_moviefile_sourcefolder)" = "deluge_extracted" ] ; then + rm -rf $radarr_moviefile_sourcefolder +fi +``` +Make sure you set execution rights on the script (chmod +x /config/cleanup). + +In Radarr head over to Settings->Connect and add a new Connection->Custom Script. Add it like so: +![Custom script in Radarr](http://i.imgur.com/b7a0Est.png) + +Voila! You're now all set to automatically handle compressed releases. \ No newline at end of file