simoncozens.github.io

Simon Cozens technical blog

Brownie

I’ve just uploaded to github my repository for Brownie, a tool to help find photos. I started working on this once Adobe switched off the map feature of Lightroom 5.

Quite often I open up Lightroom not necessarily to edit a photo but to use its database to try and find a photo that I know I’ve taken, given that I know where and/or when I took it. Some of my photos are in the Apple Photos app, not in Lightroom, so I often have to do it there instead. Now that Lightroom is less useful for this, I could import everything into Photos, but meh.

Instead, we load all the photos up from the filesystem, and hopefully do it so quickly that you don’t need a database to track the photos - the filesystem is a database.

It’s still at an early stage, but it already gives you:

  • Photos on a map.
  • Photos in a table.
  • Filtering photos by location.
  • Filtering photos by date.

It has several bugs:

  • You can’t remove date filters yet.
  • You can’t drill down to months and days yet.
  • Map annotations are messy and flickery.

On a technical note: This was my first time really mucking about with concurrency models. I first implemented the parallel photo reading code using OS X OperationQueues, but got into trouble with data races (of course). I tried to get out by adding more and more read-write locks, but it just increased the complexity. I then rethought my strategy after - I kid you not - coming up with a new concurrency model in a dream. Rather than multiple operations trying to add photos to the same store, I moved to multiple stores which gather periodically empty themselves into a main store. Writes are done with GCD barriers instead of locks, and it’s all a lot faster than it used to be.

Anyway, have a play, and maybe contribute back some improvements!

Written on March 14, 2019