X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=get_sgf;h=f978b81ed5c4a1321158bb88df40a98b58e37ab1;hb=7072dd6217d2a600f729188624f228b5700bd836;hp=973550d98fcc7312fd68a057e0b1204625c9fd38;hpb=e5c9fabc960b4a0d756f7db752f7c1ce424abf2a;p=bin.git diff --git a/get_sgf b/get_sgf index 973550d..f978b81 100755 --- a/get_sgf +++ b/get_sgf @@ -123,6 +123,7 @@ for my $url (@ARGV) { $m->get("http://gobase.org$fname"); $m->save_content('temp.sgf'); $m->get($uri->as_string); + $m->follow_link(text_regex=>qr/PostScript/); $m->form_number(2); $m->select('scale',$options{scale}); $m->field('fig',$options{figures}); @@ -130,6 +131,7 @@ for my $url (@ARGV) { $m->submit(); my $content; my $state; + my $sleep; VALID_LOOP: { do { $state = $m->clone; @@ -138,8 +140,10 @@ for my $url (@ARGV) { $m->save_content('temp.ps'); last VALID_LOOP; } + $sleep = 240+int(rand()*120); + print STDERR "Failure to download content, waiting $sleep seconds\n"; $m = $state; - } while (sleep 30); + } while (sleep $sleep); } system('gzip','temp.ps'); system("$ENV{HOME}/bin/sgf_rename",'temp.sgf');