schussman.com logo

Sync Lightroom Galleries to Android - Automatically!

Now that I have a photogenic, tiny gurgling creature in the house, I’m shooting a lot of photos, both on the Droid X and the Pentax. Most of these photos end up, one way or another, in Lightroom for cataloguing, and as I’ve described earlier, I have a nice workflow for updating these rapidly-growing galleries on my iPad.

But how about the Droid X? It has a nice screen, and I want to foist photos of my beautiful boy on anyone I happen across — so I started to wonder if, continuing to use Lightroom as my core platform, I could keep a small gallery of photos on the Android phone with as little manual work as possible.

Here’s the executive summary: I again use a smart published collection in Lightroom to create the gallery; then I use a LaunchAgent in OS X to monitor the mount point of the Droid X on the filesystem; and a tiny shell script syncs the published gallery to the Droid whenever I plug it into the MacBook Pro. Read on for altogether too many details.

First, a couple of things to note about how the Droid X generates image galleries [ note that this may apply to all Android devices; I have no idea, and your mileage may vary ]:

  • Android automatically displays galleries based on image type — so you don’t need to update a database or anything to build your galleries on the phone. You just need folder(s) full of images.
  • When you run the Gallery app, it will display galleries with the name of the parent folder containing the images. This means you can make a folder tree on the Droid’s SD card and neatly package multiple gallery folders within it, without cluttering up your root directory.

Prepare the SD card

When I attach my Droid X via USB to the MacBook Pro, it automatically mounts it as a volume titled NO NAME, so I used the Finder to change the label to DROIDX. This, happily, seems not to have affected any of the phone’s operations; the Droid must not depend on the name of the SD card for any of its internal work.

The second preparation step is to create a master gallery directory on the SD card. This is just for housekeeping purposes; everything in the galleries will be in a subdirectory of that top-level directory. Again, I simply did this with the finder: navigate to the DROIDX drive when the phone is connected, and create a new top-level directory, Galleries.

Your SD card and Droid should now be ready to go.

Set up the Gallery/Galleries

Just like last time, I’m using smart publish collections, based on keywords, to populate the galleries that will be synced. I decided to prefix all the keywords for this usage with dx — so, dx-gallery is my main tag, and I’ve edited it in LR to not be included in export. It’s a housekeeping tag only.

I’ve tagged a bunch of images with the dx-gallery tag.

Then it’s off to build the publish service. Here’s what it looks like in the publishing manager:

And add to that service a Published Smart Set that looks like this:

You can assign multiple keywords to the Smart Set, or create as many smart sets as you want galleries, and use unique keywords to assign photos to each. Each smart set within the published collection will appear in your directory tree as a subdirectory of the top-level folder for the set — and that makes the syncing to the Droid easy.

Automate syncing via LaunchAgent

Everything I know about LaunchAgent I learned from this tutorial. This is basically a concise repeating of that description, edited for our purposes. (I’ve previously described using this process to perform system backups)

First, if it’s not already there, mkdir ~/Library/LaunchAgents. This is the folder that OS X will watch for scripts triggered by system events such as mounting an external drive, which is exactly what plugging in the Droid does.

In that directory, make a new plist file (I called mine droid-sync-watch.plist) and give paste this into it:

<?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN” \ “http://www.apple.com/DTDs/PropertyList-1.0.dtd”> <dict> <key>Label</key> <string>droid-sync</string> <key>LowPriorityIO</key> <true/> <key>Program</key> <string>/Users/alan/Library/Scripts/droid-sync</string> <key>ProgramArguments</key> <array> <string>droid-sync</string> </array> <key>WatchPaths</key> <array> <string>/Volumes</string> </array> </dict> </plist>

In short, this plist file tells the OS to run the identified script (~Library/Scripts/droid-sync) when the specified WatchPath changes.

The sync script itself lives in ~Library/Scrips and consists of a check against the desired volume (here’s where naming the Droid SD card comes in) and an rsync of the designated published collection to the previously-generated target directory on the SD card.

#!/bin/bash # delay a short time to make sure the path is available echo -n "[*]-- new /Volumes... sleeping" | logger sleep 20 if [ ! -e "/Volumes/DROIDX" ]; then       echo -n "[*]-- DROIDX NOT connected - Exiting" | logger       exit 0    else       echo -n "[*]-- DROIDX Connected - Performing gallery sync" | logger fi # rsync with delete option rsync --delete -r ~/Pictures/Exported\ Photos/Droid/ /Volumes/DROIDX/Galleries echo -n "[*]-- DROIDX gallery sync complete" | logger

Finally, tell the LaunchAgent controller to watch your scripts by doing the following at a terminal:

  • launchctl load ~/Library/LaunchAgents
  • launchctl list | grep sync

You should see your droid-sync script appear in the list produced by the second command, above.

Now you’re ready!

Plug in and go

That really should do it. When you connect the Droid X, you can watch the messages in the sync script appear in your console log, and everything should work — after syncing, disconnect the device again and fire up the gallery application; in the “Folders” section of the gallery you should see an item for each gallery you create in Lightroom. You’re done!

As with the iPad workflow, the great part of this is that once it’s set up, it’s pretty automatic. If you edit, add, or remove photos, as long as you republish the collection, those changes will all be pushed over to the Droid. Thanks to a little nerdery and Lightroom, we’ve built a bit of functionality that the Droid software doesn’t directly offer — and it’s still done with LR as the core of the photo library.

Replacing Edit in TextMate with QuickCursor

After upgrading to Snow Leopard on my MacBook, I found that the Edit in TextMate hook wasn’t working. There were a few threads about re-enabling it, but nothing definitive, and the support page suggests either running any target applications (those in which you want to use Edit in TextMate) in 32-bit mode, or perhaps trying some uninstall-reinstall voodoo. Since neither of these were ideal, I thought I’d try the “last-resort” suggestion, QuickCursor.

After a few minutes of use, QuickCursor seems to me to be a great improvement over Edit in TextMate — far from an “if everything fails” option, I prefer it for most of my uses.

  1. Installation is easy. Download, copy to Applications folder, and run it.
  2. Configure: I set it to load on bootup, and it automatically found TextMate as one of my editor options. I assigned TextMate the same keyboard shortcut that Edit in TextMate once occupied (cmd-ctrl-E).
  3. Use! From a Safari field, hit the shortcut and up pops a TextMate window; edit away, save, and your text appears in the Safari field. So far, just like Edit in TextMate, with the added bonus of being uncomplicated and functional in Snow Leopard. But here’s where it improves on the original: Edit in TextMate required the “target” window to be in focus in the target application; that is, when using Safari with multiple tabs open, the tab with the target “edit in” field had to be the active tab. This meant that if you opened an “edit in” TextMate window, then flipped through a few tabs to find something, you would have to relocate the target tab before being able to save from the TextMate window. QuickCursor doesn’t have this limitation: You can open multiple editing windows from multiple tabs, edit any/all of them, and save your edits without worrying about which application or tab is in the foreground. Bingo!

There are a couple of important caveats to QuickCursor that may make it not an ideal solution for some users (my bolds):

QuickCursor depends on two technolgies. For reading/writing data from the original application is uses the accessibility api. The nice thing about that API is that it’s not a hack, it’s a supported API. But unfortunatly not all views support the accessibility api (at least not read/write of the text content). And in particular webkit views don’t support it. And that means that tools that use webkit as their editor (such as Mail.app) won’t work with QuickCursor.

That means that Firefox doesn’t work with QuickCursor, either, since it doesn’t use the accessibility API. Since I’m a Safari user, and never much used Edit in TextMate for Mail, QuickCursor is pretty spot-on ideal for me.

MacHeist 3

The MacHeist 3 bundle is only available through April 7th, so if you’ve thought about it and haven’t made up your mind — or are just now hearing about it for the first time — well it’s time to decide.

This year’s MacHeist currently includes, for the low-low-edge-of-your-seat price of $39, OS X applications like Acorn (lightweight complement to PhotoShop, scriptable with Python, cool) and World of Goo. Total bundle value according to MacHeist is over $600.

So amble on over and check it out.

Good Apps: 1Password

1Password is a password manager for OSX that performs smart form completion in your web browser. In the not-quite-a-year since I bought it, I’ve used it, in one way or another, just about every day. To make a long story short, it’s made simple, easy work of everything I do that involves a web password, login, or account information. And in that year, the software has only become more capable, adding increasingly simple syncing and great support for iPod/iPhone.

In a nutshell, here’s what 1Password does: It pays attention to the web forms you fill out — the login at the power company, for example — and, if you give the word, saves the information you enter into that form to a password-protected keychain (it knows when you’re filling out a new form, and prompts you for the okay to save it). Later, when you return to that form, logging in is as simple as a quick tap of a keyboard command: hit cmd-\ and 1Password fills in and submits the form, and boom there you are looking at your power bill, without any looking up your account number or anything.

I’m not using the power bill example for nothing. Paying bills is where, for me, the huge payoff of this app is: By removing all the overhead of looking up logins (finding the last bill for the account number or something), 1Password has massively reduced the overhead of managing my bills. See, it doesn’t just save your logins, it keeps a list that helps you to manage them. From that list it’s two clicks to select and log in to any given form, so checking all my statements, bills, and accounts is a simple matter of scrolling through the list and opening up any accounts that I think I might need to check. To check my credit card, for example, I used to have to pull out the card and type in the number, which inevitably took place on a sunday morning in the wintertime when I’m wearing my slippers and it’s snowing. The mental process was something like, “where’s my wallet? Oh, the briefcase. Wait, it’s still in the car. And the car is in the driveway with six inches of snow on it. I’ll do that later.”

And now? I skim the list in 1Password, click the name and then click the web form login to check my balance, make a payment — for every single bill or account I have. It’s too easy, so I just check in that Verizon bill any time I wonder how I’m doing. And about every three weeks I just run down the list and check all the accounts that involve money. Honestly, it’s awesome.

And of course it handles all those logins for social networking, webmail, my usermin control panel, mailing lists, and so forth. In fact, I let 1Password store just about every single login I have; when it’s so easy to save with the app, why take up any mental space with keeping a login that might be a one-off, after all? And beyond passwords, it keeps all kinds of other information, making it able to smartly fill in things like credit card payment forms. Further, it saves other “wallet” items (like passport numbers) and “smart notes” (ssh passwords).

With the mobile 1Password app for iPhone/iPod Touch, all of this information is accessible on the go. Agile built a web browser that’s highly — but not perfectly — functional for most uses, and it lives inside the app where it accesses your login information directly. Previously, Agile had built a wonky workaround to make that information accessible via a Mobile Safari bookmarklet that synced via Safari bookmarks to the iPod/iPhone. I have to admit that I’m still pretty fond of this approach, and although 1Password doesn’t update the bookmarklet any longer (removed for security reasons?), they can pry that bookmarklet from my cold dead hands. For one thing, Wells Fargo doesn’t like their browser one bit, recommending that I install Safari for Panther instead.

Multiple Macs? 1Password can deal. Just sync your 1Password keychain (either the OSX keychain or the new “Agile Keychain” format) and you’re good to go. For the past ten months, I used Unison to handle this syncing, but just recently switched to Dropbox, and it works like a charm to keep everything updated on both my current machines.

Finally (I know, I know), the single time I’ve needed to contact the folks at Agile for some tech support, they were on the issue promptly and responded personally. Nice.

What doesn’t 1Password do? It’s a short list. Logins for some sites — for my account with ING, and my mortgage account, for example — just elude its ability to detect and autocomplete. So it’s not perfect on that score, but it’s awfully good. Update Oct 25: Thanks to Carl at Agile Web Solutions, I have an answer to at least one of those tricky sites. Thanks, Carl! And I would love if it were capable of filling in items in Terminal, like those ssh passwords, but I think the devs have wisely focused on making it speak smartly to web browsers instead of a longer list of apps.

So. 1Password is really, really good stuff. Check it out.

Kip/Yep PDF library

This is a pretty cool tool: Kip is basically a nice, iPhoto-like interface to a library of PDFs. It includes a tagging system and supports a scanner for adding all those bits of paper that you think you might want to keep but don’t want to put in a file box—So it could act like a sort of Delicious Library for receipts, correspondence, etc. Well, if I had a scanner. As an added bonus, it syncs with .Mac, too. That’s pretty cool. If it did BibTex—for instance, could read my BibDesk library—then it would be way cool.


(zooooomr)—You get a little preview window, with tags, when you mouseover a PDF.

Update: Kip is now called Yep, and will cost $50 when September rolls around.

Quicksilver's a gem

Did you know that any files you pull up in a Quicksilver window can be grabbed with the mouse and whipped into another window? Slick, and frequently quite a bit faster than either using the finder or tabbing through deeper Quicksilver windows to attach a file to email or move it around in the filesystem.


(zooomr)

Also, I linked this a few days back, but I continue to be more happy than I probably ought to be with the ability to make my Quicksilver bezel a nice blue color. So I thought I’d mention it again.

TextMate GTD

2010 update: Ever ready to tinker with organization schemes, I’ve done some adaptation of the Journal and Tasks bundles for TextMate to produce another, very very lightweight way to implement a Getting Things Done routine in Textmate. Check out the JournalTasks bundle if you’re so inclined.

—-

Haris Skiadas, who has made massive contributions to writing in LaTeX with TextMate (see for example his screencasts of good use of the LaTeX bundle), has put together a super TextMate GTD bundle. Haris has been hacking on it nearly-continously for several days — I confess to having harassed him significantly throughout development so far — and the bundle is a fully-capable GTD system: You can work with a single document, or as many as you want, can easily move projects around, add tasks, and add and modify contexts. The bundle has a number of commands to generate Next Actions lists, and it will archive completed tasks/projects to a separate log file.

Up until now, I’ve been using the Kinkless GTD system. Lately, however, that software began to feel a little cumbersome, a little too cognitively heavy and opaque. Since it lives in TextMate, Haris’s GTD bundle works with pure text, making highly extensible, and it works great (it even knows how to convert your Kinkless document to its own format). Today Haris capped it off with a script that filters an inbox (fed via Quicksilver) into your GTD documents. Seriously cool. I highly recommend giving it a try if you’re using either TextMate or GTD (or need an excuse to give either one a test drive).

Collective action and the MacZOT

MacZOT offers discounts on various Mac applications to limited numbers of purchsers, sometimes via bundles of secret applications for a reduced price. In doing so, they apparently generate enough buzz for themselves and the applications to make some money. Today, MacZOT is running their second BlogZOT—BlogZOT 2.0, as they like to call it. It’s kind of an interesting exercise in collective action. When a sufficient number of bloggers post about today’s offering—the mac editor SubEthaEdit from CodingMonkeys—then MacZOT drops the price from its discounted price to zero. Yes, zero. They’ll give away a limited number of licenses for nothing. Each blog entry drops the price by a nickel, until the price reaches zero, at which point MacZOT and TheCodingMonkeys will award $105,000 in software; that’s 3,000 free licenses to SubEthaEdit.

It’s kind of a neat gig, for a neat editor: I’ve tooled around with SubEthaEdit, and its neatest feature is its collaborative editing, which allows multiple users to simultaneously edit the same document, to compose meeting or conference notes, code in parallel, etc. If you’re looking for a neat text editor or are interested in how this kind of giveaway works, consider giving BLOGZOT 2.0 on MacZOT.com a try.

Jumping Ship: Moving from emacs to TextMate

Update: Not quite ready to give up all the nice authoring features of emacs, I built, with some tinkering, a reftex-style citation command for the TextMate/LaTeX bundle. It has since been incorporated into the main LaTeX bundle.

Update: The Sweave bundle is updated as of Oct 5 2006. Thanks to Haris for the contributions and improvements.


Yesterday I linked to a screencast that shows off some the neat things that one can do with the math bundle in TextMate. TextMate continues to get better, and it has become my primary editor on OSX. Kieran posted a comment about TextMate’s relative lack of functionality with regard to LaTeX and R:

I was looking into TextMate but its latex and R support is still fairly basic — there’s no real equivalent to auctex/reftex’s functionality, and the R bundle is rudimentary. This is a pity, as it seems like a really powerful environment, and for some time I’ve been looking for a way to escape from Emacs and use an OS X native, modern editor/IDE. Maybe soon.

Kieran is right in part: Auctex and Reftex are excellent additions to emacs and TextMate can’t yet match them. But it does offer some nice advantages over emacs, so I thought I’d write up a few thoughts on my transition to TextMate and the ways I’ve found to compensate for no longer having access to my beloved C-c C-c RET.

Why switch

OS X is a pleasant working environment, and even builds of emacs that are meant to fit nicely in that environment still don’t feel native. Aquamacs is one such attempt. For brand new users of emacs, Aquamacs may be a good tool, but for those of us with pre-existing byzantine .emacs files, Aquamcs adds a whole additional level of confusion by changing keybindings and introducing a whole new set of configuration options. Despite all the attempts to make it more modern, setting one’s typeface in the editor remains a frustrating exercise. My machine is relatively modern and speedy, and emacs still takes a good long time to load fully, even after pruning unnecessary cruft from my config file. And once loaded, there are just enough interface differences to be jarring: scroll bars, for example, are something that most emacs builds have never really sorted out. It’s 2006; can I please get a scroll bar that works the same way as every other scroll bar on my machine?

It’s not about bling, however. As projects such as my dissertation grew in size — multiple data, LaTeX, R, and Sweave files spread around the place — the organization of all that material started to occupy an increasing chunk of my cognitive space. “Where’s file goober, and how is it related to file data?” Although emacs handles lots of files just brilliantly, and switching between them is a snap if you’ve loaded the right iswitch-b package, it doesn’t help much with the organization end of things. That was my real original incentive to switch: I wanted my software to take a little of the load off of my brain, and perhaps to do it a little more quickly.

Finally, switching is a nice opportunity to review the way I get work done and think conscientiously about how to improve. On the flip side, it’s also a nice way to structurally procrastinate.

Why not switch?

Emacs is powerful. It can read email, browse the web, make a fully-functional wiki right on your desktop, and, on those occasions when appropriate, it can edit text files with championship ability. It is a mature working environment with brilliant integration with LaTeX, BibTeX, and R. Just using it can make one feel like a ninja, albeit a meek, deskbound one with rapidly deteriorating vision and nascent repetetive stress disorder in the wrists. As Kieran commented, nothing quite approaches the combination of AucTeX and RefTeX. I’m still reaching for those key-bindings that, alas, don’t work in TextMate no matter how many times I C-c [ them.

Built-in magic

TextMate immediately addressed my core reason to switch with its handling of projects. It has a project drawer into which you can simply drag files and folders, create separators, and arbitrarily organize them all. It seems like a small thing, but the ability to see all the files that comprise a project, and then navigate them easily, is something that’s a) really important in order to have a clear sense of what I’m working on, and b) remarkably difficult in emacs.

 


click-enlarge

 

Navigating those files is easy, as well: You can find and click in the project list, switch tabs with the keyboard, or hit cmd-T to bring up a file browser that finds files as you type: “cmt-T cl” narrows the list to those files that match the pattern “cl.” It pretty nicely approximates the autocompletion of switching buffers in emacs.

 

Many pieces loosely joined

TextMate is, like emacs, extensible almost to the point of absurdity. The architect of this extensibility built TextMate to hook into virtually any programming language, shell command, and external application. TextMate comes with built-in support for LaTeX and BibTeX compilation, as well as completing citations and labels within LaTeX documents. The latter function isn’t nearly as slick as using RefTeX, but it works fairly well. There are a few useful screencast demonstrations of those features. Haris, the author of those screencasts, has contributed tremendously to cite key and label completion — they work pretty well, thanks much to him.

I’ve made what I think are a few improvements to existing bundles in order to faciliate my own work: I’ve modified the LaTeX compile command to switch to xelatex if necessary, for example.

More in depth, but still fairly simple, is my rudimentary Sweave bundle for TextMate.1 TextMate allows one to set environment variables at the global or project level, so, for instance, I can assign a “master document” variable to my dissertation. This allows me to generate LaTeX output from a single in-process Sweave file, or, with an alternate command, to re-run the entire Sweave project through R and then begin LaTeX compilation. With the bundle TextMate (mostly; it’s still a work in progress) correctly parses Sweave files, allowing for context-sensitive actions depending on the position of the caret in a file: Within a Sweave document, I can generate LaTeX, compile that associated LaTeX file, send selected code to R, or build the entire master document. It works pretty slick now that it’s set up. Whereas in Emacs, the ties between various files was frequently opaque, I’ve found that keeping track of those relationships and compiling documents is more transparent and much easier.

Is it worth it?

For me, it has been worth it. The tinker to work ratio starts out pretty high, but that’s not unusual. Breaking emacs habits is tougher, even after four months, and I’d love a citation mode that works more akin to that found in RefTeX — the ability to invoke the command and then choose citation types, for example — and I still miss some of the enhancements from AucTeX; it trained me too well to C-c C-s to insert a section, for example. The ease with which one can build bundles and interface with external applications suggests that it won’t be long before someone may start building equivalent tools, and that will be a happy day.

In the meantime, TextMate is fast, allows me to visualize my projects, and works well enough with the other applications I use, as well as within my workflow, to justify the switch. It’s a good app, and it has improved my work.

Revise and extend (ie, updated)

I forgot to mention another issue about switching. Up until now, my tools have been almost entirely cross-platform for the past five or six years. TextMate is OS X-specific, so I can’t smoothly use the same set of tools on the Windows laptop like I could with emacs. This gives me some pause: It’s nice to have a mostly universal workflow, in which I could sit down at a PC, Mac, or linux machine, sync some files, and work. But over the past year with the iMac, I’ve picked up a few other non cross-platform tools: BibDesk is a great BibTeX manager, and I’ve been doing a ton of stuff using OmniOutliner Pro in the past handful of months, so switching away from emacs on one platform isn’t as much of a transition on that front as it might have been a year ago. Besides, the Mac is a nice platform to work on. And, hey, one of these days I’ll be able to trade up the Toshiba for a shiny new *Book of some kind.


1 The SWeave bundle is now distributed as a regular TextMate Bundle via the subversion bundle repository. [ return to text ]

Making iCal speedy again

Idiosyncratic technical note no. 4: Calendaring in molasses

For some reason, iCal recently slowed way down on me. Like “click and go make coffee while iCal finds focus” slow. I found a solution in the comments thread here and it seemed worth sharing.

  1. Quit iCal
  2. Find ~/Library/Application Support/iCal
  3. Move the entire “Sources” folder to the desktop
  4. Re-launch iCal. It will look horrifyingly empty for a few seconds, but will rebuild shortly, inserting all your previous tasks, schedules, subscribed calendars, etc.
  5. Take it for a spin; it should be much faster
  6. Trash the old Sources folder (note there’s a new shiny one in the directory)


About, the short version

I’m a sociologist-errant. This site is powered by Textpattern, TextDrive and the sociological imagination. For more about me and this site, see the long version.

Copyright and so forth: Commenters own their own posts, and linked or excerpted material is subject to whatever copyright covers the original. Everything else here is mine, rights reserved.

RSS feed