From: Dirk Koopman Date: Wed, 25 Nov 2009 17:15:57 +0000 (+0000) Subject: add xml version of sh/qrz X-Git-Tag: 1.56~43 X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?p=spider.git;a=commitdiff_plain;h=99077d96c91df307092394bf1028212adeec4c37 add xml version of sh/qrz you will need a subscription to the xml service. See: http://www.qrz.com/XML/index.html for more info. Disable the incomplete Encoding of textual data. Work out what to do after more agreement with people. --- diff --git a/Changes b/Changes index b0d72948..fb1c1915 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,8 @@ +25Nov09======================================================================= +1. Change sh/qrz to use the xml interface. You will have to subscribe to +the xml interface - see http://www.qrz.com/XML/index.html for more info. +2. Remove (bodged) forced encoding to iso-8859 on incoming text. More +subtle handling will be required. 14Nov09======================================================================= 1. Add CTY-1921 prefixes 2. allow -SSID values on set/badnode diff --git a/cmd/show/qrz.pl b/cmd/show/qrz.pl index e0ee31a6..9a3f9c3f 100644 --- a/cmd/show/qrz.pl +++ b/cmd/show/qrz.pl @@ -2,10 +2,9 @@ # Query the QRZ Database server for a callsign # # from an idea by Steve Franke K9AN and information from Angel EA7WA +# and finally (!) modified to use the XML interface # -# Copyright (c) 2001 Dirk Koopman G1TLH -# -# +# Copyright (c) 2001-2009 Dirk Koopman G1TLH # my ($self, $line) = @_; my @list = split /\s+/, $line; # generate a list of callsigns @@ -15,14 +14,10 @@ my @out; return (1, $self->msg('e24')) unless $Internet::allow; return (1, "SHOW/QRZ , e.g. SH/QRZ g1tlh") unless @list; -#my $target = $Internet::http_proxy || 'www.qrz.com'; -#my $port = $Internet::http_proxy_port || 80; -#my $url = ''; -#$url = 'http://www.qrz.com' if $Internet::http_proxy; -my $target = $Internet::http_proxy || $Internet::qrz_url || 'www.qrz.com'; +my $target = $Internet::http_proxy || $Internet::qrz_url || 'xml.qrz.com'; my $port = $Internet::http_proxy_port || 80; my $url = ''; -$url = 'http://' . ($Internet::qrz_url | 'www.qrz.com') if $Internet::http_proxy; +$url = 'http://' . ($Internet::qrz_url | 'xml.qrz.com') if $Internet::http_proxy; use Net::Telnet; @@ -39,7 +34,7 @@ foreach $l (@list) { if (!$t || $@) { push @out, $self->msg('e18', 'QRZ.com'); } else { - my $s = "GET $url/p/dxcluster.pl?callsign=$l\&username=$Internet::qrz_uid\&password=$Internet::qrz_pw HTTP/1.0\n\n"; + my $s = "GET /xml?callsign=$l;username=$Internet::qrz_uid;password=$Internet::qrz_pw;agent=dxspider HTTP/1.0\n\n"; dbg($s) if isdbg('qrz'); $t->print($s); Log('call', "$call: show/qrz \U$l"); @@ -50,12 +45,17 @@ foreach $l (@list) { push @out, $self->msg('e18', 'QRZ.com'); last; } - if ($state eq 'blank' && $result =~ /^\s*Callsign\s*:/i) { + if ($state eq 'blank' && $result =~ /^/i) { $state = 'go'; } elsif ($state eq 'go') { - next if $result =~ /^\s*Usage\s*:/i; - chomp $result; - push @out, $result; + next if $result =~ m||; + next if $result =~ m||; + next if $result =~ m||; + next if $result =~ m||; + next if $result =~ m||; + last if $result =~ m||; + my ($tag, $data) = $result =~ m|^\s*<(\w+)>(.*)close; diff --git a/perl/AnnTalk.pm b/perl/AnnTalk.pm index c075765f..f6b4653d 100644 --- a/perl/AnnTalk.pm +++ b/perl/AnnTalk.pm @@ -47,7 +47,7 @@ sub dup chomp $text; unpad($text); $text =~ s/\%([0-9A-F][0-9A-F])/chr(hex($1))/eg; - $text = Encode::encode("iso-8859-1", $text) if $main::can_encode && Encode::is_utf8($text, 1); +# $text = Encode::encode("iso-8859-1", $text) if $main::can_encode && Encode::is_utf8($text, 1); $text =~ s/[^\#a-zA-Z0-9]//g; $text = substr($text, 0, $duplth) if length $text > $duplth; my $dupkey = "A$call|$to|\L$text"; diff --git a/perl/Spot.pm b/perl/Spot.pm index a2b9eee0..e7227ab1 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -404,7 +404,7 @@ sub dup } } my $otext = $text; - $text = Encode::encode("iso-8859-1", $text) if $main::can_encode && Encode::is_utf8($text, 1); +# $text = Encode::encode("iso-8859-1", $text) if $main::can_encode && Encode::is_utf8($text, 1); $text =~ s/^\+\w+\s*//; # remove leading LoTW callsign $text =~ s/\s{2,}[\dA-Z]?[A-Z]\d?$// if length $text > 24; $text =~ s/[\W\x00-\x2F\x7B-\xFF]//g; # tautology, just to make quite sure! diff --git a/perl/Version.pm b/perl/Version.pm index 214f167d..c9b52ecb 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,6 +11,6 @@ use vars qw($version $subversion $build); $version = '1.55'; $subversion = '0'; -$build = '52'; +$build = '53'; 1;