This is an automated email from the git hooks/post-receive script. gregoa pushed a commit to branch master in repository libflickr-upload-perl.
commit 302ab7b232b5d05e73fcd800cceb9d042aa94d68 Author: gregor herrmann <[email protected]> Date: Sun Sep 14 13:11:40 2014 +0200 Imported Upstream version 1.40 --- ChangeLog | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- META.yml | 40 +++++++++++-------- Makefile.PL | 2 +- README | 2 +- Upload.pm | 37 +++++++++++++---- flickr_upload | 70 ++++++++++++++++++++++---------- 6 files changed, 225 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index b18a767..fc65348 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,120 @@ -commit 25738657dcf4623445f69433ae63973d1e24d4cb (refs/heads/master) +commit 207251a67870f816fb0d1e6037deef8cc1890503 (HEAD, origin/master, origin/HEAD, master) +Author: maspotts <[email protected]> +AuthorDate: Mon Jun 30 21:37:55 2014 -0700 +Commit: maspotts <[email protected]> +CommitDate: Mon Jun 30 21:37:55 2014 -0700 + + Update Upload.pm + + Bump version to 1.4. + +commit 9302c6ffe2b619a7da571eda46308708d8863596 +Author: maspotts <[email protected]> +AuthorDate: Mon Jun 30 21:33:54 2014 -0700 +Commit: maspotts <[email protected]> +CommitDate: Mon Jun 30 21:33:54 2014 -0700 + + Update Upload.pm + + Use SSL api. + +commit 5c210ab9bac949075c6a46d5d87718c79f3d6551 +Author: Ævar Arnfjörð Bjarmason <[email protected]> +AuthorDate: Wed Oct 14 17:58:20 2009 +0000 +Commit: Ævar Arnfjörð Bjarmason <[email protected]> +CommitDate: Wed Oct 14 17:58:20 2009 +0000 + + Add myself to AUTHORS/COPYRIGHT + +commit d9ccd247ca8b59e3e10329c6b4533c97a9ef0d30 +Author: Ævar Arnfjörð Bjarmason <[email protected]> +AuthorDate: Wed Oct 14 17:50:41 2009 +0000 +Commit: Ævar Arnfjörð Bjarmason <[email protected]> +CommitDate: Wed Oct 14 17:50:41 2009 +0000 + + Make --progress and --report boolean (!) switches in Getopt::Long + + This means --no-report and --no-progress can be specified as well as + --report and --progress. + +commit 8d8f04c98438c938ee9894c33cfc2f4a2d0d7ae5 +Author: Ævar Arnfjörð Bjarmason <[email protected]> +AuthorDate: Wed Oct 14 17:45:41 2009 +0000 +Commit: Ævar Arnfjörð Bjarmason <[email protected]> +CommitDate: Wed Oct 14 17:45:41 2009 +0000 + + Add a --report switch to suppress the "Waiting for upload results" message + + Also add a facility to allow the default of --progress and --report to + be changed via the ~/.flickrrc configuration file. + +commit 27a4da0cbd6b5556069d7007f692c7c888b6f325 +Author: Ævar Arnfjörð Bjarmason <[email protected]> +AuthorDate: Wed Oct 14 17:32:11 2009 +0000 +Commit: Ævar Arnfjörð Bjarmason <[email protected]> +CommitDate: Wed Oct 14 17:32:11 2009 +0000 + + "git-log" has been deprecated in favor of "git log" + +commit 6b2b1a87ccd4eabe66b28db56a2df7bf6e5f0f2b +Author: Ævar Arnfjörð Bjarmason <[email protected]> +AuthorDate: Wed Oct 14 17:12:00 2009 +0000 +Commit: Ævar Arnfjörð Bjarmason <[email protected]> +CommitDate: Wed Oct 14 17:12:00 2009 +0000 + + Solve RT#50493. Sometimes Flickr::Upload will die during upload due to network errors. + + Before it would do this: + + Uploading img_4289.jpg... + junk '500 read failed: Connection reset by peer + ' before XML element + + and simply die. Now it'll try again in case of errors: + + Uploading img_4289.jpg... + Failed uploading attempt attempt 1/3, trying again. [...] + Uploading img_4289.jpg... + +commit 77f2d561665af0cef16b6623b0e5c8ea4f929816 +Author: Christophe Beauregard <[email protected]> +AuthorDate: Sat Dec 20 11:01:44 2008 -0500 +Commit: Christophe Beauregard <[email protected]> +CommitDate: Sat Dec 20 11:01:44 2008 -0500 + + typo fix + +commit 687838e8b1f5a8d1d533ae10a04b7aa72be4b539 +Author: Christophe Beauregard <[email protected]> +AuthorDate: Mon Oct 27 14:43:55 2008 -0400 +Commit: Christophe Beauregard <[email protected]> +CommitDate: Mon Oct 27 14:43:55 2008 -0400 + + Incorporate part of + http://svn.debian.org/wsvn/pkg-perl/trunk/libflickr-upload-perl/debian/patches/failupload.patch?op=file&rev=0&sc=0 + + So the failupload test works okay when there's no net access. + +commit f2c2c7f74fd2ad23241195c85168614eac4fe6aa +Author: Christophe Beauregard <[email protected]> +AuthorDate: Wed Oct 15 06:33:17 2008 -0400 +Commit: Christophe Beauregard <[email protected]> +CommitDate: Wed Oct 15 06:33:17 2008 -0400 + + whoo, we're a few years behind on the copyrights + +commit 36f2a4434770d8cbdcdbceee985fc19d4bc3f9f9 +Author: Christophe Beauregard <[email protected]> +AuthorDate: Wed Oct 15 06:27:38 2008 -0400 +Commit: Christophe Beauregard <[email protected]> +CommitDate: Wed Oct 15 06:27:38 2008 -0400 + + Merge Debian patch r26041 from Alex Muntada" <[email protected]>: + Hopefully fixed last TODO item via quilt: + W: libflickr-upload-perl: manpage-has-errors-from-pod2man + usr/share/man/man1/flickr_upload.1p.gz:324 + +commit 25738657dcf4623445f69433ae63973d1e24d4cb (tag: 1.32) Author: Christophe Beauregard <[email protected]> AuthorDate: Wed Sep 17 20:17:52 2008 -0400 Commit: Christophe Beauregard <[email protected]> @@ -33,7 +149,7 @@ CommitDate: Wed Sep 17 20:03:35 2008 -0400 Add a --check option to invoke the flickr.auth.checkToken API call and just generally validate the authentication information. -commit 3afc55b07bc0087afe9919563ad0392c8a221c54 (refs/remotes/origin/master, refs/remotes/origin/HEAD, refs/remotes/gitorious/master) +commit 3afc55b07bc0087afe9919563ad0392c8a221c54 Author: Christophe Beauregard <[email protected]> AuthorDate: Sat Jun 21 18:59:13 2008 -0400 Commit: Christophe Beauregard <[email protected]> @@ -41,7 +157,7 @@ CommitDate: Sat Jun 21 18:59:13 2008 -0400 put more detail in the ChangeLog. Specifically, we'd like to see dates. -commit 75d78079f595f2516a5efa4bfdada2961f0c08a3 (refs/tags/1.31) +commit 75d78079f595f2516a5efa4bfdada2961f0c08a3 (tag: 1.31) Author: Christophe Beauregard <[email protected]> AuthorDate: Wed Jun 18 16:39:42 2008 -0400 Commit: Christophe Beauregard <[email protected]> @@ -83,7 +199,7 @@ CommitDate: Tue Jun 17 20:16:37 2008 -0400 bump version to 1.31 commit 9a7c22dc11e16ff483b01dc491f11e146683e2d4 -Merge: b53a716... c87f9be... +Merge: b53a716 c87f9be Author: Christophe Beauregard <[email protected]> AuthorDate: Tue Jun 17 20:15:14 2008 -0400 Commit: Christophe Beauregard <[email protected]> @@ -123,7 +239,7 @@ CommitDate: Tue Jun 17 19:12:24 2008 -0400 add note about GIT repo -commit c87f9be69faff0a337e3f32e46758d97d407308b (refs/remotes/avar/master) +commit c87f9be69faff0a337e3f32e46758d97d407308b Author: Ævar Arnfjörð Bjarmason <[email protected]> AuthorDate: Tue Jun 17 03:49:01 2008 +0000 Commit: Ævar Arnfjörð Bjarmason <[email protected]> diff --git a/META.yml b/META.yml index f25bb14..34a7ce1 100644 --- a/META.yml +++ b/META.yml @@ -1,19 +1,27 @@ --- #YAML:1.0 -name: Flickr-Upload -version: 1.32 -abstract: Module for uploading images to flickr.com -license: ~ -author: +name: Flickr-Upload +version: 1.4 +abstract: Module for uploading images to flickr.com +author: - Christophe Beauregard <[email protected]> -generated_by: ExtUtils::MakeMaker version 6.42 -distribution_type: module -requires: - Flickr::API: 0.07 - Getopt::Long: 1 - HTTP::Request::Common: 1 - LWP::UserAgent: 1 - Pod::Usage: 1 - XML::Parser::Lite::Tree: 0.03 +license: unknown +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +build_requires: + ExtUtils::MakeMaker: 0 +requires: + Flickr::API: 0.07 + Getopt::Long: 1 + HTTP::Request::Common: 1 + LWP::UserAgent: 1 + Pod::Usage: 1 + XML::Parser::Lite::Tree: 0.03 +no_index: + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.57_05 meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.3.html - version: 1.3 + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff --git a/Makefile.PL b/Makefile.PL index cef266a..322c87b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,7 +3,7 @@ use ExtUtils::MakeMaker; sub MY::postamble { return <<END; ChangeLog: Makefile - git-log --pretty=fuller --decorate . >ChangeLog + git log --pretty=fuller --decorate . >ChangeLog META.yml: Makefile touch META.yml diff --git a/README b/README index 782abe7..e831c27 100644 --- a/README +++ b/README @@ -35,7 +35,7 @@ http://git.gitorious.org/flickrupload/mainline.git COPYRIGHT AND LICENCE ===================== -Copyright (C) 2004,2005 by Christophe Beauregard +Copyright (C) 2004,2005,2006,2007,2008 by Christophe Beauregard This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, diff --git a/Upload.pm b/Upload.pm index 0928c28..aa3877e 100644 --- a/Upload.pm +++ b/Upload.pm @@ -8,7 +8,7 @@ use HTTP::Request::Common; use Flickr::API; use XML::Parser::Lite::Tree; -our $VERSION = '1.32'; +our $VERSION = '1.4'; our @ISA = qw(Flickr::API); @@ -70,7 +70,7 @@ Upload an image to L<flickr.com>. 'secret' => '37465825' }); -Instatiates a L<Flickr::Upload> instance. The C<key> argument is your +Instantiates a L<Flickr::Upload> instance. The C<key> argument is your API key and the C<secret> is the API secret associated with it. To get an API key and secret, go to L<http://www.flickr.com/services/api/key.gne>. @@ -217,7 +217,7 @@ sub make_upload_request { # _required_ by the uploader. die "Missing 'auth_token' argument" unless $args{'auth_token'}; - my $uri = $args{'uri'} || 'http://api.flickr.com/services/upload/'; + my $uri = $args{'uri'} || 'https://api.flickr.com/services/upload/'; # passed in separately, so remove from the hash delete $args{uri}; @@ -268,10 +268,28 @@ sub upload_request { my $req = shift; die "expecting a HTTP::Request" unless $req->isa('HTTP::Request'); - my $res = $self->request( $req ); + # Try 3 times to upload data. Without this flickr_upload is bound + # to die on large uploads due to some miscellaneous network + # issues. Timeouts on flickr or something else. + my ($res, $tree); + my $tries = 3; + for my $try (1 .. $tries) { + # Try to upload + $res = $self->request( $req ); + return () unless defined $res; + + if ($res->is_success) { + $tree = XML::Parser::Lite::Tree::instance()->parse($res->decoded_content()); + return () unless defined $tree; + last; + } else { + my $what_next = ($try == $tries ? "giving up" : "trying again"); + my $status = $res->status_line; - my $tree = XML::Parser::Lite::Tree::instance()->parse($res->decoded_content()); - return () unless defined $tree; + print STDERR "Failed uploading attempt attempt $try/$tries, $what_next. Message from server was: '$status'\n"; + next; + } + } my $photoid = response_tag($tree, 'rsp', 'photoid'); my $ticketid = response_tag($tree, 'rsp', 'ticketid'); @@ -392,15 +410,18 @@ L<http://flickr.com/services/api/> L<Flickr::API> -=head1 AUTHOR +=head1 AUTHORS Christophe Beauregard, L<[email protected]> +E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason, <[email protected]> + =head1 COPYRIGHT AND LICENSE This module is not an official Flickr.com (or Ludicorp, or Yahoo) service. -Copyright (C) 2004,2005 by Christophe Beauregard +Copyright (C) 2004-2008 by Christophe Beauregard and 2008-2009 by +E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, diff --git a/flickr_upload b/flickr_upload index 6b6f69a..bf4c2a0 100755 --- a/flickr_upload +++ b/flickr_upload @@ -17,6 +17,7 @@ my $man = 0; my $auth = 0; my $progress = 0; my $check = 0; +my $report = 1; if( open CONFIG, "< $ENV{HOME}/.flickrrc" ) { while( <CONFIG> ) { @@ -28,6 +29,10 @@ if( open CONFIG, "< $ENV{HOME}/.flickrrc" ) { $api_key = $2; } elsif( $1 eq "secret" ) { $not_so_secret = $2; + } elsif( $1 eq "progress" ) { + $progress = $2; + } elsif( $1 eq "report" ) { + $report = $2; } else { $args{$1} = $2; } @@ -49,8 +54,9 @@ GetOptions( 'key=s' => \$api_key, 'secret=s' => \$not_so_secret, 'auth' => \$auth, - 'progress' => \$progress, + 'progress!' => \$progress, 'check' => \$check, + 'report!' => \$report, 'option=s' => \%args, ) or pod2usage(2); pod2usage(1) if $help; @@ -170,24 +176,26 @@ while( my $photo = shift @ARGV ) { } # check -print "Waiting for upload results (ctrl-C if you don't care)...\n"; -do { - sleep 1; - my @checked = $ua->check_upload( keys %tickets ); - for( @checked ) { - if( $_->{complete} == 0 ) { - # not done yet, don't do anythig - } elsif( $_->{complete} == 1 ) { - # uploaded, got photoid - print "$tickets{$_->{id}} is at " . +if( $report ) { + print "Waiting for upload results (ctrl-C if you don't care)...\n"; + do { + sleep 1; + my @checked = $ua->check_upload( keys %tickets ); + for( @checked ) { + if( $_->{complete} == 0 ) { + # not done yet, don't do anythig + } elsif( $_->{complete} == 1 ) { + # uploaded, got photoid + print "$tickets{$_->{id}} is at " . "http://www.flickr.com/tools/uploader_edit.gne?ids=$_->{photoid}\n"; - delete $tickets{$_->{id}}; - } else { - print "$tickets{$_->{id}} failed to get photoid\n"; - delete $tickets{$_->{id}}; + delete $tickets{$_->{id}}; + } else { + print "$tickets{$_->{id}} failed to get photoid\n"; + delete $tickets{$_->{id}}; + } } - } -} while( %tickets ); + } while( %tickets ); +} exit 0; @@ -357,20 +365,36 @@ Override the default C<hidden> notation. Set to 1 to keep the photo in global search results, 2 to hide from public earches. +=back + +Note that options unknown to Flickr will result in undefined behaviour. + =item --check Checks the authentication token via the flickr.auth.checkToken API call. This can be used to verify API keys and credentials without trying to upload an image. The output is the raw results of the API call. -=item --progress +=item --progress, --no-progress Display a progress bar for each upload with L<Term::ProgressBar>. That optional module will have to be installed on the system. -=back 4 +The default is not to display a progress bar. That can be changed in +the configuration file: -Note that options unknown to Flickr will result in undefined behaviour. + echo progress=1 >~/.flickrrc + +=item --report, --no-report + +Report the status of each upload ticket after uploading the batch via +L<Flickr::Upload's check_upload +method|Flickr::Upload/check_upload>. On by default. + +The default is to display a report after each upload. That can be +changed in the configuration file: + + echo progress=0 >~/.flickrrc =item --key <api_key> @@ -399,6 +423,8 @@ a while before it's actually available to users. L<flickr_upload> will wait around for that to complete, but be aware that delays of upwards of thirty minutes have (rarely) been know to occur. +=back + =head1 EXAMPLES First, you need to get an authentication token. This is a requirement @@ -443,10 +469,12 @@ your Flickr profile. You may want to do all that stuff in one place. Error handling could be better. -=head1 AUTHOR +=head1 AUTHORS Christophe Beauregard, L<[email protected]>. +E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason, <[email protected]>. + =head1 SEE ALSO L<flickr.com> -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libflickr-upload-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
