correct handling of spaces
This commit is contained in:
@@ -2,23 +2,25 @@
|
|||||||
# A simple script to extract a rar file inside a directory downloaded by Transmission.
|
# A simple script to extract a rar file inside a directory downloaded by Transmission.
|
||||||
# It uses environment variables passed by the transmission client to find and extract any rar files from a downloaded torrent into the folder they were found in.
|
# It uses environment variables passed by the transmission client to find and extract any rar files from a downloaded torrent into the folder they were found in.
|
||||||
# It will also try to copy *.srt/subtitle files if found.
|
# It will also try to copy *.srt/subtitle files if found.
|
||||||
|
#
|
||||||
|
# v1.1 - Added quotation marks to $TR_TORRENT_NAME to help with spaces
|
||||||
|
|
||||||
dest_folder="/media/SpockVault/Downloads/Processing/"
|
dest_folder="/media/SpockVault/Downloads/Processing/"
|
||||||
|
|
||||||
# Script starts
|
# Script starts
|
||||||
echo "Post-processing $TR_TORRENT_NAME after finished download"
|
echo "Post-processing $TR_TORRENT_NAME after finished download"
|
||||||
|
|
||||||
if [ -n "$(find /$TR_TORRENT_DIR/$TR_TORRENT_NAME -name '*.rar')" ];
|
if [ -n "$(find $TR_TORRENT_DIR/"$TR_TORRENT_NAME" -name '*.rar')" ];
|
||||||
then
|
then
|
||||||
echo "Processing *.rar $TR_TORRENT_NAME to processing-dir"
|
echo "Processing *.rar $TR_TORRENT_NAME to processing-dir"
|
||||||
touch $dest_folder/post_download_in_progress.md
|
touch $dest_folder/post_download_in_progress.md
|
||||||
find /$TR_TORRENT_DIR/$TR_TORRENT_NAME -name "*.rar" -execdir unrar e -o- "{}" $dest_folder \;
|
find $TR_TORRENT_DIR/"$TR_TORRENT_NAME" -name "*.rar" -execdir unrar e -o- "{}" $dest_folder \;
|
||||||
rm $dest_folder/post_download_in_progress.md
|
rm $dest_folder/post_download_in_progress.md
|
||||||
elif [ -n "$(find /$TR_TORRENT_DIR/$TR_TORRENT_NAME -iname '*.mkv' -or -iname '*.mp4' -or -iname '*.avi')" ]
|
elif [ -n "$(find $TR_TORRENT_DIR/"$TR_TORRENT_NAME" -iname '*.mkv' -or -iname '*.mp4' -or -iname '*.avi')" ]
|
||||||
then
|
then
|
||||||
touch $dest_folder/post_download_in_progress.md
|
touch $dest_folder/post_download_in_progress.md
|
||||||
echo "Processing video file from $TR_TORRENT_NAME to sickchill-dir"
|
echo "Processing video file from $TR_TORRENT_NAME to sickchill-dir"
|
||||||
find /$TR_TORRENT_DIR/$TR_TORRENT_NAME -iname '*.mkv' -or -iname '*.mp4' -or -iname '*.avi' -or -iname '*.srt' | grep -iv sample | xargs cp -t $dest_folder
|
find $TR_TORRENT_DIR/"$TR_TORRENT_NAME" -iname '*.mkv' -or -iname '*.mp4' -or -iname '*.avi' -or -iname '*.srt' | grep -iv sample | xargs cp -t $dest_folder
|
||||||
rm $dest_folder/post_download_in_progress.md
|
rm $dest_folder/post_download_in_progress.md
|
||||||
else
|
else
|
||||||
echo "No suitable files found, not doing anything.."
|
echo "No suitable files found, not doing anything.."
|
||||||
|
|||||||
Reference in New Issue
Block a user