-
Notifications
You must be signed in to change notification settings - Fork 1
/
ansrvr-rss2packets.pl
73 lines (52 loc) · 1.57 KB
/
ansrvr-rss2packets.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/perl
#
# ansrvr-rss2packets.pl
# v0.2
#
# Mike Cleckner, KD2FDX
#
# This script will read the RSS file created by ansrvr-grp-2rss and create a file
# of the APRS packets.
#
use strict;
use warnings;
use XML::RSS;
use Date::Manip;
my ($GMTTime,$Time,$rssTime);
my $targetGRP = ""; # Get from command line
print "\n";
print "ansrvr-rss2packets.pl\n";
my $num_args = $#ARGV + 1;
if ($num_args != 1)
{
print "\nUsage: ansrvr-rss2packets.pl ansrvr_group_name\n\n";
exit;
}
$targetGRP = uc($ARGV[0]);
# Where do you want the file stored and it's name -- you can customize it yourself
my $rssFile = "/var/www/APRS/ANSRVR-${targetGRP}.rss";
my $htmlFile = "/var/www/APRS/ANSRVR-${targetGRP}.html";
my $packetFile = "/var/www/APRS/ANSRVR-${targetGRP}-packets.txt";
$GMTTime = gmtime(time);
$Time = &UnixDate($GMTTime, '%Y-%m-%d %H:%M:%S');
$rssTime = &UnixDate($GMTTime, '%a, %d %b %Y %H:%M:%S UT');
my $rss = new XML::RSS(version => '2.0');
if (-e $rssFile )
{
# Read in the existing file
$rss->parsefile($rssFile);
open (PACKETFILE, "> $packetFile") || die "problem opening $packetFile\n";
foreach my $item (@{$rss->{'items'}})
{
#print PACKETFILE "$item->{description}\n";
my $itemDate=$item->{pubDate};
$item=$item->{description};
# HMMM <UL><I> = <UL><I>
# </I></UL> = </I></UL>
my @A = split ('<UL><I>', $item);
my @B = split ('</I>', $A[1]);
print PACKETFILE "$itemDate#$B[0]\n";
}
close (PACKETFILE);
}
else { print "No existing RSS file $rssFile"; }