For the past few months I have been following the progress of Chromium for Mac and watching it develop and it has definitely made a lot of progress in that time. In the past few month it has received increasing press, with people asking why it is taking so long. One of the lead developers on the project responded that people need to chill out and that building a browser takes time. So, in part to show myself and others the progress, I decided to make a little application to show this progress. Throughout the day builds and updates of Chromium are posted to http://build.chromium.org/buildbot/snapshots/sub-rel-mac/ but to read each changelog was a pain. So, to give myself more exposure to new Python libraries and give the Twitter API a swing, I created a script to check for changes to the builds, pull log entries on the changes and post them all to a Twitter stream so there is a single source you can view updates. The script is far from perfect, as it has to be running to catch the updates and doesn’t go back and look for ones it missed. And currently I just have it running on one of Duke’s servers so it goes down occasionally. But it generally works and provides plenty of updates so you can see what is actually be worked on and updated. Check out the source code below (twitter username and password cut out).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #!/usr/bin/env python # encoding: utf-8 import sys import os import urllib import urllib2 import base64 import time from xml.dom import minidom def twitter(twitter_username, twitter_password, message): request = urllib2.Request('http://twitter.com/statuses/update.json') request.headers['Authorization'] = 'Basic %s' % ( base64.b64encode(twitter_username + ':' + twitter_password),) request.data = urllib.urlencode({'status': message}) try: response = urllib2.urlopen(request) # The Response except HTTPError, e: print "Error posting to twitter" print "HTTP Error code: ", e.code except URLError, e: print "Error posting to twitter" print "URLError reason: ", e.reason def main(): message = "" last_update = "17514"; chromium_url = "http://build.chromium.org/buildbot/snapshots/sub-rel-mac/" while(True): try: response = urllib2.urlopen(chromium_url + "LATEST") except HTTPError, e: print "HTTP Error code: ", e.code except URLError, e: print "URLError reason: ", e.reason else: latest = response.read() print "latest: ", latest if(latest != last_update): try: response2 = urllib2.urlopen(chromium_url + latest + "/changelog.xml") except HTTPError, e: print "HTTP Error code: ", e.code except URLError, e: print "URLError reason: ", e.reason else: html = response2.read() # print html dom = minidom.parseString(html) entries = dom.getElementsByTagName("logentry") #[0].childNodes print "entries: ", len(entries) for i in range(0, len(entries)): link = chromium_url + latest + "/ " msg = entries[i].getElementsByTagName("msg")[0].firstChild.nodeValue num = entries[i].getAttribute("revision") print "Revision: ", num twitter("USERNAME", "PASSWORD", "Chromium Revision " + num + ": " + msg) last_update = latest time.sleep((60*2)) if __name__ == '__main__': main() |
Play with the code or follow the twitter. Also, I decided to try a new WordPress plugin for code so let me know what you think. Thanks.

0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment