Преглед изворни кода

This is a temporary hack. I will update the findTorrent.pl script in the near future for a more more reasonable version of this plan.

Zachary Kotlarek пре 11 година
родитељ
комит
394dcf3a96
1 измењених фајлова са 7 додато и 0 уклоњено
  1. 7 0
      download.sh

+ 7 - 0
download.sh

@@ -5,6 +5,12 @@ AGENT="Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/
 TRANS_URL="http://vera.uberzach.com:9091/transmission/rpc"
 TIMEOUT=10
 
+# Exclude URLs that match a given regex
+GREP_EXCLUDE=""
+if [ -n "${DOWNLOAD_EXCLUDE}" ]; then
+	GREP_EXCLUDE="(`head -c -1 ${DOWNLOAD_EXCLUDE} | tr $'\n' '|'`)"
+fi
+
 # Grab the input URLs
 URLS="`cat -`"
 
@@ -33,6 +39,7 @@ if echo "${URLS}" | head -n 1 | grep -Eqi '^magnet:'; then
 		SLEEP=0
 		IFS=$'\n'
 		for i in ${URLS}; do
+			if [ -n "${GREP_EXCLUDE}" ] && echo "${i}" | grep -Eq "${GREP_EXCLUDE}"; then continue; fi
 			if [ $SLEEP -gt 0 ]; then sleep $SLEEP; fi
 			SLEEP="${DELAY}"
 			RESULT="`curl --silent --max-time "${TIMEOUT}" \