X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=fb_upload;h=b33a84eab086460a06a2a4d38aaecadc678fbe6f;hb=1886c7247cb16ed68a78cd5550b152689a465999;hp=beac104a441962c546203bcc095aaf86376ffca3;hpb=7722a8f3d6f794a500cfc48097b9e0b693d1b126;p=bin.git diff --git a/fb_upload b/fb_upload index beac104..b33a84e 100755 --- a/fb_upload +++ b/fb_upload @@ -140,12 +140,22 @@ else { for my $photo (@photos) { print "Uploading $photo"; - my $response = - $client->photos->upload(aid => $aid, - data => scalar read_file($photo), - caption => '', - filename => basename($photo), - ); + my $response; + my $try=0; + while (not $response = + $client->photos->upload(aid => $aid, + data => scalar read_file($photo), + caption => '', + filename => basename($photo), + )) { + $try++; + print " [failure $try] "; + sleep 3; + last if $try > 10; + } + if (not $response) { + die "Upload failure at photo $photo"; + } print " to ".$response->{link}."\n"; }