Package: pypu
=====================pypu - python pusher=====================See github repository: http://github.com/esterhui/pypuThis command line interface (CLI) tool provides an easy way to manage photoalbums and wordpress blogs. It currently has interface to flickr, facebook, andwordpress.The philosophy is to make this software similar to svn or git, where oneadds/removes media files locally, then does a 'push' to synchronize withremote server, where this 'server' is facebook, flickr, wordpress.This software can be interfaced easily with an image program like 'feh' tographically add photos to flickr/facebook.Install=======Easiest is to do a pip install::pip install pypuThe script 'pypu' should be installed in /usr/bin or similar location.Dependencies============These dependencies should be pulled in when installing pypu- facebook_sdk- flickrapi- wordpress_xmlrpc- pygeocoder- exifread- PIL ('pillow' package in gentoo)GExiv2 - For rewriting exif information after image resize----------------------------------------------------------Note, there is no pip install for this package, you must installthe proper libexiv2 library. See this page for details: http://goo.gl/0bhDGxOn **gentoo** Linux, emerge media-libs/gexiv2 with the *introspection* USE flag.If this isn't installed, images will not be resized, original version willbe uploadedWebsite=======http://github.com/esterhui/pypuAuthentication==============The pypu app is registered with both facebook and flickr. Before pypu canaccess your photo albums, you need to authorize the app to do so. The veryfirst time a facebook or flickr login is required, the script will open a tab inyour browser, and interact with either facebook or flickr to grant thispermission.- Facebook grants a 2 month token, thus this process only needs to be performed every two monthsIf you want to change who can see pypu posts, change privacy settings here:https://www.facebook.com/settings/?tab=applications- Flickr grants a authorization token until it is revoked by the userExample Usage - Adding an album===============================Let's say you want to add a few photos to flickr:::> cd samples/> lslocation.txt  megapixels.txt  sets.txt  sl.jpg  sl2.jpg  tags.txtThe jpegs can be added to flickr, while the \*.txt files are used for metadata. Pusher will only add files to the repository that it knowns how to handle,let's try adding this whole directory::> pypu -sflickr add *A location.txt (flickr[A])A megapixels_flickr.txt (flickr[A])A sets.txt (flickr[A])A sl.jpg (flickr[A])A sl2.jpg (flickr[A])A tags.txt (flickr[A])Here we tell pusher to add all the files to the service flickr. If -s option wasnot given, all services that manage these files will try to handle them, eg.the \*.jpg files will also be managed by the facebook service.NOTE: Currently you need to open service_flickr.py and modify 'myid' to point toyour flickr username or whatnot.Now, let's actually push this stuff to flickr (upload to flickr):::> pypu push .sl.jpg - Uploading to flickr, tags["slow loris" "funny animal" "test"] size=0.5 MPsl2.jpg - Uploading to flickr, tags["slow loris" "funny animal" "test"] size=0.5 MPlocation.txt - Updating geotag informationmegapixels_flickr.txt - Updating photo sizesets.txt - Updating setstags.txt - Updating tagsS location.txt (flickr[S])S megapixels_flickr.txt (flickr[S])S sets.txt (flickr[S])S sl.jpg (flickr[S])S sl2.jpg (flickr[S])S tags.txt (flickr[S])The 'S' indicates that the data has been synchronized with the service (flickr). Thetxt files only contain meta data and is used to update things like the 'photosets' the jpegs belong to, geotagging information (if no lat/lon in EXIF).The current sets.txt looks like this:::> cat sets.txtSlow loris album, test albumWe actually don't want it in the test album, so let's modify sets.txt to looklike this:::> cat sets.txtSlow loris albumNow, if you ask pusher to look at the status of the files, it will notice themd5 checksum of the file has changed (as well as the modification time):::> pypu st .S location.txt (flickr[S])S megapixels_flickr.txt (flickr[S])M sets.txt (flickr[M])S sl.jpg (flickr[M])S sl2.jpg (flickr[S])S tags.txt (flickr[S])Notice how sets.txt has a 'M' flag, indicating it has been modified and needs tobe re-synchronized. Tell pusher to update photo albums (sets):::> pypu push .sets.txt - Updating setsS sets.txt (flickr[S])All photo sets are now updated on flickr. Any of the other meta files (\*.txt)can be modified in this fashion and pusher will correctly handle the change ofmeta data.Example Usage - Deleting album===============================Ok, let's clean up this test album. Do this by removing all files from pusher.::> pypu rm *D location.txt (flickr[D])D megapixels_flickr.txt (flickr[D])D sets.txt (flickr[D])D sl.jpg (flickr[D])D sl2.jpg (flickr[D])D tags.txt (flickr[D])This instructs pusher to issue a delete action to all services managing thefiles.  In this current setup this will ask flickr to remove these files.Now issue a push command to actually apply the action:::> pypu push .sl.jpg - Deleting from flickr [local copy intact]sl2.jpg - Deleting from flickr [local copy intact]? location.txt? megapixels_flickr.txt? sets.txt? sl.jpg? sl2.jpg? tags.txtNotice how the two jpeg files have been removed from the flickralbum as well as all meta files.Supported services==================To print out all supported services, type::pypu services listCurrently this script supports uploading/deleting stuff via:- Facebook (fb)- Flickr (flickr)- Wordpress (wp)Config files============location.txt [flickr]The location of the all media files in this directory. This location isonly used when jpg file has no GPS data in the EXIF. Location is a stringyou would type into google maps eg::Holcomb Valley Campground, CaliforniaPusher uses google geo-coding to look up a lat/lon coordinate forthe given name. This lat/lon is then associated with all photosnot geotagged via EXIF.megapixels_flickr.txt [flickr] megapixels_fb [fb]The megapixels files (megapixel_flickr.txt for flickr and megapixel_fb.txtfor facebook) is used to resize images to the specified megapixels.If the image is smaller than the specified megapixels, original imagesize will be used. To resize to 2.0 megapixels, this file will contain::2.0sets.txt [flickr,fb]Only the first line is read, it's a comma separated list of photosets the photos belong to. For flickr one photo can belong to many photo sets,for facebook, only the first set is used as the facebook album name. Here isan example of two photo sets::South Africa, traveltags.txt [flickr]Flickr supports adding text tags to photos. This file should contain acomma separated list of tags to apply to all photos in this directory::south africa, pretoria, hatfield.title [flickr,fb]If jpeg has corresponding .title file, will use text in file asthe title. For instance if your image is loris.jpg, thenloris.jpg.title will be read for the title.feh interfacing===============Feh allows one to run scripts on the current image being viewed (like adding the image to flickr), and even read data from stdin to display on the image. We can take advantage of this to seamlessly integrate feh and pusher::alias f='feh -B black --draw-tinted --draw-exif -G -P -Z -g 1366x768 -d -S filename --info "image-pusher.sh show %F" --action "pypu add %F" --action4 "pypu rm %F" --action1 ";image-pusher.sh edit-title %F"'Now one can browse images with 'f \*.jpg' and use:- **Enter** : To add a picture to flickr and facebook- **1** : To add a title to the image- **4** : To remove image from servicesMake sure scripts/image-pusher.sh is in the search path. The verybottom line in feh also shows the current status of the file as viewedby pusher. Eg, you will see text on the image::A sl.jpg (fb[A] flickr[A])This indicates this image will be added to both flickr and facebook. Remember to do a pypu push sl.jpg to actually sync this image with services.Here is an example screenshot:.. image:: docs/feh_pusher.pngFlickr album on google maps===========================Use *build_json_from_flickr.py* to generate maps like http://gps.pythion.comTIPS=====- To rename all files by exif date, use exiv2 utility::exiv2 rename *.JPGTODO=====- Add support for:- youtube- google+- Add wordpress documentation- Read flickr user name from config file- Explain how scripts/build_json_from_flickr.py works- Add something like *pypu flickr init* to generate skeleton metadata files- Document how to add new services- Progress bar for large files- Add N/M photos uploaded- Supress exif warnings (enable with flag)