X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=get_sgf;fp=get_sgf;h=973550d98fcc7312fd68a057e0b1204625c9fd38;hb=e5c9fabc960b4a0d756f7db752f7c1ce424abf2a;hp=229424c0b3849c1dd838f5ab7690a14820809285;hpb=f61d8ff4404eae85540dc88bdcab38cfc6029615;p=bin.git diff --git a/get_sgf b/get_sgf index 229424c..973550d 100755 --- a/get_sgf +++ b/get_sgf @@ -128,8 +128,20 @@ for my $url (@ARGV) { $m->field('fig',$options{figures}); $m->select('paper',$options{paper}); $m->submit(); - $m->follow_link(url_regex=>qr/\.ps\.gz/); - $m->save_content('temp.ps.gz'); + my $content; + my $state; + VALID_LOOP: { + do { + $state = $m->clone; + $m->follow_link(url_regex=>qr/\.ps\.gz/); + if ($m->content =~ /^\%\!PS/){ + $m->save_content('temp.ps'); + last VALID_LOOP; + } + $m = $state; + } while (sleep 30); + } + system('gzip','temp.ps'); system("$ENV{HOME}/bin/sgf_rename",'temp.sgf'); }