def add(self, bot, **kwargs): """ add a nickserv entry. """ options = { 'nickserv': 'NickServ', 'identify': 'identify', } options.update(kwargs) assert 'password' in options, 'A password must be set' for key in list(options.keys()): Pdod.set(self, bot.cfg.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 list(self.data.values()): if 'perms' not in j: j['perms'] = [] if 'autovoice' not in j: j['autovoice'] = 0
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 + 'tl.plugs.extra.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("%s doesnt have url set" % self.data.name) return [] result = feedparser.parse(url, agent=useragent()) logging.debug("got result from %s" % url) if result and 'bozo_exception' in result: logging.info('%s bozo_exception: %s' % (url, result['bozo_exception'])) try: status = result.status logging.info("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 + 'tl.plugs.extra.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.registered = False Pdod.__init__(self, getdatadir() + os.sep + 'plugs' + os.sep + 'tl.plugs.nickserv' + os.sep + 'nickserv')
def __init__(self): Pdod.__init__(self, os.path.join(getdatadir() + os.sep + 'plugs' + os.sep + 'tl.plugs.sockets.mpd', 'mpd')) self.running = False self.lastsong = -1
def __init__(self): Pdod.__init__(self, os.path.join(getdatadir(), 'plugs', 'tl.plugs.extra.bugtracker', 'trackers')) self.load()
def __init__(self): self.datadir = os.path.join(getdatadir(), "plugs", "tl.plugs.extra.seen") Pdod.__init__(self, os.path.join(self.datadir, "seen.data"))