From 981a2ce4fe65090b47f685b1da7dc614b5c8b8f2 Mon Sep 17 00:00:00 2001 From: Abzie Date: Sun, 5 Feb 2017 00:00:14 +0000 Subject: [PATCH] Added reverse symlinking --- Custom-Post-Processing-Scripts.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Custom-Post-Processing-Scripts.md b/Custom-Post-Processing-Scripts.md index 7bac74b..edf6d3b 100644 --- a/Custom-Post-Processing-Scripts.md +++ b/Custom-Post-Processing-Scripts.md @@ -52,4 +52,33 @@ Radarr can execute a custom script when new episodes are imported or a series is #### PHP #### The information from Radarr will not be added to $_ENV as one might expect but should be included in the [$_SERVER variable](https://secure.php.net/manual/en/reserved.variables.server.php). A sample script to use this information to convert a file can be found [here](https://gist.github.com/karbowiak/7fb38d346e368edc9d1a). #### PowerShell #### -Sample script using the Radarr environment variables to create EDL files for all episodes is [here](https://gist.github.com/RedsGT/e1b5f28e7b5b81e1e45378151e73ba5c). \ No newline at end of file +Sample script using the Radarr environment variables to create EDL files for all episodes is [here](https://gist.github.com/RedsGT/e1b5f28e7b5b81e1e45378151e73ba5c). +#### Reverse Symlinking #### +When using private trackers, it is imperitive to continue seeding. By using this script `on Download` and `on Upgrade` moves the media to your root movie folder as set in Radarr, and will create a symlink in the original download location so you can continue to seed. + +Symlinking is preferable over hardlinking in most cases as the root movie folder can be on a seperate drive or nfs mount, where hardlinks are impossible. +```sh +#!/bin/bash + +PERMPATH="$radarr_moviefile_path" +LINKPATH="$radarr_moviefile_sourcepath" +if [ -f "$LINKPATH" ]; +then + sleep 1 +else + exit 1 +fi +ORIGFILESIZE=$(stat -c%s "$LINKPATH") +PERMFILESIZE=$(stat -c%s "$PERMPATH") +#env > /opt/radarr/Logs/env.log +sleep 30 +while [ $PERMFILESIZE != $ORIGFILESIZE ] +do + sleep 60 + PERMFILESIZE=$(stat -c%s "$PERMPATH") +done +if [ $PERMFILESIZE == $ORIGFILESIZE ] +then + rm "$LINKPATH" + ln -s "$PERMPATH" "$LINKPATH" +fi``` \ No newline at end of file