Following twitter hashtags on TV

April 6th, 2010

DSC06104As a lot of other people, I’m watching the debate of the Digital Economy Bill on BBC Parliament tonight. I’m also trying to follow along with some of the #debill back-channel on twitter.

With such a heated and interesting commentary on twitter, it reminded me of Roo’s “Second screen” idea of having tweets with a specific hashtag next to the TV during live TV events, when following the twitter backchannel during ‘The Apprentice’.

Unfortunately, I don’t have a spare laptop kicking around to show tweets on. But I do have a hackable TV. 🙂

With that in mind, in just a few minutes I hacked together the following script to flash up tweets with the #debill tag on the TV:

# run me using:
#       python twittertv.py debill 1

import twython
import subprocess
import sys
from time import sleep

twitterKeyword = sys.argv[1]
twitterSearchRateLimitMins = int(sys.argv[2])

twitter = twython.core.setup()

showOnTVCommand = ['svdrpsend', 'mesg', 'messagetodisplay']

lasttweetid = 1

while True:
    search_results = twitter.searchTwitter(twitterKeyword, since_id=lasttweetid, show_user=True)

    numtweets = len(search_results["results"])
    for tweetnum in reversed(range(0, numtweets)):
        lasttweetid = search_results["results"][tweetnum]["id"]

        user = search_results["results"][tweetnum]["from_user"]
        tweet = search_results["results"][tweetnum]["text"]
        showOnTVCommand[2] = user + " : " + tweet

        subprocess.Popen(showOnTVCommand)
        sleep(20)

    sleep(twitterSearchRateLimitMins * 60)

DSC06127

It’s a quick-and-dirty hack, but I wanted to get something that would work before the debate was finished. 🙂

And it seems to do the trick.

The Third Sector & The Next Government

March 30th, 2010

Charity and politics are often closely linked. Not least because the Government is a huge funder of charities.

I don’t need to go far to find an example. Look at the finances of my charity, Solent Youth Action. Our single biggest funder by far, was started by, and receives a lot of funding from, central Government. Even a lot of our other funders, whether local councils or NHS trusts, are influenced by central government policy.

The point is, as a charity our future can be affected by politics. And with an election coming up, it’s a particularly popular time to look ahead and wonder about what politicians might decide to do in relation to the “Third Sector“.

To help with this, Community Action Hampshire and the SCA Institute of Social Enterprise organised an event on the 12th March for charity directors and trustees to hear directly from the three main political parties on “The Third Sector and the Next Government”.

The format was pretty straightforward. Three MPs – one from Labour, one from the Conservatives and one Liberal Democrat – were each given time to make a short speech, followed by time for Q&A. Once they all had a turn, there was a general Q&A for the three of them as a panel.

I enjoyed the event, and thought it might be interesting to share some of what I heard.

Read the rest of this entry »

Why I haven’t written TwitToday for Android

February 25th, 2010

(or “looking at the limitations of the Android home screen widgets framework”)

Twitter client for Windows MobileA couple of years ago, I wrote a Windows Mobile app called TwitToday : a Twitter widget for the “Today screen” (the default screen when the phone is on, with all apps closed or minimised).

The rationale was that it was useful to have a way to post a tweet quickly when you don’t want to have to wait for a full-blown client to start.

Or if you don’t want to incur the battery or memory cost of leaving a client running all the time.


A widget that doesn't work on AndroidAndroid has a “Home screen”, which is similar to the Today screen on Windows Mobile. And it has support for widgets. This led several people to ask me why I never ported TwitToday to Android.

The short answer is that I did try, but the current state of the widgets framework made it impossible.

I tried to write a TwitToday widget back when the Android widgets framework was first introduced in Android 1.5.

It all started quite well:

  1. I wrote the Android Service that would carry out the background task of posting a tweet. No problems there – it worked fine.
  2. I wrote the widget XML to define the GUI. This is what you can see running in the screenshot. And it works… sort of. It has a text box that you can type up to 140 characters into. And if you press the button, it causes a chunk of code to get invoked.

The problem came when I tried to link the two together: to get the Service that posts tweets to obtain the String from the text box in my widget.

This isn’t possible. Android’s widget framework as it currently stands is geared around displaying information to the user, not collecting user input.

Read the rest of this entry »

Using my mobile as a TV remote control for vdr

February 22nd, 2010

remote controlsI can never find the TV remote.

Whether it’s slipped somewhere in or under the sofa, or been hidden by the kids, I’m often at a loss to find it.

A mobile phone, on the other hand, is rarely too far from my hand 🙂

So I’ve hacked together a quick app to put a TV remote control interface on my phone. It’s definitely a quick-and-dirty chunk of code, but it does now mean that I can work my TV from my mobile if I can’t find the real remote.

On the off-chance that this is useful to other vdr users, I wanted to share how I did it.

Read the rest of this entry »

What do I do at work?

February 21st, 2010

I’ve been an Emerging Technologies Specialist for about a year and a half now. As I mentioned when I got the job, I don’t know of anywhere that I can point people at that explains what my team do.

I’ve been wary of filling this gap myself, partly because the work that the team does is so diverse that I’m not going to do us justice. But, allowing for the fact that I’ll miss a ton of cool stuff that my colleagues do, I figure that I should try and describe what I do.

I work in the Emerging Technology Services team.

How to explain this?

Read the rest of this entry »

Why I use vdr for TV

February 11th, 2010

Both here and on twitter, I’ve mentioned a few of the things I’ve done with my vdr-based media computer. In this post, I want to quickly take a step back and explain what made me go for this setup in the first place.

By way of quick background, we’ve now got an Asrock Ion 330 living under the TV as a set-top box, connected to the TV via an HDMI cable, and receiving a digital freeview signal over USB from the twin tuners in a Sony Play-TV. It’s quiet, has reasonably low power requirements, is small and pretty, can be controlled by a remote control using a small infra-red receiver plugged into a USB port, and has plenty of storage between it’s own hard-drive and the 500 GB on the Western Digital My Book attached over USB.

This isn’t a “why I use vdr instead of MythTV (or any other open-source HTPC software” post. Mainly because I don’t know enough about the alternatives to talk about them intelligently.

Instead, I wanted to explain why I went for setting up a Linux computer with a TV card instead of just buying another set-top box appliance when ours died last year. It’s not as simple (set-top boxes pretty much set themselves up nowadays) and certainly wasn’t cheaper (largely because I was starting from scratch – if I already had a server to use, that’d be different). So what was the incentive?

Read the rest of this entry »

Book review: Matplotlib for Python Developers

February 11th, 2010

Matplotlib for Python Developers, Sandro Tosi

Let me get the boring disclaimer-y bit out of the way first: I didn’t buy this book – Packt Publishing sent me a free copy in return for me writing a review of it. They’ve not made any specific requests about the contents of my review, just that I should write a review. And, in fact, I should give them props for not hassling me for not getting around to writing this until now – about eight weeks after they sent it. So either they forgot they sent it to me, or they are terribly patient. I’m choosing to assume it’s the latter 🙂

With that out of the way… matplotlib is a graphing library. I’ve used it a lot for my CurrentCost energy monitoring app – all of the graphs in the app are created using matplotlib. And while it is very powerful, it can be a little tricky to get your head around. I still struggle with getting the graphs exactly how I want them even now.

That was why I agreed to do this review – I liked the sound of the book and thought it’d be useful for me.

Overall, it’s a really good book. It starts off going through all the basics, both in terms of explaining the ideas and concepts, and in the practical steps needed to get set up. I’m not normally a big fan of reading text books, preferring to figure stuff out for myself as I go along, but found that even here I picked up tips that I never knew and subtle features that I’d missed.

A nice flow-chart kicks off the detail into producing different types of graphs and chart. It starts from asking “What would you like to show?” (e.g. comparison; distribution; composition; relationship; etc.).

Following this through for what you want to show, and what type of data you have, leads you to a suggestion for the type of graph that is most appropriate for your needs (e.g. line histogram; waterfall chart; pie chart; stacked column chart; scatter chart; etc.). For someone like me who doesn’t have the world’s strongest maths background, this was a really useful guide.

Read the rest of this entry »

last.fm for television

January 6th, 2010

One of the social network sites I’ve been using the longest is last.fm.

(If you know what last.fm is, bear with me teaching you to suck eggs for a few paragraphs… it gets more interesting – honest!)

The idea of last.fm is that a background service captures (or “scrobbles“) the music that I listen to on my computer at home, on the mp3 player that I use in the car, and on my laptop in the office.

This means that I now have a large record detailing the music I’ve listened to over the last three years.

I do this for a few reasons, including:

  • The data is made available to me through a rich API, which means I’m free to play with it, as well as take advantage of the creations of others, such as the wonderful visualisations generated by lastgraph
  • I can see what my friends listen to, which is interesting, as well as being a good way to come across new music
  • last.fm use this detailed history of my music-listening tastes to make automated recommendations of other music that I might like

This is all a long-winded way of saying that I like last.fm. I find it useful and interesting, and want the same for all the media that I consume – not just music.

I went looking for an equivalent for the books that I read in August 2008, and started using goodreads.

But what about the television that I watch? Could I create a last.fm-style scrobbler to capture what I watch on television? And then try and come up with a few examples of how I could share and visualise the data?

This question is where I started at Christmas… and after a few evenings of hacking some Python together, I’ve come up with:

last.fm for television

Please go take a look. (needs Flash – sorry)

Read the rest of this entry »