01110100110101010101011101100010
Get updates of completed torrents via SMS
This Sunday when i was giving DBUS a look and thinking about all the cool things possible with it, one of my friend came asking how can he control his torrents from anywhere and i thought controlling is ok, do you want SMS updates??, i fired up qdbusviewer and there it was a simple way to get sms notifications of finished torrents using well twitter and ktorrent, so here are the steps
1) setup your cell phone to recieve SMS updates in twitter,
2) get one more twitter account lets say ktorrent, follow ktorrent and turn device updates on,
3) now save the script below say as torrenttwit.py
4) now enter this ktorrent account username and password in the script below,
5) start ktorrent if not already started, now run the script by typing “python torrenttwit.py”
import dbus,base64,urllib2,urllib
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
username="username"
password="password"
def tweet(msg):
request = urllib2.Request('http://twitter.com/statuses/update.json')
request.add_header('Authorization', 'Basic %s' % base64.encodestring('%s:%s' % (username,password))[:-1])
request.add_data(urllib.urlencode({'status': msg.encode('utf-8')}))
opener = urllib2.build_opener()
req= opener.open(request)
s = dbus.SessionBus()
kt = s.get_object("org.ktorrent.ktorrent","/core")
def update(k):
torrent = s.get_object("org.ktorrent.ktorrent","/torrent/"+k)
name = torrent.get_dbus_method("name","org.ktorrent.torrent")
tweet("ktorrent: finished " +name())
kt.connect_to_signal("finished",update)
import gobject
loop = gobject.MainLoop()
loop.run()
you are done, now whenever a torrent finishes the script will twit and you will receive an SMS update
enjoy
| Print article | This entry was posted by Ankur Shrivastava on April 6, 2009 at 5:43 pm, and is filed under Linux, Special, fedora. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |





about 1 year ago
I think that creating a twitter account just for SMS functionality is unfair to twitter, less reliable, and just unnecessary.
Most cell carriers have Email to SMS gateways:
http://en.wikipedia.org/wiki/List_of_carriers_providing_Email_or_Web_to_SMS
Just have the script shoot off an email to number@carrier.domain.com
about 1 year ago
that was the first thing i tried, but it didnt work for me.. thats y shifted to this and i guess twitter is providing SMS in only 3 countries i guess, so a large number of people will use 3rd party tools and not twitter directly….
about 1 year ago
linux is awesome os! thx u!
about 1 year ago
Nice Idea Ankur.
I have modified your script to use SMTP instead.
http://djsh.net/get-updates-of-completed-torrents-via-sms-part-2/
about 1 month ago
http://en.wikipedia.org/wiki/List_of_carriers_providing_Email_or_Web_to_SMS
T-Mobile works perfectly in US