When we started planning for our cycle tour I began to think about how we would record and publish details of our adventures. I wanted a solution that would allow us to compile our blog posts and website updates while offline and then with very few actions publish the changes when we reached our next access point.
My key requirements for the solution were:
– Ideally it should be free
– Ability to upload photos to Flickr
– Ability to tweet about new blog posts
– Ability to record bespoke statistics like distance travelled, GPS co-ordinates, weather etc.
– Ability to easily maintain and develop offline ideally the solution should be PHP and/or .Net based
Ideally all of this data should be tied together to provide a rich view of our trip. So the search began, as is usual with me, not for the perfect software but for something to act as the “glue” between the requirements.
Windows Live Writer
Reading around online I quickly found that there was less software available than I had expected (testament to the constantly connected world in which we live). One article I found here listed a few options with some useful comments on pros and cons of each type of software. I quickly identified that Windows Live Writer (WLW) met a few of my key requirements:
– It was free and in fact I already had it installed
– It was extensible using programming skills I already had (.Net)
– Additionally it was still under development and had a recent release along with a community (all be it a small one) of people actively producing plug-ins
Having settled on the software my next stop was to start learning a bit about how WLW plug-ins are constructed. Finding this interview with Charles Teague the lead WLW developer was a great start as he demos a basic plug-in example and talks about the overall framework WLW provides for offline blogging. I found the Twitter Notify plug-in that was perfect for my requirement to add a tweet whenever I posted a new blog entry. I was now left with my requirements for Flickr uploading and bespoke statistics
Browsing through the available plug-ins for WLW I discovered Flickr Upload which seemed perfect for what I was after except that it required an active connection before the plug-in would initialise. As I ideally wanted to be able to build my whole post offline this wasn’t quite what I was after and I decided to write a new version.
My version scans the post code before submitting to locate any images, then for each image it displayed a dialogue (title, description etc), uploaded to Flickr and my intention was to replace the original post image tag with the new Flickr upload location. Unfortunately due to the fact that the PostInfo.Contents property was read only I was unable to update the post content with the new Flickr locations. Undaunted I considered my work not bad as a first stab at a WLW plug-in. I then came across the Flickr Uploadr tool and realised it suited my purpose far better than the plug-in I was working on. I could use the Uploadr to organise and tag my images while offline then upload them when I was connected and use the regular image insert function in WLW to add them my pre-written post.
Having cut my teeth on messing around with Flickr I moved onto my next challenge to pass statistics with my blog posts. To do this I created a new plug-in that used simple REST to retrieve options and submit values via a PublishNotificationHook when a blog entry is submitted. The statistics are entered into the post using a SmartContentSource that also allows for a contextual menu for any further updates.
To provide access to the contextual menu the statistics are shown in the blog within WLW but are not actually included in the published HTML. So if you want to update or amend any statistics then you just select the statistics and use the context menu.
When the post is submitted my plug-in is called and an XML message is sent to my PHP code containing the relevant statistics. The PHP code then stores the blog details and statistics into a database structure that is based upon the statistics schema for the Going Slowly site that Tyler very kindly sent to me.
What I have ended up with is a nicely tailored solution to allow me to build all of my blog posts offline including the association of statistics with each post. When I find an internet connection I can then upload my photos to Flickr, add them to the blog post in WLW, submit the post enter my Twitter message and job is done. I have been working this way for the last few weeks tweaking things here and there before we hit the road and have so far found it works fine.
I haven’t included any code in this post as there are plenty of samples at the locations below, however if you would like a copy of the .Net and/or the PHP code then just let me know and I’m happy to email it out.