X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Fyppsc-commod-processor;h=0f2545201d9de876f9ee5c1d88ff1458724f15a3;hb=170bf998f62a46ad0a4fa1fc76d749115bf8acd8;hp=2083be17221c1037db72151526b999b9b310ea88;hpb=f805d3a20cb1d7d551b0537c83a87ee3a83f85c9;p=ypp-sc-tools.db-test.git diff --git a/pctb/yppsc-commod-processor b/pctb/yppsc-commod-processor index 2083be1..0f25452 100755 --- a/pctb/yppsc-commod-processor +++ b/pctb/yppsc-commod-processor @@ -235,7 +235,7 @@ sub load_commodmap() { sub refresh_commodmap() { my $ua= LWP::UserAgent->new; - my $resp= $ua->get("$pctb/commodmap.php"); + my $resp= $ua->get("$pctb/commodmap.php?version=2"); die $resp->status_line unless $resp->is_success; my $cdata=''; @@ -287,9 +287,6 @@ sub refresh_commodmap() { }) or die; my $content= $resp->content; - # hacks to strip off drivel that seems to have been added! - $content =~ s/^.*\n(\<\?xml)/$1/s; - $content =~ s/\<\/body\>.*//s; # print STDERR "[[[$content]]]\n"; $xp->parse($content); close $o or die $!; @@ -310,8 +307,8 @@ sub bs_gen_md ($$) { $current= $commod{$commod}; my $l= bs_p($commod,$bs,$sortmul); next unless @$l; -#print STDERR "COMMOD $commod @$l\n"; - +#print STDERR "COMMOD $commod has ".scalar(@$l)."\n"; + $o .= writeint($commodmap{$commod}); $o .= writeint(scalar @$l); foreach my $cs (@$l) { $stall= $cs->{Stall}; @@ -319,12 +316,13 @@ sub bs_gen_md ($$) { if (!defined $stallix) { push @stallmap, $stall; $stallmap{$stall}= $stallix= @stallmap; +#print STDERR "STALL DEF $stallix $stall\n"; } my $qty= $cs->{Qty}; $qty =~ s/^\>\s*//; $o .= writeint($stallix, $cs->{Price}, $qty+0); + $count++; } - $count++; } #print STDERR "COMMOD $commod COUNT WAS $count\n"; return