def updatebl(self): # fix me from modules.newznab import NewznabIndexers from modules.kodi import KodiServers from htpc.manageusers import Manageusers NewznabIndexers.createTable(ifNotExists=True) KodiServers.createTable(ifNotExists=True) Manageusers.createTable(ifNotExists=True) bl = [] fl = Setting.select().orderBy(Setting.q.key) for i in fl: if i.key.endswith("_apikey") or i.key.endswith("_username") or i.key.endswith("_password") or i.key.endswith("_passkey"): if len(i.val) > 1: bl.append(i.val) indexers = NewznabIndexers.select().orderBy(NewznabIndexers.q.apikey) for indexer in indexers: if len(indexer.apikey) > 1: bl.append(indexer.apikey) kodi = KodiServers.select().orderBy(KodiServers.q.password) for k in kodi: if len(k.password) > 1: bl.append(k.password) users = Manageusers.select().orderBy(Manageusers.q.username) for user in users: if len(user.password) > 1: bl.append(user.password) htpc.BLACKLISTWORDS = bl return bl
def getuser(self, id=None): if id: """ Get user info, used by settings """ try: user = Manageusers.selectBy(id=id).getOne() return dict((c, getattr(user, c)) for c in user.sqlmeta.columns) except SQLObjectNotFound: return """ Get a list of all users""" users = [] for s in Manageusers.select(): users.append({'id': s.id, 'name': s.username}) if len(users) < 1: return return {'users': users}
def getuser(self, id=None): if id: """ Get user info, used by settings """ try: user = Manageusers.selectBy(id=id).getOne() return dict( (c, getattr(user, c)) for c in user.sqlmeta.columns) except SQLObjectNotFound: return """ Get a list of all users""" users = [] for s in Manageusers.select(): users.append({'id': s.id, 'name': s.username}) if len(users) < 1: return return {'users': users}
def updatebl(self): # fix me from modules.newznab import NewznabIndexers from modules.kodi import KodiServers from htpc.manageusers import Manageusers NewznabIndexers.createTable(ifNotExists=True) KodiServers.createTable(ifNotExists=True) Manageusers.createTable(ifNotExists=True) bl = [] fl = Setting.select().orderBy(Setting.q.key) for i in fl: if i.key.endswith("_apikey") or i.key.endswith( "_username") or i.key.endswith( "_password") or i.key.endswith("_passkey"): if len(i.val) > 1: bl.append(i.val) indexers = NewznabIndexers.select().orderBy(NewznabIndexers.q.apikey) for indexer in indexers: if len(indexer.apikey) > 1: bl.append(indexer.apikey) kodi = KodiServers.select().orderBy(KodiServers.q.password) for k in kodi: if len(k.password) > 1: bl.append(k.password) users = Manageusers.select().orderBy(Manageusers.q.username) for user in users: if len(user.password) > 1: bl.append(user.password) htpc.BLACKLISTWORDS = bl return bl