I have a lot of SmugMug albums and sometimes I have a hard time tracking down in which Category and SubCategory one resides or whether I've updated all the albums to use square thumbnails — thus was born smugfind.

I just released version 0.5 of pysmug which includes smugfind and some minor bug fixes. It's available here for download or through hg (courtesy freehg):

$ hg clone -r v0.5 http://freehg.org/u/bzimmer/pysmug/

To show help:

$ smugfind -h
Usage: smugfind [options]

Options:
  -h, --help            show this help message and exit
  -s, --sharegroups     display sharegroup
  -f FIELDS, --fields=FIELDS
                        list of fields to display for each entity
  -l, --list            available list of fields to display
  -p PREDICATE, --predicate=PREDICATE
                        predicate to evaluate

To see all the possible metadata fields:

$ smugfind -l | sort
(u'Backprinting', None)
(u'CanRank', None)
(u'Category', (u'id', u'Name'))

(u'X2Larges', None)
(u'X3Larges', None)
(u'XLarges', None)
(u'id', None)

To find the titles of all the public albums without square thumbnails:

$ smugfind -f Title -p "Public and not SquareThumbs" | sort
[('Title', u"Chinese New Year's Parade 2008")]
[('Title', u'Avalanche Awareness')]
[('Title', u'Battle of Port Gamble')]
[('Title', u'Beautiful Day Ride')]

The coolest feature, imho, is the ability to create arbitrary predicates to evaluate against an album's metadata to find out which public albums do indeed need their thumbnails updated. The predicate is any valid Python expression evaluated in the context of the album's metadata making for a very simple and powerful expression language.

Read more documentation on the use of smugfind here; other changes are listed in the ChangeLog.

Enjoy!

Categories: development 
Tags: hg  mercurial  pysmug  python  smugmug 
comments powered by Disqus