X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=pctb%2Fcommod-results-processor;h=e391e4749780c1a04e50abfc4f146a4317a3b771;hb=ba2185d0ed58f86a39a374bff01d1251da20b339;hp=e3f45d177b190c00ee7451fdf73f66cd99bb8bca;hpb=17d7ef99b6c9283a0a576febd07c5ebf32b34978;p=ypp-sc-tools.db-test.git diff --git a/pctb/commod-results-processor b/pctb/commod-results-processor index e3f45d1..e391e47 100755 --- a/pctb/commod-results-processor +++ b/pctb/commod-results-processor @@ -244,7 +244,7 @@ sub refresh_commodmap() { my $incommodmap=0; my $intag=''; my %got; - my $o= new IO::File "#commodmap#.tsv.new",'w' or die $!; + my $o= new IO::File "#commodmap#.tsv.tmp",'w' or die $!; undef %commodmap; my $xp= new XML::Parser @@ -292,7 +292,7 @@ sub refresh_commodmap() { # print STDERR "[[[$content]]]\n"; $xp->parse($content); close $o or die $!; - rename "#commodmap#.tsv.new","#commodmap#.tsv" or die $!; + rename "#commodmap#.tsv.tmp","#commodmap#.tsv" or die $!; } our %newcommods; @@ -449,7 +449,7 @@ sub main__upload () { ] }; - print STDERR "Uploading data to server...\n"; + print STDERR "Uploading data to $pctb...\n"; my $resp= $ua->post("$url", Content => $content, Content_Type => 'form-data'); @@ -491,29 +491,32 @@ sub main__upload () { die "@forcerls ?" if grep { $_ ne $forcerl } @forcerls; my $setisland= { - 'action' => 'setisland', - 'filename' => $filename, - 'forcereload' => $forcerl, - 'ocean' => $oceanids[0], - 'island' => $islandid, }; print STDERR "Setting ocean and island...\n"; - $resp= $ua->post("${url}IWJTEST", $setisland); + my $siurl= ($url . "?action=setisland". + "&filename=$filename". + "&forcereload=$forcerl". + "&ocean=$oceanids[0]". + "&island=$islandid"); + $resp= $ua->get($siurl); + die $resp->status_line unless $resp->is_success; $resptxt= $resp->content(); save_upload_html('2', $resptxt); - - -# -#http://pctb.ilk.org/upload.php?&ocean=2&island=48&action=setisland&forcereload=1244748679&filename=PFayDW' >v.html -# -# print ">$filename|$forcerl|@oceanids|$islandid<\n"; + die unless $resptxt =~ m/your uploaded data has been processed/i; + die unless $resptxt =~ m/your data has been integrated into the database/i; + + $resptxt =~ s/\[^<>]+\<\/a\>//g; + save_upload_html('3', $resptxt); - system 'printenv|grep YPP|sort'; + print "\n" or die $!; + system('w3m -T text/html -dump < \#upload-3#.html'); + + print "\n" or die $!; }