Add better global config (botconf.pm?)
Add msg handling (possibly allowing config to be rewritten?)
-Change feed list? http://news.bbc.co.uk/1/hi/help/rss/default.stm so far.
+Tweak handling to cope with BBC weather feeds, which don't change their
+links (so would fall foul of the current cacheing logic).
$_=shift;
s/\xA3/GBP/g; # Pound signs choke some clients
s/\xA4/EUR/g;
+ s/\xB0//g; # Degree
+ s/\n//g; # grr crlf
s/[^ -~]/?/g;
s/\?\s+//g;
if (0) {
# XXX Cheesy encoding in the absence of Encode.pm
#my $title = Encode::encode("iso-8859-1", $rss->{items}->[$i]->{title});
my $title = cheat_encode($rss->{items}->[$i]->{title});
+ next unless $title ne "";
- #$site = '\ 3'.$item->[1].$item->[0].'\ f: ';
- $site = ''.$item->[0].': ';
+ if ($TEST) {
+ $site = ''.$item->[0].': ';
+ } else {
+ $site = '\ 3'.$item->[1].$item->[0].'\ f: ';
+ }
#my $tmplink = $rss->{'items'}->[$i]->{'link'};
#$tmplink =~ s/^\s+//; $tmplink =~ s/\s+$//;
#$tmplink =~ s,^(http://news.bbc.co.uk/)go/rss/-/(.*),$1$2,;
# so @_ is now the new cache. OVERWRITES what's already there!
my $fh;
my $cachefile = $cachedir."/".$name;
- open($fh, ">", $cachefile) or die ("Cant open cachefile: $!");
+ open($fh, ">", $cachefile) or die ("Can't open cachefile: $!");
print $fh $_.$/ for (@_);
close($fh);
}
while (1) {
check_status($conn);
$irc->do_one_loop();
+ sleep $checktime if $TEST;
}
bbc-biz;0;http://feeds.bbci.co.uk/news/business/rss.xml
bbc-sci;0;http://feeds.bbci.co.uk/news/science_and_environment/rss.xml
bbc-tech;0;http://feeds.bbci.co.uk/news/technology/rss.xml
+# Weather feeds never change their URLs, so the current code won't report them more than once. TODO, someday...
+#Cambridge;2;http://newsrss.bbc.co.uk/weather/forecast/324/ObservationsRSS.xml
+#Cambridge;2;http://newsrss.bbc.co.uk/weather/forecast/324/Next3DaysRSS.xml
+#Oxford;3;http://newsrss.bbc.co.uk/weather/forecast/25/ObservationsRSS.xml
+#Oxford;3;http://newsrss.bbc.co.uk/weather/forecast/25/Next3DaysRSS.xml
+