1 | # +-----------------------------------------------------------------------+ |
---|
2 | # | pLoader - a Perl photo uploader for Piwigo | |
---|
3 | # +-----------------------------------------------------------------------+ |
---|
4 | # | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org | |
---|
5 | # +-----------------------------------------------------------------------+ |
---|
6 | # | This program is free software; you can redistribute it and/or modify | |
---|
7 | # | it under the terms of the GNU General Public License as published by | |
---|
8 | # | the Free Software Foundation | |
---|
9 | # | | |
---|
10 | # | This program is distributed in the hope that it will be useful, but | |
---|
11 | # | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
12 | # | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
13 | # | General Public License for more details. | |
---|
14 | # | | |
---|
15 | # | You should have received a copy of the GNU General Public License | |
---|
16 | # | along with this program; if not, write to the Free Software | |
---|
17 | # | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
18 | # | USA. | |
---|
19 | # +-----------------------------------------------------------------------+ |
---|
20 | package Uploader::PWG; |
---|
21 | use strict; |
---|
22 | use Data::Dumper; |
---|
23 | use Uploader::PWG::WebServices; |
---|
24 | use Uploader::PWG::Categories; |
---|
25 | use base qw/ |
---|
26 | Uploader::Object |
---|
27 | Class::Accessor::Fast |
---|
28 | Uploader::PWG::WebServices |
---|
29 | Uploader::PWG::Categories |
---|
30 | /; |
---|
31 | |
---|
32 | __PACKAGE__->mk_accessors( |
---|
33 | qw/ |
---|
34 | site_url |
---|
35 | site_username |
---|
36 | site_password |
---|
37 | http_username |
---|
38 | http_password |
---|
39 | branding |
---|
40 | use_offline |
---|
41 | version |
---|
42 | / |
---|
43 | ); |
---|
44 | |
---|
45 | $|=1; |
---|
46 | |
---|
47 | |
---|
48 | sub Init { |
---|
49 | my ( $self ) = @_; |
---|
50 | |
---|
51 | # for web services |
---|
52 | $self->SUPER::Init( $self->version ); |
---|
53 | |
---|
54 | if(!$self->use_offline){ |
---|
55 | $self->RefreshCategories; |
---|
56 | $self->RefreshTags; |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | sub RefreshCategories { |
---|
61 | my ( $self ) = @_; |
---|
62 | |
---|
63 | $self->categories( |
---|
64 | $self->prepare_items( |
---|
65 | $self->GetCategories |
---|
66 | ) |
---|
67 | ); |
---|
68 | } |
---|
69 | |
---|
70 | sub RefreshTags { |
---|
71 | my ( $self ) = @_; |
---|
72 | |
---|
73 | $self->tags( |
---|
74 | $self->GetTags |
---|
75 | ); |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | 1; |
---|