Last change
on this file since 405 was 296, checked in by Rick van der Zwet, 14 years ago |
Also compatible with latest version of transmissiionbt which added .added files if added to queue.
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Rev | Line | |
---|
[295] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
| 3 | # Crude attempt to keep torrent in sync from FreeBSD URL feed
|
---|
| 4 | # eq autofeed them into transmission
|
---|
| 5 | #
|
---|
| 6 | # Lesson learned: Shell is NOT useable for XML parsing
|
---|
| 7 | #
|
---|
| 8 | # Licence: BSDLike
|
---|
| 9 | # Rick van der Zwet <info@rickvanderzwet.nl>
|
---|
| 10 |
|
---|
| 11 | TORRENTQUEUE=/data/transmission/upload
|
---|
| 12 | TORRENTURL=${1-http://torrents.freebsd.org:8080}
|
---|
| 13 |
|
---|
| 14 | # Cleanup bits
|
---|
| 15 | TMPDIR=`mktemp -d /tmp/$(basename $0).XXXXX`
|
---|
| 16 | URLFILE=$TMPDIR/output.html
|
---|
| 17 | trap "rm -Rf $TMPDIR; exit 1" 1 2 3 15
|
---|
| 18 | trap "rm -Rf $TMPDIR; exit 0" 0
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | # Check for new ones
|
---|
| 22 | fetch -qo - $TORRENTURL > $URLFILE
|
---|
| 23 | if [ \! -s "$URLFILE" ]; then
|
---|
| 24 | echo "Failed to download URL feed $TORRENTURL"
|
---|
| 25 | exit 1
|
---|
| 26 | fi
|
---|
| 27 |
|
---|
| 28 | TORRENTS=`awk -F'"' '/.torrent"/ {print $8}' $URLFILE`
|
---|
| 29 |
|
---|
| 30 | # Download the new ones please, if not yet existing
|
---|
| 31 | for TORRENT in $TORRENTS; do
|
---|
| 32 | TARGET=$TORRENTQUEUE/`basename $TORRENT`
|
---|
| 33 | URI=$TORRENTURL$TORRENT
|
---|
[296] | 34 | if [ -r $TARGET.added ]; then
|
---|
| 35 | echo "# Torrent $TARGET already exist"
|
---|
| 36 | elif [ -r $TARGET ]; then
|
---|
| 37 | echo "# Torrent $TARGET already exist, but not yet added"
|
---|
| 38 | else
|
---|
[295] | 39 | echo "# Adding torrent $TARGET ($URI)"
|
---|
| 40 | fetch -qo $TARGET $URI
|
---|
| 41 | fi
|
---|
| 42 | done
|
---|
Note:
See
TracBrowser
for help on using the repository browser.