Last change
on this file since 273 was 201, checked in by Rick van der Zwet, 14 years ago |
Supporting the FreeBSD project by joining in on the FreeBSD torrent site
|
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Id
|
File size:
1.2 KB
|
Rev | Line | |
---|
[201] | 1 | #!/bin/sh
|
---|
| 2 | # $Id: rss-sync.sh 201 2010-10-19 14:35:36Z rick $
|
---|
| 3 | #
|
---|
| 4 | # Crude attempt to keep torrent in sync from FreeBSD RSS feed
|
---|
| 5 | # eq autofeed them into transmission. to be run from cron:
|
---|
| 6 | #
|
---|
| 7 | # 3 0 */3 * * transmission /data/transmission/rss-sync.sh
|
---|
| 8 | #
|
---|
| 9 | # Also make sure your transmission daemon is set to to auto-accept torrent
|
---|
| 10 | # files put in $TORRENTQUEUE directory
|
---|
| 11 | #
|
---|
| 12 | # Licence: BSDLike - http://rickvanderzwet.nl/LICENSE
|
---|
| 13 | # Rick van der Zwet <info@rickvanderzwet.nl>
|
---|
| 14 |
|
---|
| 15 | TORRENTLIST=/data/transmission/freebsd-rss.txt
|
---|
| 16 | TORRENTQUEUE=/data/transmission/upload
|
---|
| 17 | TORRENTQUEUE=/tmp/rrs
|
---|
| 18 |
|
---|
| 19 | # Cleanup bits
|
---|
| 20 | TMPFILE=`mktemp /tmp/$(basename $0).XXXXX`
|
---|
| 21 | trap "rm $TMPFILE; exit 1" 1 2 3 15
|
---|
| 22 | trap "rm $TMPFILE; exit 0" 0
|
---|
| 23 |
|
---|
| 24 | # More sure we can write to the permanent location
|
---|
| 25 | touch $TORRENTLIST || exit 1
|
---|
| 26 |
|
---|
| 27 | # Check for new ones
|
---|
| 28 | fetch -qo - http://torrents.freebsd.org:8080/rss.xml | awk -F\" '/type="application\/x-bittorrent"/ {print $2}' > $TMPFILE
|
---|
| 29 | if [ \! -s "$TMPFILE" ]; then
|
---|
| 30 | echo "Failed to download RSS feed"
|
---|
| 31 | exit 1
|
---|
| 32 | fi
|
---|
| 33 |
|
---|
| 34 | NEWURLS=`comm -13 $TORRENTLIST $TMPFILE`
|
---|
| 35 | if [ -z "$NEWURLS" ]; then
|
---|
| 36 | exit 0
|
---|
| 37 | fi
|
---|
| 38 |
|
---|
| 39 | # Download the new ones please
|
---|
| 40 | fetch -o $TORRENTQUEUE $NEWURLS || exit 1
|
---|
| 41 |
|
---|
| 42 | # All succesfull, lets make that list permanent
|
---|
| 43 | cat $TMPFILE > $TORRENTLIST
|
---|
Note:
See
TracBrowser
for help on using the repository browser.