aboutsummaryrefslogtreecommitdiffstats
path: root/tools/piwigo_remote.pl
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2009-06-24 23:01:35 +0000
committerplegall <plg@piwigo.org>2009-06-24 23:01:35 +0000
commit9b16d67c225eac910104f3a9e197c28f3fd08785 (patch)
treea1d5d6937fedeaf647015824eec4bf0db510084d /tools/piwigo_remote.pl
parented7f7a574eeb9b921d4b85c6e8607faac4971a47 (diff)
merge r3453 from branch 2.0 to trunk
feature 1033 added: new API method pwg.categories.setInfo makes possible to change the name and comment of a given category. git-svn-id: http://piwigo.org/svn/trunk@3454 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'tools/piwigo_remote.pl')
-rw-r--r--tools/piwigo_remote.pl30
1 files changed, 24 insertions, 6 deletions
diff --git a/tools/piwigo_remote.pl b/tools/piwigo_remote.pl
index 32ecbf030..ceb2af4b9 100644
--- a/tools/piwigo_remote.pl
+++ b/tools/piwigo_remote.pl
@@ -24,19 +24,37 @@ use POSIX qw(ceil floor);
my %opt = ();
GetOptions(
\%opt,
- qw/action=s file=s thumbnail=s high=s original=s categories=s chunk_size=i define=s%/
+ qw/
+ action=s
+ file=s
+ thumbnail=s
+ high=s
+ original=s
+ categories=s
+ chunk_size=i
+ base_url=s
+ username=s
+ password=s
+ define=s%
+ /
);
our $ua = LWP::UserAgent->new;
$ua->cookie_jar({});
my %conf;
-$conf{base_url} = 'http://localhost/piwigo/2.0';
$conf{response_format} = 'json';
-$conf{username} = 'plg';
-$conf{password} = 'plg';
$conf{limit} = 10;
-$conf{chunk_size} = defined $opt{chunk_size} ? $opt{chunk_size} : 500_000;
+
+my %conf_default = (
+ base_url => 'http://localhost/piwigo/2.0',
+ username => 'plg',
+ password => 'plg',
+ chunk_size => 500_000,
+);
+foreach my $conf_key (keys %conf_default) {
+ $conf{$conf_key} = defined $opt{$conf_key} ? $opt{$conf_key} : $conf_default{$conf_key}
+}
my $result = undef;
my $query = undef;
@@ -216,7 +234,7 @@ if ($opt{action} eq 'pwg.images.exist') {
# print Dumper($response);
}
-if ($opt{action} eq 'pwg.images.setInfo') {
+if ($opt{action} eq 'pwg.images.setInfo' or $opt{action} eq 'pwg.categories.setInfo') {
$form = {
method => $opt{action},
};