Хотел бы поделиться скриптом, который следит за новостями в direct-download RSS ленте трэккера и автоматически закачивает интересующие .torrent файлы в указанную папку для последующей обработки, например, transmission'ом.
Это мой ~первый shell-script, и пост этот с целю получить поучительные комментарии 
Идея такая: берем stdout от rsstail, пропускаем через grep'ы и закачиваем понравившиеся wget'ом.
Примечание: Из ленты, на которую подписан я, при параметрах "rsstail -N -l" в stdout для каждого torrenta выдаются 2 стоки:
<Torrent1 title> 
<Torrent1 link>
<Torrent2 title>
<Torrent2 link>
...
Вызов:
	Code:
	rsstail -N -l -u http://tracker.dom/rssdl.php | /opt/etc/direct-downloader/direct-downloader.sh
 
	Code:
	#!/bin/sh
#
# direct-downloader.sh
#
Apply_Watchlist()
{
	# line by line thru watchlist
	watchlist_lengh=`wc -l "$watchlist" | cut -c1-8`
	watchlist_length=`expr $watchlist_lengh + 0`
	i=1
	while [ "$i" -le "$watchlist_length" ]
	do
		matcher=`head -n $i "$watchlist" | tail -n -1`
		cmd="echo \"${torrentName}\" | ${matcher}"
		matched=`eval $cmd`
		[ -n "$matched" ] && return
		i=`expr $i + 1`
	done
	echo Not interested in $torrentName >> $logfile
	torrentName=""
}
Exclude_Taken()
{
    found=`grep "${torrentName}" $taken`
    if [ -n "$found" ]; then
		torrentName=""
    fi
}
######
taken="/opt/etc/direct-downloader/taken"
watchlist="/opt/etc/direct-downloader/watchlist"
downloadTo="/tmp/harddisk/torrent/source/"
logfile="/opt/var/log/direct-downloader.log"
touch "$taken"
touch "$watchlist"
while read feedLine
do
    feedLink=`echo "$feedLine" | grep "^http:"`
    if [ -z "$feedLink" ]; then
	torrentName="$feedLine"
	Exclude_Taken
	if [ -n "$torrentName" ]; then
	    Apply_Watchlist
	fi
    elif [ -n "$torrentName" ]; then
    	echo "Retrieving: ${torrentName}.torrent" >> $logfile
	wget -b -O "${downloadTo}${torrentName}.torrent" "$feedLink" 2>&1 >> $logfile
	echo $torrentName >> $taken
    fi
done
 watchlist:
	Code:
	grep "Prison\.Break\.S03" | grep -v "720p"
grep "Stargate\.Atlantis" | grep "HDTV" | grep -v "720p"
 Andris