chiark / gitweb /
cope with unknown vessels by turning them unto zz vcunk
[ypp-sc-tools.db-live.git] / yarrg / database-info-fetch
index 2e195c7a01b2d06471b540a3201721a39701aad2..041e008f4220e0a775c8ce4aeab18f5c7d4535ff 100755 (executable)
@@ -25,7 +25,6 @@
 # sponsored by Three Rings.
 
 use strict (qw(vars));
-use LWP::UserAgent;
 use JSON;
 #use Data::Dumper;
 use IO::File;
@@ -37,8 +36,8 @@ our ($which) = shift @ARGV;
 
 $which =~ s/\W//g;
 
-our ($pctb) = $ENV{'YPPSC_PCTB_PCTB'};
-our ($ua)= LWP::UserAgent->new;
+our ($pctb) = $ENV{'YPPSC_YARRG_PCTB'};
+our ($ua)= http_useragent("database_info_fetch $which");
 our $jsonresp;
 
 sub jparsetable ($$) {
@@ -145,7 +144,7 @@ sub compare_sources_one ($$) {
 sub main__comparesources () {
     my $ocean= get_ocean();
     
-    parse_masters();
+    parse_info_clientside();
     get_arches_islands_pctb($ocean);
     parse_pctb_commodmap() or die;
 
@@ -159,7 +158,7 @@ sub main__comparesources () {
                sub { });
     for_commods(sub {
                    my ($commod)= @_;
-                   my $srcs= $commods{$commod};
+                   my $srcs= $commods{$commod}{Srcs};
                    compare_sources_one($srcs, "commodity $commod");
                });
 }
@@ -167,8 +166,8 @@ sub main__comparesources () {
 sub main__island () {
     my $ocean= get_ocean();
     
-    parse_masters();
-    get_arches_islands_pctb($ocean);
+    parse_info_clientside() if $ENV{'YPPSC_YARRG_YARRG'};
+    get_arches_islands_pctb($ocean) if $pctb;
 
     for_islands($ocean,
                sub {
@@ -184,6 +183,23 @@ sub main__island () {
                });
 }
 
+sub main__timestamp () {
+    my %o;
+    $o{'requesttimestamp'}= '1';
+    my $respcontent= yarrgpostform($ua, \%o);
+    $respcontent =~ m/^OK ([1-9]\d{1,20})\./ or die "$respcontent ?";
+    print "$1\n";
+    exit(0);
+}
+
+sub main__yarrgversion () {
+    printf "%s\n", version_core();
+}
+
+sub main__useragentstringmap ($$) {
+    printf "%s\n", http_useragent_string_map($_[0], $_[1]);
+}
+
 sub main__sunshinewidget () {
     print <<END
 Land {On land} {