#!/usr/local/bin/python """

Name

p4rss.py - generate RSS feed from p4 changes -m 10.

Synopsis

python p4rss.py > /path/to/rssfile

Description

p4rss.py converts usual output from p4 changes e.g.
Change 10 on 2003/02/26 by hjh@p4rss 'Doc on RSS 0.91 vs 1.0, and cos'
Change 9 on 2003/02/26 by hjh@p4rss 'Add a bit more doc. '
Change 8 on 2003/02/26 by hjh@p4rss 'Documentation and cosmetic chan'
...
to RSS 0.91 format see sample.p4rss.xml. Run it inside a cron job to generate the RSS periodically.

Because p4rss.py uses vanilla p4, user can modify its behaviour with usual P4 environment variables.

Bugs

p4rss.py has many limitations:

Todo

  1. study web interfaces like p4db, p4web or PyDS
  2. trim this doc comment as it's even longer than the code!

Download

python script: p4rss.zip and sample RSS: sample.p4rss.xml
Copyright 2003 Jay Han
You are free to use it as long as you do not blame me for anything. """ import marshal, os p4changes = 'p4 -G changes -m 10' # + max stream = os.popen(p4changes) print "" print "" print "\n\ \tMost recent changes in Perforce (up to 10)\n\ \thttp://127.0.0.1/\n\ \ten-US\n\ \tp4 changes -m 10 as RSS 0.91\n" try: while 1: dict = marshal.load(stream) # sys.stdin print "\t" print "\t\t%s" % dict['change'] print "\t\thttp://127.0.0.1/" ## % dict['user'] print "\t\t%s" % dict['desc'] print "\t" except EOFError: pass print "\n\ "