source: transmission/rss-sync.sh@ 255

Last change on this file since 255 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
RevLine 
[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
15TORRENTLIST=/data/transmission/freebsd-rss.txt
16TORRENTQUEUE=/data/transmission/upload
17TORRENTQUEUE=/tmp/rrs
18
19# Cleanup bits
20TMPFILE=`mktemp /tmp/$(basename $0).XXXXX`
21trap "rm $TMPFILE; exit 1" 1 2 3 15
22trap "rm $TMPFILE; exit 0" 0
23
24# More sure we can write to the permanent location
25touch $TORRENTLIST || exit 1
26
27# Check for new ones
28fetch -qo - http://torrents.freebsd.org:8080/rss.xml | awk -F\" '/type="application\/x-bittorrent"/ {print $2}' > $TMPFILE
29if [ \! -s "$TMPFILE" ]; then
30 echo "Failed to download RSS feed"
31 exit 1
32fi
33
34NEWURLS=`comm -13 $TORRENTLIST $TMPFILE`
35if [ -z "$NEWURLS" ]; then
36 exit 0
37fi
38
39# Download the new ones please
40fetch -o $TORRENTQUEUE $NEWURLS || exit 1
41
42# All succesfull, lets make that list permanent
43cat $TMPFILE > $TORRENTLIST
Note: See TracBrowser for help on using the repository browser.