I'm somewhat of a space geek, and like to know about what's headed into space. There's a great site called rocketlaunch.live that tracks as many launches as they can find out about.
The site is great, but a friend and I were talking about using Keyboard Maestro to parse their data into something that could be viewed with a couple keystrokes. My buddy found the JSON feed, and extracted a summary blurb about the next launch and used a "Display Text Briefly" to show the summary blurb:
That took a simple one-action Execute Shell Script (Display Text Briefly) action, although you had to have the
jq JSON decoder installed:
curl https://fdo.rocketlaunch.live/json/launches/next/1 | /full/path/to/jq -c --raw-output '.result | .launch_description'
And while that worked, I didn't like having to do the UTC conversion. I wondered if I could convert the UTC into my local time, and display that instead. One thing led to another, and eventually, the above simple one-action macro turned into something that generates this...
Now I can see that the SpaceX Falcon Heavy launches tonight at 5:14pm my time, as well as info on the next five launches in total, including launch location information. (Five is the limit for the free JSON feed.)
If you hover over any row and click, the selected launch's details (on rocketlaunch.live) will open in your browser. The macro also (optionally, on by default) compares the list it just created with the last list it created, and lets you know (via the obvious message in the lower right corner) if there were changes since the last time you looked.
So, yea, I did a bit more than just adjust the time zone …I guess I was having too much fun playing around with the JSON data.
The "tell me if anything has changed" feature is optional, as it does marginally slow down the macro: In my testing, using live data, the "don't tell me about changes" version runs in about 0.085 seconds. With the change tracking enabled, it takes 0.110 seconds.
For me, that slight delay is worth knowing whether there are new or changed launches on the schedule. If you'd rather not see this, all you have to do is change on variable from
FALSE (or anything else, actually). Instructions are in the macro.
The image above shows what it looks like when there are changes; here are the other two possible looks:
The macro grabs the data via JSON from rocketlaunch.live, then just basically creates the HTML formatted results by looping through each of the five items in the JSON data set.
The only real "work" that has to be done is to convert UTC to local time. (I also stick the URL into a variable with its associated HTML, just to make reading the HTML code a bit easier.)
The macro is quite basic, and you could do a lot more with it if you wanted to (reminder of an upcoming launch based on a time check?). But it serves as a nice overview of working with JSON data and creating a table-based HTML form using that data.
If you'd like to play around with the formatting or JSON stuff, please enable the included STATIC TEST DATA group and disable the LIVE DATA FEED group while testing—you don't need to hit their server with requests while testing things out. Once you have it working like you want, swap back to the live data feed.
This is definitely not a productivity-enhancing macro, but it does provide some interesting info if you like watching rocket launches. And from a macro perspective, it taught me a lot about working with JSON data, and how relatively easy it is once I got over the initial "huh, what is this stuff?" reaction.