Print

Print


On Thu, Feb 10, 2005 at 02:00:05PM -0600, Edward Iglesias wrote:
> SIRSI is indeed working on the issue but what I was hoping for was a
> relatively simple solution.  Every month we send out lists of newly
> cataloged books to our "Academic Liaisons".  I already have the list in
> plain text.  I was simply looking for a quick and dirty way to turn it
> into an RSS feed.

If your data is in plain text you'll probably have to write your own custom
text reader to generate the RSS.

If you can get your data out in a structured format, like MARC lets say
you can write a program like this:

    #!/usr/bin/env python

    import sys
    import PyRSS2Gen
    import pymarc

    input = sys.argv[1]
    output = input + ".xml"

    title = "New Books"
    url = "http://new-books-list.edu"
    desc = "This is a list of new books, Enjoy!"

    rss = PyRSS2Gen.RSS2( title, url, desc )
    batch = pymarc.MARCReader( input )

    for record in batch:
        isbn = record.isbn()
        rss.items.append( PyRSS2Gen.RSSItem( \
            title = record.title(),
            link = "http://link-to-opac.edu?isbn=%s" % isbn ) )

    rss.write_xml( file(output, "w") )

There are lots of ways to skin this cat (chisel this wheel?), but I'd try to
work with structured data (MARC, XML, tab delmited, whatever) rather than
vanilla plain text if you can.

//Ed