def main(): regList = psvdb.psvDB('../Data/registration.psv') newList = psvdb.psvDB('../Data/csgStats.psv') db = sqldb.sqliteDB('../Data/Users.sql','csg') ts = ET.parse('../Data/CSGInfo.xml') notFound = [] nextID = 0 for key in regList.data.keys(): fName = key bName = regList.data[key][0] try: pid = db.searchItem('nickname',base64.b64encode(bName.encode('utf-8')).decode('ascii')) except: notFound.append([fName,bName]) else: cpid = db.getItem(pid,'cpid') setiID = str(nextID) nextID += 1 score = db.getItem(pid,'score') score = score[:score.index('.')] newList.addItem([setiID,cpid,fName,bName,pid,score]) newList.addItem(['header']+newList.data['header']+[ts.find('update_time').text]) print('The following users were not found:') for item in notFound: print(item[0],item[1])
def importPSVDB(fileName): import psvdb db = psvdb.psvDB(fileName) columnList = db.data['header'] createSQLiteDB(fileName[:-3]+'sql',columnList) newDB = sqliteDB(fileName[:-3]+'sql') for key in db.data.keys(): if key != 'header': newDB.addItem([key]+db.data[key])
def importPSVDB(fileName, tableName='main'): import psvdb db = psvdb.psvDB(fileName) columnList = db.data['header'] createSQLiteDB(fileName[:-3] + 'sql', columnList, tableName) newDB = sqliteDB(fileName[:-3] + 'sql') for key in db.data.keys(): if key != 'header': newDB.addItem([key] + db.data[key])
def main(): newList = psvdb.psvDB('../Data/csgStats.psv') ts = str(int(time.time())) for key in newList.data.keys(): if key != 'header': pid = newList.getItem(key,'pid') newScore = getNewScore('http://csgrid.org/csg/show_user.php',pid) newList.addItem([key]+newList.data[key]+[newScore]) newList.addItem(['header']+newList.data['header']+[ts])