Planetplanet is a rss feed aggregator hacked in python.It’s extremely popular and we use it both internally and also on our GLUG site .
And the saddest thing ,it doesn’t have an installer yet :( and its a pain setting it up again and again .I have scribbled down a simple installer which *works* provided you obey all the rules it asks to :P .
here is the script
#!/usr/bin/env python
''' This script can be used to install planetplanet ,the python based RSS feed aggregator .
Author: S.Theyagarajan
Email: theyaga@gmail.com
URL : http://theyagar.info
Download URL: http://theyagar.info/code/planet-installer.txt '''
" Example Usage : ./installer-planet.py -p /home/codelabs/planet-2.0 -t fancy -o /home/codelabs/www/ -n Planet -a GLUG -e glugt@glugt.org "
from optparse import OptionParser
from commands import *
import commands
import optparse ,sys,os
usage = "Usage:\n %prog --p Planet_directory -t theme_name -o output_directory -n planet_name -a Admin_name -e Admin_email "
print usage
parser = OptionParser (usage)
parser.add_option ("-p", "--pdir", dest="pdirname")
parser.add_option ("-t", "--theme", dest="theme")
parser.add_option ("-o", "--outdir", dest="outdir")
parser.add_option ("-n", "--planetname", dest="pname")
parser.add_option ("-a", "--admin", dest="admin")
parser.add_option ("-e", "--email", dest="adminemail")
parser.add_option ("-l", "--link", dest="link")
(options, args) = parser.parse_args ()
if options.pdirname == None:
print "PlanetPlanet directory cannot be empty "
else:
pdirname=options.pdirname
print pdirname
theme=options.theme
print theme
outdir=options.outdir
print outdir
pname=options.pname
print pname
print "Planet Name is "+pname
admin=options.admin
print "Admin Name is"+ admin
adminemail=options.adminemail
print "Admin email is"+ adminemail
link=options.link
cmd= "cp -r "+ pdirname +"/examples/"+ theme +"/"+" "+ outdir
print cmd
cache_cmd= "cp -r "+ pdirname + "/examples/" + "cache" + "/" + " " + outdir
print cache_cmd
static_cmd= "cp -r "+ pdirname + "/examples/" + theme + "/*" + " " + outdir
print static_cmd
xml_cmd= "cp -r " + pdirname + "/examples/*.tmpl" + " " + outdir
print xml_cmd
rest_cmd= "cp -r " + pdirname + "/planet*" + " " + outdir
print rest_cmd
output=commands.getoutput(cmd)
output=commands.getoutput(cache_cmd)
output=commands.getoutput(xml_cmd)
output=commands.getoutput(rest_cmd)
import ConfigParser
cf=outdir + theme + "/config.ini"
print cf
config=ConfigParser.ConfigParser()
fp=file(cf,'rw')
config.readfp(fp)
print config.sections()
config.set('Planet','name',pname)
config.set('Planet','owner_name',admin)
config.set('Planet','owner_email',adminemail)
config.set('Planet','link',link)
config.set('Planet','days_per_page','100')
config.set('Planet','template_files',outdir + "" + theme + "/" + "index.html.tmpl" + " " + outdir + "atom.xml.tmpl" + " " + outdir + "foafroll.xml.tmpl" + " " + outdir + "opml.xml.tmpl" + " " + outdir+"rss20.xml.tmpl" + " " + outdir + "rss10.xml.tmpl" )
config.set('Planet','cache_directory',outdir + "/cache")
config.set('Planet','output_dir',outdir)
#config.remove_section('examples/fancy/index.html.tmpl')
config.add_section(outdir + "/" + theme + "/index.html.tmpl")
#config.set(outdir + theme + "/index.html.tmpl",'days_per_page','7')
fp.close()
fp=open(cf,'w')
config.write(fp)
fp.close()
cmd=" python " + outdir + "planet.py" + " " +outdir+theme+ "config.ini"
print cmd
output=commands.getstatusoutput(cmd)
And how do you use it ?
./installer-planet.py -p /home/codelabs/planet-2.0 -t fancy -o /home/codelabs/www/ -n Planet -a GLUG -e glugt@glugt.org
and you can also have the python file here http://theyagar.info/code/installer-python.txt
And what did i learn ? .
ConfigParser module.Its lovely ,makes it lot easier to edit the config files like the ones you find in httpd.conf so customization is just a program away no matter how many machines and time :-)
Go Python !!
[tags]planetplanet,python,hacks[/tags]
Thiagaraja college of engineering ,one of the premier institutions in southern india has bagged PCQuest’s IT innovation award for their TCENet project .Which is web based tool for students of the institute to communicate ,share and also use the intranet facilities .And the best part ,all of these have been created only using FOSS tools.Something that i feel very good about and we should be proud of it too.
The entire project was student handled hence a reason for even more prasie :-) .Over the few years ,as a member of GLUG-T i have been seeing a rapid growth and lot of activities from the college and we have learnt a lot from them from organising classes to planning a install fest .
I have been lucky to be in touch with Bala from the college and a few others whose blog i regularly visit .
It would be worth to keep in touch with these people and their glug .
some other blogs from their college that i regularly visit .
Geethapriya Krithika ( also a SUN ambassador ) and a solaris guy ananth .
Also check out their mailing list in case you want to join
and for those who haven’t been checking my college website would be surprised to see a new looking homepage that obviously looks great and also a facility to use the intranet sites or access intranet resources from outside the campus .
[tags]glugot,tce,pcquest[/tags]
Yesterday , i came across a script from swaroop`s blog which can track the amount of time you spend on each applications.But the script works only on windows and i looked around if i can put together a similar script for linux .
I initially tried using LDTP for it ,but i wanted only python and i came across ltfx which has get_active_win which returns the active window.
here is the script
#!/usr/bin/env python
import time,os,sys,commands
''' This Python script,will track how much time you spend on which application :) .It uses ltfx command . '''
''' License: http://www.opensource.org/licenses/bsd-license.php'''
''' ISSUES with the script: Identifying Terminal is a problem ,for eg, name of terminal can codelabs@delta/tmp ,in that case finding Terminal is not possible'''
''' URL for the script http://freeshell.in/~taggy/blog/work/ '''
total_counter = 0
counter = {}
_tick = 5 # Note which app is running, every `_tick` seconds
_refresh = 30 # Write out the file, every `_refresh` seconds
def get_title(title):
'''The commands.getstatusotput() returns a list ,list_name[1] contains the application Name”’
temp = title[1]
appln_name=temp.split(’-')[-1].strip()
print appln_name
return appln_name
def write_times_to_file(counter):
”’Write the time spent on each application to a file.”’
f = open(’HowMuchTimeYouWaste.txt’, ‘w’)
output = ‘n’.join(['%s=%s' % (app, counter[app]) for app in counter.keys()])
f.write(output)
f.close()
while True:
time.sleep(_tick)
cmd=”ltfx -e ‘get_active_win’ ”
print cmd
status = commands.getstatusoutput (cmd)
#print status
app = get_title( commands.getstatusoutput(cmd))
# print app
if app not in counter:
counter[app] = 0
counter[app] += _tick
total_counter += 1
if total_counter % (_refresh/_tick) == 0:
write_times_to_file(counter)
print counter # debug, remove if distracting
To get it running ,make sure you have ltfx installed,if not you can download it from here .
The script can also be downloaded from .
The script for windows can be found at Swaroop`s blog
[tags]python,hack,scripts[/tags]
Just done with the installation of planetplanet in our institute.
For those who dont know what is PlanetPlanet .Its a RSS aggregator used to aggregate blogs (generally, though it can be used to aggregate just about all RSS). Its very powerful and it powers PLanetGnome ,PLanetLDTP,PlanetDebian and the list is endless.
But beware ,the official website doesnt have a installation manual .
So i thought i would write on how it can be done .
* Download the package from PlanetPlanet website .
* Untar it in to a folder in your webserver root directory or where you want planet to be accessible .
tar -zxvf planetplanet.xyz.tar.gz or tar -jxvf planetplanet.xyz.tar.bz2
*There are two templates that come along with package ,simple and fancy . Go to the template folder you want choose
cd fancy (in my case)
* The configuration file in config.ini in that directory ,the variables documentation is clear enough and at one glance you should be able to Change the Planet name ,owner and subscriptions .
* now come to planetplanet root folder and execute the python script or feed accumulator
python planet.pyv “Path to config.ini”
*You must be able to see on your terminal the feeds accumulated :)
* Now just check out the output directory through the web browser and you should be able to see planet planet in action .
* The template ofcourse can be changed by editing the fancy/index.tmpl file .
*Incase you access through a proxy ,the planetplanet wont work as such ,but a small tweak will do .
We use the Feedparser and urllib2 module in python ( so powerful )
look for the file __init__.py and edit it
Look for the line info=feedparser.parse (…) this is used to access feeds directly from web , all that we have to do is to make sure the info which is the feed can be accessed through a proxy .
proxy = urllib2.ProxyHandler( {"http":"http://nitt.edu:3128/"} )
info = feedparser.parse(self.url,
etag=self.url_etag, modified=self.url_modified,
agent=self._planet.user_agent,
handlers = [proxy])
now run the python planet.py “Path to config.ini ”
and your planet should be up and running .
And yeah the link for people inside it is http://178.1.2.116/planet
There is one thing thats common to all programmers ! they Swear ,
Recently released Google code search
Searching for words like “porn ” “bitch” “fuck” in source code files in few languages.Amazed to see the results .. Just watch this file


