NAME
sobt.pl - Synchronizes current OpenBSD torrents from
http://OpenBSD.somedomain.net/
DESCRIPTION
When new files are released by the OpenBSD team, new torrents are
generated. Keeping your local files synchronized with what is out there
can be time consuming. This script is here to help. It will read the RSS
feeds available from http://OpenBSD.somedomain.net, make sure you have
the newest torrent for each directory you want, and get rid of any old
versions.
This script does not do anything with the torrents other than sync them.
If you want to actually download the files in the torrent you will need
another program in addition to this script. I have tested it with
`btlaunchmany' from the official BitTorrent client, but any BitTorrent
client that can watch a directory for torrents should work.
A limitation of this script is that it will not clean up torrents that
you no longer want. For example, when the latest version changes from
3.7 to 3.8, it will download the new 3.8 torrents, but it will no longer
update the 3.7 torrents or delete them. The same is true if you remove
an RSS feed from the list of URLs. If you want them deleted, you will
have to do it manually.
REQUIREMENTS
This script should run on any version of perl that supports the required
modules. The only required modules that are not part of the base perl
install are XML::RAI and LWP::Simple. It has been successfully tested on
OpenBSD 3.7, OS X 10.2 and Windows 2000 with Activeperl 5.8.7 build 813.
SYNOPSIS
Installation
This script is designed to be run regularly from cron (or the Windows
task scheduler). It should not need to run more than every four hours
because that is as often as the RSS feeds are updated.
The file can be saved anywhere, for instance, $HOME/bin. It runs under
taint mode normally, so if it is running in Windows, it will need to be
run with perl -T sobt.pl, or remove the -T from the first line in the
script.
It can be put in cron like this:
MIN */4 * * * sobt.pl > /dev/null
Where MIN is a number between 6 and 54 to even the load on the server.
The script outputs newly downloaded and deleted files on STDERR so cron
should send you an e-mail whenever files are updated.
Changing Settings
Changing the settings that control the operation of this script can be
done by changing variables directly in the script. There are only a few
settings available, and most of them can be left at their default
settings.
URLS TO DOWNLOAD - @URLs
This is a list of the rss feeds to be synchronized. It is stored in
the @URLs array. It defaults to downloading all torrents for the
latest release from http://OpenBSD.somedomain.net/latest_release.rss
A valid url for the array can either be one of the special
mod_rewrite *.rss feeds, or one of the normal rss.php feeds.
TORRENT DIRECTORY - $Torrendir
This should point to the location where the dowmnladed torrents
should end up. It is controlled by the $Torrentdir variable. The
default is a directory named 'torrent' in $HOME.
DATA FILE - $Datafile
The default setting here should be OK. It is the location of the
file where a list of the latest torrents you have downloaded are
stored. This setting is controlled by the $Datafile variable. It
defaults to $HOME/.sobtdata
TRUST DATA FILE - $Trust_Datafile
Normally the script will check to see if a file it thinks it has
downloaded exists and if not it will redownload it. If you do not
want this feature, for example if your torrent client deletes the
torrents after it is done with them, you can set $Trust_Datafile to
1 to trust what is in the Datafile and not redownload the torrents.
LINKS
OpenBSD
http://www.OpenBSD.org
BitTorrent
http://www.bittorrent.org
OpenBSD Torrents
http://OpenBSD.somedomain.net
Some OpenBSD Torrent RSS feeds
Use any rss feed from http://OpenBSD.somedomain.net
All Torrents
http://OpenBSD.somedomain.net/all.rss
Latest Release
http://OpenBSD.somedomain.net/latest_release.rss
Recent Torrents
http://OpenBSD.somedomain.net/index.rss
All torrents for Zaurus
http://OpenBSD.somedomain.net/arch_zaurus.rss
Replace 'zaurus' in the url with a different architecture.
Latest release torrents for i386
http://OpenBSD.somedomain.net/latest+release_i386.rss
Replace 'i386' in the url with a different architecture and
'latest+release' with a different version.
Snapshots for amd64
http://OpenBSD.somedomain.net/index.php?arch=amd64&version=snaps
hots
Replace 'amd64' in the url with a different architecture and
'snapshots' with a different version.
AUTHOR
Andrew Fresh
COPYRIGHT
Copyright © 2005 Andrew Fresh. All rights reserved. Licensed under a two
clause BSD style license, the full text of which can be found in the
source of the main script.
`$Id: sobt.pl,v 1.31 2005/06/21 06:09:07 andrewfresh Exp $'