فهرست منبع

Improve flow control

Zachary Kotlarek 11 سال پیش
والد
کامیت
cf9a3e17c1
1فایلهای تغییر یافته به همراه12 افزوده شده و 6 حذف شده
  1. 12 6
      findAllTorrents.sh

+ 12 - 6
findAllTorrents.sh

@@ -37,13 +37,19 @@ while read -d $'\0' SERIES ; do
 	fi
 	fi
 
 
 	# Actual search, with timeout to ensure we don't get stuck
 	# Actual search, with timeout to ensure we don't get stuck
-	~/bin/video/timeout -t 300 \
-		~/bin/video/findTorrent.pl "${SERIES}" \
-		| ~/bin/download
-
-	# Print the series name on error
+	URLS="`~/bin/video/timeout -t 300 ~/bin/video/findTorrent.pl "${SERIES}"`"
 	if [ $? -ne 0 ]; then
 	if [ $? -ne 0 ]; then
-		echo "${SERIES}"
+		echo "Error searching: ${SERIES}"
+		continue
+	fi
+
+	# Download, if we found anything
+	if [ -n "${URLS}" ]; then
+		echo "${URLS}" | ~/bin/download
+		if [ $? -ne 0 ]; then
+			echo "Error downloading: ${SERIES}"
+			continue
+		fi
 	fi
 	fi
 
 
 # Loop on the null-delimited list of monitored series/seasons
 # Loop on the null-delimited list of monitored series/seasons