<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Uncertain Binary Thoughts &#187; ktorrent</title>
	<atom:link href="http://ankurs.com/tag/ktorrent/feed/" rel="self" type="application/rss+xml" />
	<link>http://ankurs.com</link>
	<description>01110100110101010101011101100010</description>
	<lastBuildDate>Mon, 30 Aug 2010 16:51:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Get updates of completed torrents via SMS</title>
		<link>http://ankurs.com/2009/04/get-updates-of-completed-torrents-via-sms/</link>
		<comments>http://ankurs.com/2009/04/get-updates-of-completed-torrents-via-sms/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:13:16 +0000</pubDate>
		<dc:creator>Ankur Shrivastava</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Special]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[dbus]]></category>
		<category><![CDATA[ktorrent]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[torrent]]></category>
		<category><![CDATA[twit]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://ankurs.com/?p=489</guid>
		<description><![CDATA[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]]></description>
			<content:encoded><![CDATA[<p>This Sunday when i was giving <a href="http://www.freedesktop.org/wiki/Software/dbus">DBUS</a> 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<br />
1) setup your cell phone to recieve SMS updates in twitter,<br />
2) get one more twitter account lets say ktorrent, follow ktorrent and turn device updates on,<br />
3) now save the script below say as torrenttwit.py<br />
4) now enter this ktorrent account username and password in the script below,<br />
5) start ktorrent if not already started, now run the script by typing &#8220;python torrenttwit.py&#8221;</p>
<pre>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()
</pre>
<p>you are done, now whenever a torrent finishes the script will twit and you will receive an SMS update<br />
enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://ankurs.com/2009/04/get-updates-of-completed-torrents-via-sms/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
