Introducing PinboardDigest
PinboardDigest is a small OSX System Service intended to take a lot of the drudgery out of producing roundups of links, such as posts like my Around the Web roundup earlier this week.
Essentially, it allows me to feed links into Pinboard through the week and tag them with “blog_roundup”.
When it comes time to write the roundup, I open up Byword (my writing editor of choice) and hit this Service to pull down the 10 most-recent Pinboard bookmarks with that tag in my account, convert them into a Markdown formatted list and stick them right where my cursor is in the document.
I wrote this primarily because producing those sort of posts before was a pain in the ass: I’d gather links over days or weeks and stick them in Pinboard, and then need to head into Pinboard and do all the aforementioned by hand. If I know anything about myself, it’s that any amount of friction to producing something means I’m less likely to do it.
Features
- The Service is available in every OSX application. It works (or is intended to work) anywhere you have a cursor in a text box.
- Can pull from 0-3 tags with each pull. So, you can pull from none to get just your 10 most recent bookmarks, or combine a few of them.
Installation
Dependency: To decode the response from the Pinboard API, this workflow relies on the json
gem, so you’ll need to install that if you haven’t already.
Of note, you’ll need to have the XCode Command Line Tools installed to do this.
Open a Terminal window, and type:
sudo gem install json
And you should be good to go. If you’re a Ruby developer using rvm or rbenv, make sure you install json
in the system Ruby, since the Service uses /usr/bin/ruby
.
On with the show:
- Download the workflow file.
- Double-click the zip file you just downloaded to extract the
.workflow
file. - Place that workflow file in
HOME/Library/Services
(or just double click it). It should become available immediately.
Configuration
You first will need to give the script your Pinboard auth token. Once you have that, open the Service in Automator (by double-clicking the file in the aforementioned HOME/Library/Services
folder).
In the second step of the workflow (“Run a Shell Script”), you should see a line that reads:
AUTH_TOKEN = "YOUR\_AUTH\_CODE\_GOES\_HERE"
Put your Pinboard auth token in between the quotes, save and close the file.
If 10 bookmarks at a time is not your style, you can also adjust the number of links the Service pulls on the next line.
Usage
In your editor of choice (or a web form, or whatever), put your cursor where you’d like your digest to start (I’m usually starting from a fresh document, but your mileage may vary and PinboardDigest don’t care).
In the app menu (upper left), you should see a Services item. Inside that, you should find PinboardDigest.
Click that and it asks you for any tags you’d like it to pull and then whisks off to fetch them for you and format everything up nice and neat.
Caveats and Miscellany
- The guts of this Service are written in Ruby and are available as a gist.
- To enable the Service to work with almost any app that has a text field and a cursor, it uses the system clipboard to move some of the text around. Obviously, any text you have in your clipboard when it starts is going to get wiped out.
- Taking a moment to give a big thank you to Brett Terpstra, Dr. Drang and others for the inspiration.
ToDos
- The Service doesn’t really have any error handling to speak of at the moment.
- The clipboard bit I mentioned above feels like a kludge, so I’m open to suggestion if anyone has better ideas.