Creating an Online Life Timeline
Recently, I've been interested in building a timeline of my online life. Essentially, anything that "happens" to me, online, should be recorded by me somehow. For example: getting a new Twitter follower, scrobbling a track on Last.FM, etc. I have no specific plans for this data, other than to see what I was doing at some point down the road.
The initial version of this idea involved just posting these to Google Calendar as a quick event. It's difficult to write any kind of report against this though, so while I've left them running to post that data, that's no longer the primary concern.
I started out by creating a PHP page that would accept data, and stuff it into a MySQL database. I looked to see if IFTTT could handle submitting to a URL. It cannot. I thought about maybe using Tarpipe to take the email and submit to my URL. Tarpipe though, while an interesting idea, is still in it's infancy as far as usability is concerned.
I determined that email would probably be the only real way to go. So I set up IFTTT to send an email on certain triggers (like the Last.FM example above). I just had to figure out how to trigger a script to run whenever an email came in.
As an aside, getting a script to run was much easier than I thought. Just make sure incoming messages go to a system user in postfix (anyone who has a shell account is a valid system user) @localhost
, and set up their .forward to pipe to your script, and you're done. Like I said, much easier than I thought.
Now that my script is running, I just have to regex match against the subject line of the email to determine what to do with it. A check like if ($subject =~ /^(Last\.FM) - (Scrobbled):(.*?) - (.*)$/) {
pulls in that this is a Last.FM Scrobble, with the Artist and Title as well. A simple insert into our table, and we have the beginnings of a timeline of events.
One unfortunate downside to this is that IFTTT doesn't include the actual time that something happened, and by virtue of only running every 15-20 minutes, you'll get a cluster of events happening nearly simultaneously. If I really needed down to the second timing, that might be a problem. It's a minor annoyance, but one I'll live with, since I don't want to write all of the API scripts and screenscraping scripts necessary to make this whole thing work.