Posts tagged twitter

River Level Twitter Bot

With all the bad weather, and with moving to opposite a river I had been keeping an eye on the river on my way to work and found the Environment Agency site has real time (sort of) data for most of the rivers in the UK.

So I decided to knock up a quick script to scrape the page for the river level and tweet to a newly created account.

Link: @RiverAireLeeds

Xbox Twitter

Something I created last week was a xbox status twitter updater (I think i’m obsessed with Twitter atm), the idea was to send a tweet to my friends and me when one of us came online. A couple of hours later it was done.

Torrent Status via Twitter

I’ve been wanting to use twitter to interact with my uTorrent downloads for a while. I already have a system set up that tweets me when a download has finished, but I wanted more functionality, ideally the ability to add torrents and get the overall status of my downloads.

Thankfully uTorrent have created a nice little api that lets you do pretty much everything you would want, I used this uTorrent Python library, that lets you interact with the uTorrent api. I then made a simple c# win forms app (needs changing into a command line app really) that would make various calls to the Python library. Initially the only functionality is the current status of downloads, but now I have the basics in place I can add features fairly easily.

At the moment the application reads my latest tweets, I have already created some code todo this for my Home Automation System, and then when a tweet matches the ‘status’ command, I fire off the call to the api to get the status of every download in my client. The returned list is then parsed, and any active downloads are extracted and returned to the main method. This then processes the returned strings and replies back to my original tweet with the status of my downloads.

The next step is to add the ability to add new torrent files straight from a tweet, this should be fairly straightforward, the tweet would contain the location of the .torrent file, the system would then make the call to the uTorrent api with the location of the file to be downloaded.

Torrent Automation

One of the main reasons for buying a server was for the ability to leave a torrent client running 24/7, now I can. With uTorrent ( and all of its advanced options ) I can now download torrents all of the time, one of the drawbacks to this is the drain of bandwidth on the rest of the network. So I’ve set uTorrent to only download at full speed during the night, and then very limited during the daytime, this was I shouldn’t notice any impact on my network.

uTorrent Schedule

Another nice feature of uTorrent is the auto download of torrents when placed in a specific directory, so this means I can quickly add a torrent file to my NAS drive and within a few seconds the torrent is downloading. This and with addition of the RSS feed feature allows me to quickly download TV and films without much effort.

File are then automatically moved to the correct directory, based on the torrents labels, so that my Boxee Box will pick up the media without me intervening.

Another idea I had (well @Bonxy suggested) was to get twitter updates when downloads have finished. I had already dealt with twitter messages when creating my home automation system for my dissertation. So it was just a quick job of copy a bit of code and creating a simple console app that took the tweet params.

Twitter Code

I then edited my uTorrent options to ‘run a program’ when a download completes, I just simply pass the twitter message with the torrent name, and within a few seconds I get a tweet (plus email and free SMS) with my download details. I then added the same call to the status changed option in uTorrent.

tweet Image

Obviously I cancelled the above download as downloading content that isn’t freely available isn’t legal. :)