Content here is by:
Michael Still
mikal@stillhq.com

All my Open Source projects
Extracted view of CVS
Home
Site map

100 comments today, 100 of them spam. 373703 comments overall, 372783 of them spam. See recent comments. RSS feed of all comments.

ImageMagick book
MythTV book







Thu, 03 Jul 2008



Blathering for Thursday, 03 July 2008

posted at: 23:32 | path: /blather | permanent link to this entry
There are no comments on this post which have survived moderation. 3 posts have been culled and 0 blocked. Be the first to make a non-spam comment here, please!


Another version of blather

    And while I'm thinking of
    all things blather, I've been meaning to post this new version of the blather code for a week or two. This version is just a small refactor which allows for random other python scripts to import blather.py and put messages into the stream of messages to be posted online.

    You can find the source here. A sample program to place messages into the blather stream is:

      #!/usr/bin/python
      
      import feedparser
      import os
      import shelve
      import sys
      
      plugins_dir = '%s/plugins' % os.getcwd()
      print 'Appending %s to module path' % plugins_dir
      sys.path.append(plugins_dir)
      import blather
      
      data = shelve.open('fetchshared.slf', writeback=True)
      ds = blather.DataStore()
      
      changed = False
      for feed in data['feeds']:
        data.setdefault('guids', {})
        data['guids'].setdefault(feed, [])
      
        print
        print 'Fetching %s' % feed
        d = feedparser.parse(feed)
      
        for ent in d.entries:
          if ent.guid not in data['guids'][feed]:
            post = ('Mikal shared: <a href="%s">%s</a>'
                    %(ent.link, ent.title))
            print post
            ds.AddMessage(post)
            data['guids'][feed].append(ent.guid)
            changed = True
      
      if changed:
        ds.Save()
      data.close()
      


    Too easy.

    Tags for this post: blather(S)

posted at: 00:50 | path: /blather | permanent link to this entry
There are no comments on this post yet. Be the first to make one.


Site janitorial stuff

posted at: 00:02 | path: /site | permanent link to this entry
There are no comments on this post which have survived moderation. 1 posts have been culled and 0 blocked. Be the first to make a non-spam comment here, please!