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

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

See recent comments. RSS feed of all comments. Raw dump of all comments for research purposes.

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


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


Site janitorial stuff

    So, this whole kerfuffle about microblogging prompted me to hack the perl I use to generate this site to provide a blather-free version of my RSS feed. As a side effect I fixed a bug which was generating too many versions of the various RSS files I have on the site, thus removing 11,000 unneeded RSS files. That seemed like a lot to me (although not a lot of disk, just a lot of small annoying files).

    There is of course the possibility that I removed too many, or broke something else in the process. Let me know if you notice anything.

    Tags for this post: site(S)

posted at: 00:02 | path: /site | permanent link to this entry