-
-
Save BinsonBuzz/8e84015747fce4eccbc48b35492707d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Make sure we're working on torrents. | |
if ! [[ "${radarr_moviefile_sourcepath}" =~ torrents ]]; then | |
echo "[Torrent Symlink] Path ${radarr_moviefile_sourcepath} does not contain \"torrents\", exiting." | |
exit | |
fi | |
# Make sure destination path is media not rclone upload | |
if ! [[ "${radarr_moviefile_path}" =~ media ]]; then | |
echo "[Torrent Symlink] Path ${radarr_moviefile_path} does not contain \"media\", exiting." | |
exit | |
fi | |
# If the source file doesn't exist, error out. | |
if ! [[ -f "${radarr_moviefile_sourcepath}" ]]; then | |
echo "[Torrent Symlink] File ${radarr_moviefile_sourcepath} does not exist, exiting." | |
exit 1 | |
fi | |
sleep 1 | |
# Make sure the copy is done by comparing source and destination file sizes. | |
ORIGFILESIZE=$(stat -c%s "${radarr_moviefile_sourcepath}") | |
PERMFILESIZE=$(stat -c%s "${radarr_moviefile_path}") | |
sleep 30 | |
while [[ $PERMFILESIZE != $ORIGFILESIZE ]]; do | |
sleep 60 | |
PERMFILESIZE=$(stat -c%s "$PERMPATH") | |
done | |
# Make the actual symlink. | |
if [[ $PERMFILESIZE == $ORIGFILESIZE ]]; then | |
rm "$LINKPATH" | |
ln -s "$PERMPATH" "$LINKPATH" | |
fi | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
merged with https://github.com/Radarr/Radarr/wiki/Custom-Post-Processing-Scripts and added dest folder check