Automatically starting when Lightroom starts - and with a snazzy countdown too!
This should never happen again
The plugin, loaded and working in Lightroom
My photos make up the majority of the irreplaceable files that I have, and they're the hardest to backup. There's too many to fit in Dropbox, and backing them up online is a slow and tedious thing. To protect them, I have automated backups of my photos and thought that was enough.
Then, out of the blue, Lightroom just outright refused to work with one of my photos. As I tried more photos, Lightroom just continued giving me errors. Clearly, my hard drive was dying, but I was fine, I had backups.
Except some of the restored photos still didn't work. Clearly my backup was backing up bad files, and had been for a while. It was only luck that I had a much older backup that still had uncorrupted files.
What I needed was a tool that would run automatically, and let me know if anything happened to my files before they become irrecoverable.
What it does
Most files don't change all that often. The plugin takes advantage of that by taking an initial hash of the file, and then periodically rehashing the file, and making sure it still matches.
How I built it
As it was going to be part of Lightroom, I had to use the Lightroom API. I started with a general idea of what I wanted the plugin to look like, and iterated on it as I hit certain milestones.
It was a lot of trial and error - for example, I first had to test the hashing function, to make sure the output matched a reference tool. Next was using the API to associate the hash with the file in a permanent manner. Then being able to batch retrieve that value for multiple images. There was always a next step to do, so I never ran out of things to add - only time to do it in.
Challenges I ran into
The primary problem was that the tools just aren't present. Lightroom uses a customized version of Lua with fun things like seemingly non-deterministic sorts.
Additionally, some things I wanted to do with Lightroom just weren't documented - like the actual hashing algorithm. I ended up using an API method that had been around for the last 3 versions of Lightroom, but undocumented
Accomplishments that I'm proud of
This is one of the few plugins that I know about that can run tasks automatically whenever Lightroom starts up. That alone is pretty significant in my book.
I also got to learn for more about how to do actions in Lua - things like iterating over lists of files.
Finally, I ran the plugin against all my images, and I can now sleep somewhat better knowing I have a way to protect them.
What I learned
A whole bunch about Lua, Lightroom, and the fact that even if the official API doesn't allow you to do certain tasks, chances are you can work around it in a manner that ends up being somewhat more elegant.
What's next for Lightroom Verifier
Releasing it to the world after writing some documentation.