def __init__(self): Pdod.__init__( self, os.path.join( getdatadir() + os.sep + 'plugs' + os.sep + 'jsb.plugs.sockets.mpd', 'mpd')) self.running = False self.lastsong = -1
def add(self, bot, **kwargs): """ add a nickserv entry. """ options = { 'nickserv': 'NickServ', 'identify': 'identify', } options.update(kwargs) assert options.has_key('password'), 'A password must be set' for key in options.keys(): Pdod.set(self, bot.cfg.name, key, options[key]) self.save()
def add(self, bot, **kwargs): """ add a nickserv entry. """ options = { 'nickserv': 'NickServ', 'identify': 'identify', } options.update(kwargs) assert options.has_key('password'), 'A password must be set' for key in options.keys(): Pdod.set(self, bot.name, key, options[key]) self.save()
def __init__(self, fname): # call base constructor Pdod.__init__(self, fname) # make sure attributes are initialised for j in self.data.values(): if not j.has_key('perms'): j['perms'] = [] if not j.has_key('autovoice'): j['autovoice'] = 0
def setstate(self, state=None): """ set state on the bot. """ self.state = state or Pdod(self.datadir + os.sep + 'state') if self.state: if not 'joinedchannels' in self.state.data: self.state.data.joinedchannels = [] if not 'ignore' in self.state.data: self.state.data.ignore = []
class HubbubItem(Persist): """ item that contains hubbub data """ def __init__(self, name, url="", owner="", itemslist=['title', 'link'], watchchannels=[], running=1): filebase = getdatadir() + os.sep + 'plugs' + os.sep + 'jsb.plugs.wave.hubbub' + os.sep + name Persist.__init__(self, filebase + os.sep + name + '.core') if not self.data: self.data = {} self.data = LazyDict(self.data) self.data['name'] = self.data.name or str(name) self.data['url'] = self.data.url or str(url) self.data['owner'] = self.data.owner or str(owner) self.data['watchchannels'] = self.data.watchchannels or list(watchchannels) self.data['running'] = self.data.running or running self.itemslists = Pdol(filebase + os.sep + name + '.itemslists') self.markup = Pdod(filebase + os.sep + name + '.markup') def save(self): """ save the hubbub items data. """ Persist.save(self) self.itemslists.save() self.markup.save() def ownercheck(self, userhost): """ check is userhost is the owner of the feed. """ try: return self.data.owner == userhost except KeyError: pass return False def fetchdata(self): """ get data of rss feed. """ url = self.data['url'] if not url: logging.warn("hubbub - %s doesnt have url set" % self.data.name) return [] result = feedparser.parse(url, agent=useragent()) logging.debug("hubbub - fetch - got result from %s" % url) if result and result.has_key('bozo_exception'): logging.info('hubbub - %s bozo_exception: %s' % (url, result['bozo_exception'])) try: status = result.status logging.info("hubbub - status is %s" % status) except AttributeError: status = 200 if status != 200 and status != 301 and status != 302: raise RssStatus(status) return result.entries
def __init__(self, name, url="", owner="", itemslist=['title', 'link'], watchchannels=[], running=1): filebase = getdatadir() + os.sep + 'plugs' + os.sep + 'jsb.plugs.wave.hubbub' + os.sep + name Persist.__init__(self, filebase + os.sep + name + '.core') if not self.data: self.data = {} self.data = LazyDict(self.data) self.data['name'] = self.data.name or str(name) self.data['url'] = self.data.url or str(url) self.data['owner'] = self.data.owner or str(owner) self.data['watchchannels'] = self.data.watchchannels or list(watchchannels) self.data['running'] = self.data.running or running self.itemslists = Pdol(filebase + os.sep + name + '.itemslists') self.markup = Pdod(filebase + os.sep + name + '.markup')
def __init__(self): self.datadir = getdatadir() + os.sep + 'plugs' + os.sep + 'jsb.plugs.common.seen' Pdod.__init__(self, os.path.join(self.datadir, 'seen.data'))
def __init__(self): self.registered = False Pdod.__init__( self, getdatadir() + os.sep + 'plugs' + os.sep + 'jsb.plugs.nickserv' + os.sep + 'nickserv')
def __init__(self): self.datadir = getdatadir( ) + os.sep + 'plugs' + os.sep + 'jsb.plugs.common.seen' Pdod.__init__(self, os.path.join(self.datadir, 'seen.data'))
def __init__(self): self.datadir = os.path.join(datadir, 'plugs', 'jsb.plugs.common.sed') Pdod.__init__(self, os.path.join(self.datadir, 'sed.data')) if not self.data: self.data = {}
def __init__(self): Pdod.__init__(self, os.path.join(getdatadir() + os.sep + 'plugs' + os.sep \ + 'bugtracker', 'bugtracker')) self.load()
def __init__(self): self.registered = False Pdod.__init__(self, getdatadir() + os.sep + 'plugs' + os.sep + 'jsb.plugs.nickserv' + os.sep + 'nickserv')
def __init__(self): Pdod.__init__(self, os.path.join(getdatadir() + os.sep + 'plugs' + os.sep + 'jsb.plugs.sockets.mpd', 'mpd')) self.running = False self.lastsong = -1