NAME Net::Flickr::Backup - OOP for backing up your Flickr photos locally SYNOPSIS use Net::Flickr::Backup; use Log::Dispatch::Screen; my $flickr = Net::Flickr::Backup->new($cfg); my $feedback = Log::Dispatch::Screen->new('name' => 'info', 'min_level' => 'info'); $flickr->log()->add($feedback); $flickr->backup(); DESCRIPTION OOP for backing up your Flickr photos locally. OPTIONS Options are passed to Net::Flickr::Backup using a Config::Simple object or a valid Config::Simple config file. Options are grouped by "block". flick * api_key String. *required* A valid Flickr API key. * api_secret String. *required* A valid Flickr Auth API secret key. * auth_token String. *required* A valid Flickr Auth API token. backup * photos_root String. *required* The root folder where you want photographs to be stored. Individual files are named using the following pattern : B/B/B/B
/B-B-B_B.jpg Where the various components are : * YYYYMMDD photo[@id=123]/dates/@taken * photo_id photo/@id * clean_title photo[@id=123]/title Unicode characters translated in to ASCII (using Text::Unidecode) and the entire string is stripped anything that is not an alphanumeric, underbar, dash or a square bracket. * size Net::Flickr::Backup will attempt to fetch not only the original file uploaded to Flickr but also, depending on your config options, the medium and square versions. Filenames will be modified as follows : * original The original photo you uploaded to the Flickr servers. No extension is added. * medium These photos are scaled to 500 pixels at the longest dimension. A _m extension is added. * square These photos are to cropped to 75 x 75 pixels at the center. A _s extension is added. * fetch_original Boolean. Retrieve the "original" version of a photo from the Flickr servers. Default is true. * fetch_medium Boolean. Retrieve the "medium" version of a photo from the Flickr servers; these photos have been scaled to 500 pixels at the longest dimension. Default is false. * fetch_square Boolean. Retrieve the "square" version of a photo from the Flickr servers; these photos have been cropped to 75 x 75 pixels at the center. Default is false. * scrub_backups Boolean. If true then, for each Flickr photo ID backed up, the library will check backup.photos_root for images (and metadata files) with a matching ID but a different name. Matches will be deleted. * force Boolean. Force a photograph to be backed up even if it has not changed. Default is false. rdf * do_dump Boolean. Generate an RDF description for each photograph. Descriptions are written to disk in separate files. Default is false. * rdfdump_root String. The path where RDF data dumps for a photo should be written. The default is the same path as backup.photos_root. File names are generated with the same pattern used to name photographs. * photos_alias String. If defined this string is applied as regular expression substitution to backup.photos_root. Default is to append the file:/ URI protocol to a path. search Any valid parameter that can be passed to the *flickr.photos.search* method except 'user_id' which is pre-filled with the user_id that corresponds to the flickr.auth_token token. PACKAGE METHODS __PACKAGE__->new($cfg) Returns a *Net::Flickr::Backup* object. PACKAGE METHODS YOU SHOULD CARE ABOUT $obj->backup() Returns true or false. PACKAGE METHODS YOU MAY CARE ABOUT $obj->backup_photo($id,$secret) Backup an individual photo. This method is called internally by *backup*. $obj->scrub() Returns true or false. $obj->namespaces() Returns a hash ref of the prefixes and namespaces used by *Net::Flickr::RDF* The default key/value pairs are : a http://www.w3.org/2000/10/annotation-ns acl http://www.w3.org/2001/02/acls# dc http://purl.org/dc/elements/1.1/ dcterms http://purl.org/dc/terms/ exif http://nwalsh.com/rdf/exif# exifi http://nwalsh.com/rdf/exif-intrinsic# flickr x-urn:flickr: foaf http://xmlns.com/foaf/0.1/# geo http://www.w3.org/2003/01/geo/wgs84_pos# i http://www.w3.org/2004/02/image-regions# rdf http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs http://www.w3.org/2000/01/rdf-schema# skos http://www.w3.org/2004/02/skos/core# *Net::Flickr::Backup* adds the following namespaces : computer x-urn:$OSNAME: (where $OSNAME is the value of the English.pm $OSNAME variable. $obj->namespace_prefix($uri) Return the namespace prefix for *$uri* $obj->uri_shortform($prefix,$name) Returns a string in the form of *prefix*:*property*. The property is the value of $name. The prefix passed may or may be the same as the prefix returned depending on whether or not the user has defined or redefined their own list of namespaces. The prefix passed to the method is assumed to be one of prefixes in the default list of namespaces. $obj->make_photo_triples(\%data) Returns an array ref of array refs of the meta data associated with a photo (*%data*). If any errors are unencounter an error is recorded via the log method and the method returns undef. $obj->namespace_prefix($uri) Return the namespace prefix for *$uri* $obj->uri_shortform($prefix,$name) Returns a string in the form of *prefix*:*property*. The property is the value of $name. The prefix passed may or may be the same as the prefix returned depending on whether or not the user has defined or redefined their own list of namespaces. The prefix passed to the method is assumed to be one of prefixes in the default list of namespaces. $obj->api_call(\%args) Valid args are : * method A string containing the name of the Flickr API method you are calling. * args A hash ref containing the key value pairs you are passing to *method* If the method encounters any errors calling the API, receives an API error or can not parse the response it will log an error event, via the log method, and return undef. Otherwise it will return a *XML::LibXML::Document* object (if XML::LibXML is installed) or a *XML::XPath* object. $obj->log() Returns a *Log::Dispatch* object. EXAMPLES CONFIG FILES This is an example of a Config::Simple file used to back up photos tagged with 'cameraphone' from Flickr [flickr] api_key=asd6234kjhdmbzcxi6e323 api_secret=s00p3rs3k3t auth_token=123-omgwtf4u [search] tags=cameraphone per_page=500 [backup] photos_root=/home/asc/photos scrub_backups=1 fetch_medium=1 fetch_square=1 force=0 [rdf] do_dump=1 rdfdump_root=/home/asc/photos RDF This is an example of an RDF dump for a photograph backed up from Flickr : 1250 336/100 960 4.5 mm visbility sRGB 2005:08:02 18:12:19 All rights reserved. 4321/1000 0.05 sec (263/5260) 2005-08-02T18:12:19-0700 2005-08-02T18:16:20-0700 High gain up 32 100/100 1280 2005:08:02 18:12:19 20050802(007).jpg f/3.2 public 468 141 22 26 *sigh* Square 75 75 357 193 81 28 eww! 4f6f211958d5217ef0d10f7f5cd9a69cd66f217e Karl Dubost karlcow 326 181 97 25 Did you see that this shirt makes me a beautiful breast? usa 9 205 145 55 Do you want my opinion? There's a love affair going on here  Anyway. Talking non sense. We all know Heather is committed to Flickr. She even only dresses at FlickrApparel. Did they say "No Logo". Doh Dude. Small 180 240 cameraphone Aaron Straup Cope asc 216d56f03517c68e527c5b970552a181980c4389 George Oates George 355 31 103 95 (Yes  I love you heather, you are my dream star) 2005-09-25T15:16:28Z 2005-09-25T15:16:28Z 184 164 50 50 Baaaaarp! 2005-09-25T15:16:28Z Thumbnail 75 100 433 103 50 50 (fuck  fuck ) 62bf10c8d5b56623226689b7be924c64dee5e94a heather powazek champ heather california Medium 375 500 202 224 50 50 dude! who did this? Original 960 1280 a4d1b5e38db5e2ed4f847f9f09fd51cf59bc0d3f Aaron straup 342 197 28 33 Is that just one big boob, or...? san francisco sanfrancisco VERSION 2.4 DATE $Date: 2005/12/18 04:18:35 $ AUTHOR Aaron Straup Cope SEE ALSO Net::Flickr::API Net::Flickr::RDF Config::Simple http://www.flickr.com/services/api/misc.userauth.html BUGS Please report all bugs via http://rt.cpan.org LICENSE Copyright (c) 2005 Aaron Straup Cope. All Rights Reserved. This is free software. You may redistribute it and/or modify it under the same terms as Perl itself.