Merge branch 'killftp' into siteneutral
Conflicts: pyfpdb/fpdb_simple.py
This commit is contained in:
commit
3aaf5b9716
|
@ -208,7 +208,7 @@ class Importer:
|
||||||
#if os.path.isdir(file):
|
#if os.path.isdir(file):
|
||||||
#self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
#self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
||||||
|
|
||||||
self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)
|
self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)
|
||||||
|
|
||||||
for file in self.removeFromFileList:
|
for file in self.removeFromFileList:
|
||||||
if file in self.filelist:
|
if file in self.filelist:
|
||||||
|
@ -286,13 +286,7 @@ class Importer:
|
||||||
print "DEBUG: import_fpdb_file: failed on self.lines[0]: '%s' '%s' '%s' '%s' " %( file, site, self.lines, loc)
|
print "DEBUG: import_fpdb_file: failed on self.lines[0]: '%s' '%s' '%s' '%s' " %( file, site, self.lines, loc)
|
||||||
return (0,0,0,1,0)
|
return (0,0,0,1,0)
|
||||||
|
|
||||||
if firstline.find("Tournament Summary")!=-1:
|
# site=fpdb_simple.recogniseSite(firstline)
|
||||||
print "TODO: implement importing tournament summaries"
|
|
||||||
#self.faobs = readfile(inputFile)
|
|
||||||
#self.parseTourneyHistory()
|
|
||||||
return 0
|
|
||||||
|
|
||||||
site=fpdb_simple.recogniseSite(firstline)
|
|
||||||
category=fpdb_simple.recogniseCategory(firstline)
|
category=fpdb_simple.recogniseCategory(firstline)
|
||||||
|
|
||||||
startpos=0
|
startpos=0
|
||||||
|
@ -301,62 +295,31 @@ class Importer:
|
||||||
partial=0 #counter
|
partial=0 #counter
|
||||||
errors=0 #counter
|
errors=0 #counter
|
||||||
|
|
||||||
for i in xrange (len(self.lines)): #main loop, iterates through the lines of a file and calls the appropriate parser method
|
for i in xrange (len(self.lines)):
|
||||||
if (len(self.lines[i])<2):
|
if (len(self.lines[i])<2): #Wierd way to detect for '\r\n' or '\n'
|
||||||
endpos=i
|
endpos=i
|
||||||
hand=self.lines[startpos:endpos]
|
hand=self.lines[startpos:endpos]
|
||||||
|
|
||||||
if (len(hand[0])<2):
|
if (len(hand[0])<2):
|
||||||
hand=hand[1:]
|
hand=hand[1:]
|
||||||
|
|
||||||
cancelled=False
|
|
||||||
damaged=False
|
|
||||||
if (site=="ftp"):
|
|
||||||
for i in range (len(hand)):
|
|
||||||
if (hand[i].endswith(" has been canceled")): #this is their typo. this is a typo, right?
|
|
||||||
cancelled=True
|
|
||||||
|
|
||||||
#FTP generates lines looking like:
|
|
||||||
#Seat 1: IOS Seat 2: kashman59 (big blind) showed [8c 9d] and won ($3.25) with a pair of Eights
|
|
||||||
#ie. Seat X multiple times on the same line in the summary section, when a new player sits down in the
|
|
||||||
#middle of the hand.
|
|
||||||
#TODO: Deal with this properly, either fix the file or make the parsing code work with this line.
|
|
||||||
if "Seat" in hand[i]:
|
|
||||||
mo = re.search(" Seat [0-9]+: ", hand[i])
|
|
||||||
if mo:
|
|
||||||
print "mo=", mo, "\nmo.start=", mo.start(),"\nhand[i]=",hand[i]
|
|
||||||
hand.insert(i+1, hand[i][mo.start()+1:])
|
|
||||||
hand[i] = hand[i][0:mo.start()]
|
|
||||||
|
|
||||||
if (len(hand)<3):
|
if (len(hand)<3):
|
||||||
pass
|
pass
|
||||||
#todo: the above 2 lines are kind of a dirty hack, the mentioned circumstances should be handled elsewhere but that doesnt work with DOS/Win EOL. actually this doesnt work.
|
#TODO: This is ugly - we didn't actually find the start of the
|
||||||
elif (hand[0].endswith(" (partial)")): #partial hand - do nothing
|
# hand with the outer loop so we test again...
|
||||||
partial+=1
|
else:
|
||||||
elif (hand[1].find("Seat")==-1 and hand[2].find("Seat")==-1 and hand[3].find("Seat")==-1):#todo: should this be or instead of and?
|
|
||||||
partial+=1
|
|
||||||
elif (cancelled or damaged):
|
|
||||||
partial+=1
|
|
||||||
if damaged:
|
|
||||||
print """
|
|
||||||
DEBUG: Partial hand triggered by a line containing 'Seat X:' twice. This is a
|
|
||||||
bug in the FTP software when a player sits down in the middle of a hand.
|
|
||||||
Adding a newline after the player name will fix the issue
|
|
||||||
"""
|
|
||||||
print "File: %s" %(file)
|
|
||||||
print "Line: %s" %(startpos)
|
|
||||||
else: #normal processing
|
|
||||||
isTourney=fpdb_simple.isTourney(hand[0])
|
isTourney=fpdb_simple.isTourney(hand[0])
|
||||||
if not isTourney:
|
if not isTourney:
|
||||||
fpdb_simple.filterAnteBlindFold(site,hand)
|
fpdb_simple.filterAnteBlindFold(hand)
|
||||||
hand=fpdb_simple.filterCrap(site, hand, isTourney)
|
hand=fpdb_simple.filterCrap(hand, isTourney)
|
||||||
self.hand=hand
|
self.hand=hand
|
||||||
|
|
||||||
try:
|
try:
|
||||||
handsId=fpdb_parse_logic.mainParser(self.settings['db-backend'], self.fdb.db
|
handsId=fpdb_parse_logic.mainParser(self.settings['db-backend'], self.fdb.db
|
||||||
,self.fdb.cursor, site, category, hand)
|
,self.fdb.cursor, category, hand)
|
||||||
self.fdb.db.commit()
|
self.fdb.db.commit()
|
||||||
|
|
||||||
stored+=1
|
stored+=1
|
||||||
if self.callHud:
|
if self.callHud:
|
||||||
#print "call to HUD here. handsId:",handsId
|
#print "call to HUD here. handsId:",handsId
|
||||||
|
@ -367,7 +330,7 @@ class Importer:
|
||||||
except (ValueError), fe:
|
except (ValueError), fe:
|
||||||
errors+=1
|
errors+=1
|
||||||
self.printEmailErrorMessage(errors, file, hand)
|
self.printEmailErrorMessage(errors, file, hand)
|
||||||
|
|
||||||
if (self.settings['failOnError']):
|
if (self.settings['failOnError']):
|
||||||
self.fdb.db.commit() #dont remove this, in case hand processing was cancelled.
|
self.fdb.db.commit() #dont remove this, in case hand processing was cancelled.
|
||||||
raise
|
raise
|
||||||
|
@ -375,25 +338,24 @@ class Importer:
|
||||||
errors+=1
|
errors+=1
|
||||||
self.printEmailErrorMessage(errors, file, hand)
|
self.printEmailErrorMessage(errors, file, hand)
|
||||||
|
|
||||||
#fe.printStackTrace() #todo: get stacktrace
|
|
||||||
self.fdb.db.rollback()
|
self.fdb.db.rollback()
|
||||||
|
|
||||||
if (self.settings['failOnError']):
|
if (self.settings['failOnError']):
|
||||||
self.fdb.db.commit() #dont remove this, in case hand processing was cancelled.
|
self.fdb.db.commit() #dont remove this, in case hand processing was cancelled.
|
||||||
raise
|
raise
|
||||||
if (self.settings['minPrint']!=0):
|
if (self.settings['minPrint']!=0):
|
||||||
if ((stored+duplicates+partial+errors)%self.settings['minPrint']==0):
|
if ((stored+duplicates+errors)%self.settings['minPrint']==0):
|
||||||
print "stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
|
print "stored:", stored, "duplicates:", duplicates, "errors:", errors
|
||||||
|
|
||||||
if (self.settings['handCount']!=0):
|
if (self.settings['handCount']!=0):
|
||||||
if ((stored+duplicates+partial+errors)>=self.settings['handCount']):
|
if ((stored+duplicates+errors)>=self.settings['handCount']):
|
||||||
if (not self.settings['quiet']):
|
if (not self.settings['quiet']):
|
||||||
print "quitting due to reaching the amount of hands to be imported"
|
print "quitting due to reaching the amount of hands to be imported"
|
||||||
print "Total stored:", stored, "duplicates:", duplicates, "partial/damaged:", partial, "errors:", errors, " time:", (time() - starttime)
|
print "Total stored:", stored, "duplicates:", duplicates, "errors:", errors, " time:", (time() - starttime)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
startpos=endpos
|
startpos=endpos
|
||||||
ttime = time() - starttime
|
ttime = time() - starttime
|
||||||
print "\rTotal stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors, " time:", ttime
|
print "\rTotal stored:", stored, "duplicates:", duplicates, "errors:", errors, " time:", ttime
|
||||||
|
|
||||||
if stored==0:
|
if stored==0:
|
||||||
if duplicates>0:
|
if duplicates>0:
|
||||||
|
@ -404,16 +366,11 @@ class Importer:
|
||||||
else:
|
else:
|
||||||
print "failed to read a single hand from file:", inputFile
|
print "failed to read a single hand from file:", inputFile
|
||||||
handsId=0
|
handsId=0
|
||||||
#todo: this will cause return of an unstored hand number if the last hand was error or partial
|
#todo: this will cause return of an unstored hand number if the last hand was error
|
||||||
self.fdb.db.commit()
|
self.fdb.db.commit()
|
||||||
self.handsId=handsId
|
self.handsId=handsId
|
||||||
return (stored, duplicates, partial, errors, ttime)
|
return (stored, duplicates, partial, errors, ttime)
|
||||||
|
|
||||||
def parseTourneyHistory(self):
|
|
||||||
print "Tourney history parser stub"
|
|
||||||
#Find tournament boundaries.
|
|
||||||
#print self.foabs
|
|
||||||
|
|
||||||
def printEmailErrorMessage(self, errors, filename, line):
|
def printEmailErrorMessage(self, errors, filename, line):
|
||||||
traceback.print_exc(file=sys.stderr)
|
traceback.print_exc(file=sys.stderr)
|
||||||
print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it."
|
print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it."
|
||||||
|
|
|
@ -21,7 +21,7 @@ import fpdb_simple
|
||||||
import fpdb_save_to_db
|
import fpdb_save_to_db
|
||||||
|
|
||||||
#parses a holdem hand
|
#parses a holdem hand
|
||||||
def mainParser(backend, db, cursor, site, category, hand):
|
def mainParser(backend, db, cursor, category, hand):
|
||||||
category=fpdb_simple.recogniseCategory(hand[0])
|
category=fpdb_simple.recogniseCategory(hand[0])
|
||||||
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
||||||
base="hold"
|
base="hold"
|
||||||
|
@ -35,8 +35,8 @@ def mainParser(backend, db, cursor, site, category, hand):
|
||||||
|
|
||||||
#part 1: read hand no and check for duplicate
|
#part 1: read hand no and check for duplicate
|
||||||
siteHandNo=fpdb_simple.parseSiteHandNo(hand[0])
|
siteHandNo=fpdb_simple.parseSiteHandNo(hand[0])
|
||||||
handStartTime=fpdb_simple.parseHandStartTime(hand[0], site)
|
handStartTime=fpdb_simple.parseHandStartTime(hand[0])
|
||||||
siteID=fpdb_simple.recogniseSiteID(cursor, site)
|
siteID=fpdb_simple.recogniseSiteID()
|
||||||
#print "parse logic, siteID:",siteID,"site:",site
|
#print "parse logic, siteID:",siteID,"site:",site
|
||||||
|
|
||||||
isTourney=fpdb_simple.isTourney(hand[0])
|
isTourney=fpdb_simple.isTourney(hand[0])
|
||||||
|
@ -51,8 +51,6 @@ def mainParser(backend, db, cursor, site, category, hand):
|
||||||
#print "small blind line:",smallBlindLine
|
#print "small blind line:",smallBlindLine
|
||||||
gametypeID=fpdb_simple.recogniseGametypeID(backend, db, cursor, hand[0], hand[smallBlindLine], siteID, category, isTourney)
|
gametypeID=fpdb_simple.recogniseGametypeID(backend, db, cursor, hand[0], hand[smallBlindLine], siteID, category, isTourney)
|
||||||
if isTourney:
|
if isTourney:
|
||||||
if site!="ps":
|
|
||||||
raise fpdb_simple.FpdbError("tourneys are only supported on PS right now")
|
|
||||||
siteTourneyNo=fpdb_simple.parseTourneyNo(hand[0])
|
siteTourneyNo=fpdb_simple.parseTourneyNo(hand[0])
|
||||||
buyin=fpdb_simple.parseBuyin(hand[0])
|
buyin=fpdb_simple.parseBuyin(hand[0])
|
||||||
fee=fpdb_simple.parseFee(hand[0])
|
fee=fpdb_simple.parseFee(hand[0])
|
||||||
|
@ -75,7 +73,7 @@ def mainParser(backend, db, cursor, site, category, hand):
|
||||||
seatLines.append(hand[i])
|
seatLines.append(hand[i])
|
||||||
names=fpdb_simple.parseNames(seatLines)
|
names=fpdb_simple.parseNames(seatLines)
|
||||||
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
|
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
|
||||||
tmp=fpdb_simple.parseCashesAndSeatNos(seatLines, site)
|
tmp=fpdb_simple.parseCashesAndSeatNos(seatLines)
|
||||||
startCashes=tmp['startCashes']
|
startCashes=tmp['startCashes']
|
||||||
seatNos=tmp['seatNos']
|
seatNos=tmp['seatNos']
|
||||||
|
|
||||||
|
@ -88,15 +86,15 @@ def mainParser(backend, db, cursor, site, category, hand):
|
||||||
#part 4: take appropriate action for each line based on linetype
|
#part 4: take appropriate action for each line based on linetype
|
||||||
for i in range(len(hand)):
|
for i in range(len(hand)):
|
||||||
if (lineTypes[i]=="cards"):
|
if (lineTypes[i]=="cards"):
|
||||||
fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits)
|
fpdb_simple.parseCardLine (category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits)
|
||||||
#if category=="studhilo":
|
#if category=="studhilo":
|
||||||
# print "hand[i]:", hand[i]
|
# print "hand[i]:", hand[i]
|
||||||
# print "cardValues:", cardValues
|
# print "cardValues:", cardValues
|
||||||
# print "cardSuits:", cardSuits
|
# print "cardSuits:", cardSuits
|
||||||
elif (lineTypes[i]=="action"):
|
elif (lineTypes[i]=="action"):
|
||||||
fpdb_simple.parseActionLine (site, base, isTourney, hand[i], lineStreets[i], playerIDs, names, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo)
|
fpdb_simple.parseActionLine (base, isTourney, hand[i], lineStreets[i], playerIDs, names, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo)
|
||||||
elif (lineTypes[i]=="win"):
|
elif (lineTypes[i]=="win"):
|
||||||
fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney)
|
fpdb_simple.parseWinLine (hand[i], names, winnings, isTourney)
|
||||||
elif (lineTypes[i]=="rake"):
|
elif (lineTypes[i]=="rake"):
|
||||||
if isTourney:
|
if isTourney:
|
||||||
totalRake=0
|
totalRake=0
|
||||||
|
@ -106,13 +104,11 @@ def mainParser(backend, db, cursor, site, category, hand):
|
||||||
elif (lineTypes[i]=="header" or lineTypes[i]=="rake" or lineTypes[i]=="name" or lineTypes[i]=="ignore"):
|
elif (lineTypes[i]=="header" or lineTypes[i]=="rake" or lineTypes[i]=="name" or lineTypes[i]=="ignore"):
|
||||||
pass
|
pass
|
||||||
elif (lineTypes[i]=="ante"):
|
elif (lineTypes[i]=="ante"):
|
||||||
fpdb_simple.parseAnteLine(hand[i], site, isTourney, names, antes)
|
fpdb_simple.parseAnteLine(hand[i], isTourney, names, antes)
|
||||||
elif (lineTypes[i]=="table"):
|
elif (lineTypes[i]=="table"):
|
||||||
tableResult=fpdb_simple.parseTableLine(site, base, hand[i])
|
tableResult=fpdb_simple.parseTableLine(base, hand[i])
|
||||||
else:
|
else:
|
||||||
raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
|
raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
|
||||||
if site=="ftp":
|
|
||||||
tableResult=fpdb_simple.parseTableLine(site, base, hand[0])
|
|
||||||
maxSeats=tableResult['maxSeats']
|
maxSeats=tableResult['maxSeats']
|
||||||
tableName=tableResult['tableName']
|
tableName=tableResult['tableName']
|
||||||
#print "before part5, antes:", antes
|
#print "before part5, antes:", antes
|
||||||
|
@ -127,7 +123,7 @@ def mainParser(backend, db, cursor, site, category, hand):
|
||||||
|
|
||||||
cursor.execute("SELECT limitType FROM Gametypes WHERE id=%s",(gametypeID, ))
|
cursor.execute("SELECT limitType FROM Gametypes WHERE id=%s",(gametypeID, ))
|
||||||
limit_type=cursor.fetchone()[0]
|
limit_type=cursor.fetchone()[0]
|
||||||
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
|
fpdb_simple.convert3B4B(category, limit_type, actionTypes, actionAmounts)
|
||||||
|
|
||||||
totalWinnings=0
|
totalWinnings=0
|
||||||
for i in range(len(winnings)):
|
for i in range(len(winnings)):
|
||||||
|
|
|
@ -458,7 +458,7 @@ def classifyLines(hand, category, lineTypes, lineStreets):
|
||||||
lineStreets.append(currentStreet)
|
lineStreets.append(currentStreet)
|
||||||
#end def classifyLines
|
#end def classifyLines
|
||||||
|
|
||||||
def convert3B4B(site, category, limit_type, actionTypes, actionAmounts):
|
def convert3B4B(category, limit_type, actionTypes, actionAmounts):
|
||||||
"""calculates the actual bet amounts in the given amount array and changes it accordingly."""
|
"""calculates the actual bet amounts in the given amount array and changes it accordingly."""
|
||||||
for i in xrange(len(actionTypes)):
|
for i in xrange(len(actionTypes)):
|
||||||
for j in xrange(len(actionTypes[i])):
|
for j in xrange(len(actionTypes[i])):
|
||||||
|
@ -474,11 +474,9 @@ def convert3B4B(site, category, limit_type, actionTypes, actionAmounts):
|
||||||
elif (len(bets)>2):
|
elif (len(bets)>2):
|
||||||
fail=True
|
fail=True
|
||||||
#todo: run correction for below
|
#todo: run correction for below
|
||||||
if (site=="ps" and category=="holdem" and limit_type=="nl" and len(bets)==3):
|
if (limit_type=="nl" or limit_type == "pl"):
|
||||||
fail=False
|
fail=False
|
||||||
if (site=="ftp" and category=="omahahi" and limit_type=="pl" and len(bets)==3):
|
|
||||||
fail=False
|
|
||||||
|
|
||||||
if fail:
|
if fail:
|
||||||
print "len(bets)>2 in convert3B4B, i didnt think this is possible. i:",i,"j:",j,"k:",k
|
print "len(bets)>2 in convert3B4B, i didnt think this is possible. i:",i,"j:",j,"k:",k
|
||||||
print "actionTypes:",actionTypes
|
print "actionTypes:",actionTypes
|
||||||
|
@ -600,7 +598,7 @@ def fillCardArrays(player_count, base, category, card_values, card_suits):
|
||||||
|
|
||||||
#filters out a player that folded before paying ante or blinds. This should be called
|
#filters out a player that folded before paying ante or blinds. This should be called
|
||||||
#before calling the actual hand parser. manipulates hand, no return.
|
#before calling the actual hand parser. manipulates hand, no return.
|
||||||
def filterAnteBlindFold(site,hand):
|
def filterAnteBlindFold(hand):
|
||||||
#todo: this'll only get rid of one ante folder, not multiple ones
|
#todo: this'll only get rid of one ante folder, not multiple ones
|
||||||
#todo: in tourneys this should not be removed but
|
#todo: in tourneys this should not be removed but
|
||||||
#print "start of filterAnteBlindFold"
|
#print "start of filterAnteBlindFold"
|
||||||
|
@ -614,7 +612,7 @@ def filterAnteBlindFold(site,hand):
|
||||||
if (pre3rd[i].endswith("folds") or pre3rd[i].endswith("is sitting out") or pre3rd[i].endswith(" stands up")): #found ante fold or timeout
|
if (pre3rd[i].endswith("folds") or pre3rd[i].endswith("is sitting out") or pre3rd[i].endswith(" stands up")): #found ante fold or timeout
|
||||||
pos=pre3rd[i].find (" folds")
|
pos=pre3rd[i].find (" folds")
|
||||||
foldeeName=pre3rd[i][0:pos]
|
foldeeName=pre3rd[i][0:pos]
|
||||||
if pos == -1 and " in chips)" not in pre3rd[i]:
|
if pos == -1 and pre3rd[i].find(" in chips)")==-1:
|
||||||
pos=pre3rd[i].find (" is sitting out")
|
pos=pre3rd[i].find (" is sitting out")
|
||||||
foldeeName=pre3rd[i][0:pos]
|
foldeeName=pre3rd[i][0:pos]
|
||||||
if pos==-1:
|
if pos==-1:
|
||||||
|
@ -638,7 +636,7 @@ def filterAnteBlindFold(site,hand):
|
||||||
#end def filterAnteFold
|
#end def filterAnteFold
|
||||||
|
|
||||||
#removes useless lines as well as trailing spaces
|
#removes useless lines as well as trailing spaces
|
||||||
def filterCrap(site, hand, isTourney):
|
def filterCrap(hand, isTourney):
|
||||||
#remove two trailing spaces at end of line
|
#remove two trailing spaces at end of line
|
||||||
for i in xrange (len(hand)):
|
for i in xrange (len(hand)):
|
||||||
if (hand[i][-1]==' '):
|
if (hand[i][-1]==' '):
|
||||||
|
@ -676,18 +674,8 @@ def filterCrap(site, hand, isTourney):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].endswith("is disconnected")):
|
elif (hand[i].endswith("is disconnected")):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].endswith(" is feeling angry")):
|
|
||||||
toRemove.append(hand[i])
|
|
||||||
elif (hand[i].endswith(" is feeling confused")):
|
|
||||||
toRemove.append(hand[i])
|
|
||||||
elif (hand[i].endswith(" is feeling happy")):
|
|
||||||
toRemove.append(hand[i])
|
|
||||||
elif (hand[i].endswith(" is feeling normal")):
|
|
||||||
toRemove.append(hand[i])
|
|
||||||
elif (hand[i].find(" is low with [")!=-1):
|
elif (hand[i].find(" is low with [")!=-1):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
#elif (hand[i].find("-max Seat #")!=-1 and hand[i].find(" is the button")!=-1):
|
|
||||||
# toRemove.append(hand[i])
|
|
||||||
elif (hand[i].endswith(" mucks")):
|
elif (hand[i].endswith(" mucks")):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].endswith(": mucks hand")):
|
elif (hand[i].endswith(": mucks hand")):
|
||||||
|
@ -698,8 +686,6 @@ def filterCrap(site, hand, isTourney):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].find(" shows ")!=-1 and hand[i].find("[")==-1):
|
elif (hand[i].find(" shows ")!=-1 and hand[i].find("[")==-1):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
#elif (hand[i].startswith("Table '") and hand[i].endswith("-max")):
|
|
||||||
# toRemove.append(hand[i])
|
|
||||||
elif (hand[i].startswith("The button is in seat #")):
|
elif (hand[i].startswith("The button is in seat #")):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
#above is alphabetic, reorder below if bored
|
#above is alphabetic, reorder below if bored
|
||||||
|
@ -715,12 +701,8 @@ def filterCrap(site, hand, isTourney):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].find("joins the table at seat ")!=-1):
|
elif (hand[i].find("joins the table at seat ")!=-1):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].endswith(" sits down")):
|
|
||||||
toRemove.append(hand[i])
|
|
||||||
elif (hand[i].endswith("leaves the table")):
|
elif (hand[i].endswith("leaves the table")):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].endswith(" stands up")):
|
|
||||||
toRemove.append(hand[i])
|
|
||||||
elif (hand[i].find("is high with ")!=-1):
|
elif (hand[i].find("is high with ")!=-1):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].endswith("doesn't show hand")):
|
elif (hand[i].endswith("doesn't show hand")):
|
||||||
|
@ -734,8 +716,6 @@ def filterCrap(site, hand, isTourney):
|
||||||
#site specific variable position filter
|
#site specific variable position filter
|
||||||
elif (hand[i].find(" said, \"")!=-1):
|
elif (hand[i].find(" said, \"")!=-1):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].find(": ")!=-1 and site=="ftp" and hand[i].find("Seat ")==-1 and hand[i].find(": Table")==-1): #filter ftp chat
|
|
||||||
toRemove.append(hand[i])
|
|
||||||
if isTourney:
|
if isTourney:
|
||||||
if (hand[i].endswith(" is sitting out") and (not hand[i].startswith("Seat "))):
|
if (hand[i].endswith(" is sitting out") and (not hand[i].startswith("Seat "))):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
|
@ -844,14 +824,6 @@ def isWinLine(line):
|
||||||
return True
|
return True
|
||||||
elif (line.find("ties for the low side pot")!=-1):
|
elif (line.find("ties for the low side pot")!=-1):
|
||||||
return True
|
return True
|
||||||
elif (line.find("ties for the main pot")!=-1): #for ftp tied main pot of split pot
|
|
||||||
return True
|
|
||||||
elif (line.find("ties for the pot")!=-1): #for ftp tie
|
|
||||||
return True
|
|
||||||
elif (line.find("ties for the side pot")!=-1): #for ftp tied split pots
|
|
||||||
return True
|
|
||||||
elif (line.find("wins side pot #")!=-1): #for ftp multi split pots
|
|
||||||
return True
|
|
||||||
elif (line.find("wins the low main pot")!=-1):
|
elif (line.find("wins the low main pot")!=-1):
|
||||||
return True
|
return True
|
||||||
elif (line.find("wins the low pot")!=-1):
|
elif (line.find("wins the low pot")!=-1):
|
||||||
|
@ -866,8 +838,6 @@ def isWinLine(line):
|
||||||
return True
|
return True
|
||||||
elif (line.find("wins the main pot")!=-1):
|
elif (line.find("wins the main pot")!=-1):
|
||||||
return True
|
return True
|
||||||
elif (line.find("wins the side pot")!=-1): #for ftp split pots
|
|
||||||
return True
|
|
||||||
elif (line.find("collected")!=-1):
|
elif (line.find("collected")!=-1):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -875,7 +845,7 @@ def isWinLine(line):
|
||||||
#end def isWinLine
|
#end def isWinLine
|
||||||
|
|
||||||
#returns the amount of cash/chips put into the put in the given action line
|
#returns the amount of cash/chips put into the put in the given action line
|
||||||
def parseActionAmount(line, atype, site, isTourney):
|
def parseActionAmount(line, atype, isTourney):
|
||||||
#if (line.endswith(" and is all-in")):
|
#if (line.endswith(" and is all-in")):
|
||||||
# line=line[:-14]
|
# line=line[:-14]
|
||||||
#elif (line.endswith(", and is all in")):
|
#elif (line.endswith(", and is all in")):
|
||||||
|
@ -891,18 +861,14 @@ def parseActionAmount(line, atype, site, isTourney):
|
||||||
amount=0
|
amount=0
|
||||||
elif (atype=="check"):
|
elif (atype=="check"):
|
||||||
amount=0
|
amount=0
|
||||||
elif (atype=="unbet" and site=="ftp"):
|
elif (atype=="unbet"):
|
||||||
pos1=line.find("$")+1
|
|
||||||
pos2=line.find(" returned to")
|
|
||||||
amount=float2int(line[pos1:pos2])
|
|
||||||
elif (atype=="unbet" and site=="ps"):
|
|
||||||
#print "ps unbet, line:",line
|
#print "ps unbet, line:",line
|
||||||
pos1=line.find("$")+1
|
pos1=line.find("$")+1
|
||||||
if pos1==0:
|
if pos1==0:
|
||||||
pos1=line.find("(")+1
|
pos1=line.find("(")+1
|
||||||
pos2=line.find(")")
|
pos2=line.find(")")
|
||||||
amount=float2int(line[pos1:pos2])
|
amount=float2int(line[pos1:pos2])
|
||||||
elif (atype=="bet" and site=="ps" and line.find(": raises $")!=-1 and line.find("to $")!=-1):
|
elif (atype=="bet" and line.find(": raises $")!=-1 and line.find("to $")!=-1):
|
||||||
pos=line.find("to $")+4
|
pos=line.find("to $")+4
|
||||||
amount=float2int(line[pos:])
|
amount=float2int(line[pos:])
|
||||||
else:
|
else:
|
||||||
|
@ -925,7 +891,7 @@ def parseActionAmount(line, atype, site, isTourney):
|
||||||
#doesnt return anything, simply changes the passed arrays action_types and
|
#doesnt return anything, simply changes the passed arrays action_types and
|
||||||
# action_amounts. For stud this expects numeric streets (3-7), for
|
# action_amounts. For stud this expects numeric streets (3-7), for
|
||||||
# holdem/omaha it expects predeal, preflop, flop, turn or river
|
# holdem/omaha it expects predeal, preflop, flop, turn or river
|
||||||
def parseActionLine(site, base, isTourney, line, street, playerIDs, names, action_types, allIns, action_amounts, actionNos, actionTypeByNo):
|
def parseActionLine(base, isTourney, line, street, playerIDs, names, action_types, allIns, action_amounts, actionNos, actionTypeByNo):
|
||||||
if (street=="predeal" or street=="preflop"):
|
if (street=="predeal" or street=="preflop"):
|
||||||
street=0
|
street=0
|
||||||
elif (street=="flop"):
|
elif (street=="flop"):
|
||||||
|
@ -944,7 +910,7 @@ def parseActionLine(site, base, isTourney, line, street, playerIDs, names, actio
|
||||||
line, allIn=goesAllInOnThisLine(line)
|
line, allIn=goesAllInOnThisLine(line)
|
||||||
atype=parseActionType(line)
|
atype=parseActionType(line)
|
||||||
playerno=recognisePlayerNo(line, names, atype)
|
playerno=recognisePlayerNo(line, names, atype)
|
||||||
amount=parseActionAmount(line, atype, site, isTourney)
|
amount=parseActionAmount(line, atype, isTourney)
|
||||||
|
|
||||||
action_types[street][playerno].append(atype)
|
action_types[street][playerno].append(atype)
|
||||||
allIns[street][playerno].append(allIn)
|
allIns[street][playerno].append(allIn)
|
||||||
|
@ -1005,7 +971,7 @@ def parseActionType(line):
|
||||||
#end def parseActionType
|
#end def parseActionType
|
||||||
|
|
||||||
#parses the ante out of the given line and checks which player paid it, updates antes accordingly.
|
#parses the ante out of the given line and checks which player paid it, updates antes accordingly.
|
||||||
def parseAnteLine(line, site, isTourney, names, antes):
|
def parseAnteLine(line, isTourney, names, antes):
|
||||||
for i in xrange(len(names)):
|
for i in xrange(len(names)):
|
||||||
if (line.startswith(names[i].encode("latin-1"))): #found the ante'er
|
if (line.startswith(names[i].encode("latin-1"))): #found the ante'er
|
||||||
pos=line.rfind("$")+1
|
pos=line.rfind("$")+1
|
||||||
|
@ -1031,7 +997,7 @@ def parseBuyin(topline):
|
||||||
|
|
||||||
#parses a card line and changes the passed arrays accordingly
|
#parses a card line and changes the passed arrays accordingly
|
||||||
#todo: reorganise this messy method
|
#todo: reorganise this messy method
|
||||||
def parseCardLine(site, category, street, line, names, cardValues, cardSuits, boardValues, boardSuits):
|
def parseCardLine(category, street, line, names, cardValues, cardSuits, boardValues, boardSuits):
|
||||||
if (line.startswith("Dealt to ") or line.find(" shows [")!=-1 or line.find("mucked [")!=-1):
|
if (line.startswith("Dealt to ") or line.find(" shows [")!=-1 or line.find("mucked [")!=-1):
|
||||||
playerNo=recognisePlayerNo(line, names, "card") #anything but unbet will be ok for that string
|
playerNo=recognisePlayerNo(line, names, "card") #anything but unbet will be ok for that string
|
||||||
|
|
||||||
|
@ -1105,7 +1071,7 @@ def parseCardLine(site, category, street, line, names, cardValues, cardSuits, bo
|
||||||
raise FpdbError ("unrecognised line:"+line)
|
raise FpdbError ("unrecognised line:"+line)
|
||||||
#end def parseCardLine
|
#end def parseCardLine
|
||||||
|
|
||||||
def parseCashesAndSeatNos(lines, site):
|
def parseCashesAndSeatNos(lines):
|
||||||
"""parses the startCashes and seatNos of each player out of the given lines and returns them as a dictionary of two arrays"""
|
"""parses the startCashes and seatNos of each player out of the given lines and returns them as a dictionary of two arrays"""
|
||||||
cashes = []
|
cashes = []
|
||||||
seatNos = []
|
seatNos = []
|
||||||
|
@ -1116,10 +1082,7 @@ def parseCashesAndSeatNos(lines, site):
|
||||||
pos1=lines[i].rfind("($")+2
|
pos1=lines[i].rfind("($")+2
|
||||||
if pos1==1: #for tourneys - it's 1 instead of -1 due to adding 2 above
|
if pos1==1: #for tourneys - it's 1 instead of -1 due to adding 2 above
|
||||||
pos1=lines[i].rfind("(")+1
|
pos1=lines[i].rfind("(")+1
|
||||||
if (site=="ftp"):
|
pos2=lines[i].find(" in chips")
|
||||||
pos2=lines[i].rfind(")")
|
|
||||||
elif (site=="ps"):
|
|
||||||
pos2=lines[i].find(" in chips")
|
|
||||||
cashes.append(float2int(lines[i][pos1:pos2]))
|
cashes.append(float2int(lines[i][pos1:pos2]))
|
||||||
return {'startCashes':cashes, 'seatNos':seatNos}
|
return {'startCashes':cashes, 'seatNos':seatNos}
|
||||||
#end def parseCashesAndSeatNos
|
#end def parseCashesAndSeatNos
|
||||||
|
@ -1133,7 +1096,7 @@ def parseFee(topline):
|
||||||
#end def parsefee
|
#end def parsefee
|
||||||
|
|
||||||
#returns a datetime object with the starttime indicated in the given topline
|
#returns a datetime object with the starttime indicated in the given topline
|
||||||
def parseHandStartTime(topline, site):
|
def parseHandStartTime(topline):
|
||||||
#convert x:13:35 to 0x:13:35
|
#convert x:13:35 to 0x:13:35
|
||||||
counter=0
|
counter=0
|
||||||
while (True):
|
while (True):
|
||||||
|
@ -1144,41 +1107,25 @@ def parseHandStartTime(topline, site):
|
||||||
if counter==10: break
|
if counter==10: break
|
||||||
|
|
||||||
isUTC=False
|
isUTC=False
|
||||||
if site=="ftp":
|
if topline.find("UTC")!=-1:
|
||||||
# Full Tilt Sit'n'Go
|
pos1 = topline.find("-")+2
|
||||||
# Full Tilt Poker Game #10311865543: $1 + $0.25 Sit & Go (78057629), Table 1 - 25/50 - No Limit Hold'em - 0:07:45 ET - 2009/01/29
|
pos2 = topline.find("UTC")
|
||||||
# Cash Game:
|
tmp=topline[pos1:pos2]
|
||||||
# Full Tilt Poker Game #9403951181: Table CR - tay - $0.05/$0.10 - No Limit Hold'em - 9:40:20 ET - 2008/12/09
|
isUTC=True
|
||||||
# Full Tilt Poker Game #9468383505: Table Bike (deep 6) - $0.05/$0.10 - No Limit Hold'em - 5:09:36 ET - 2008/12/13
|
|
||||||
pos = topline.find(" ", len(topline)-26)+1
|
|
||||||
tmp = topline[pos:]
|
|
||||||
|
|
||||||
rexx = '(?P<HR>[0-9]+):(?P<MIN>[0-9]+):(?P<SEC>[0-9]+) ET [\- ]+(?P<YEAR>[0-9]{4})\/(?P<MON>[0-9]{2})\/(?P<DAY>[0-9]{2})'
|
|
||||||
m = re.search(rexx,tmp)
|
|
||||||
result = datetime.datetime(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')), int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))
|
|
||||||
elif site=="ps":
|
|
||||||
if topline.find("UTC")!=-1:
|
|
||||||
pos1 = topline.find("-")+2
|
|
||||||
pos2 = topline.find("UTC")
|
|
||||||
tmp=topline[pos1:pos2]
|
|
||||||
isUTC=True
|
|
||||||
else:
|
|
||||||
tmp=topline
|
|
||||||
#print "parsehandStartTime, tmp:", tmp
|
|
||||||
pos = tmp.find("-")+2
|
|
||||||
tmp = tmp[pos:]
|
|
||||||
#Need to match either
|
|
||||||
# 2008/09/07 06:23:14 ET or
|
|
||||||
# 2008/08/17 - 01:14:43 (ET) or
|
|
||||||
# 2008/11/12 9:33:31 CET [2008/11/12 3:33:31 ET]
|
|
||||||
rexx = '(?P<YEAR>[0-9]{4})\/(?P<MON>[0-9]{2})\/(?P<DAY>[0-9]{2})[\- ]+(?P<HR>[0-9]+):(?P<MIN>[0-9]+):(?P<SEC>[0-9]+)'
|
|
||||||
m = re.search(rexx,tmp)
|
|
||||||
#print "year:", int(m.group('YEAR')), "month", int(m.group('MON')), "day", int(m.group('DAY')), "hour", int(m.group('HR')), "minute", int(m.group('MIN')), "second", int(m.group('SEC'))
|
|
||||||
result = datetime.datetime(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')), int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))
|
|
||||||
else:
|
else:
|
||||||
raise FpdbError("invalid site in parseHandStartTime")
|
tmp=topline
|
||||||
|
#print "parsehandStartTime, tmp:", tmp
|
||||||
|
pos = tmp.find("-")+2
|
||||||
|
tmp = tmp[pos:]
|
||||||
|
#Need to match either
|
||||||
|
# 2008/09/07 06:23:14 ET or
|
||||||
|
# 2008/08/17 - 01:14:43 (ET) or
|
||||||
|
# 2008/11/12 9:33:31 CET [2008/11/12 3:33:31 ET]
|
||||||
|
rexx = '(?P<YEAR>[0-9]{4})\/(?P<MON>[0-9]{2})\/(?P<DAY>[0-9]{2})[\- ]+(?P<HR>[0-9]+):(?P<MIN>[0-9]+):(?P<SEC>[0-9]+)'
|
||||||
|
m = re.search(rexx,tmp)
|
||||||
|
result = datetime.datetime(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')), int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))
|
||||||
|
|
||||||
if (site=="ftp" or site=="ps") and not isUTC: #these use US ET
|
if not isUTC: #these use US ET
|
||||||
result+=datetime.timedelta(hours=5)
|
result+=datetime.timedelta(hours=5)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -1293,42 +1240,15 @@ def parseSiteHandNo(topline):
|
||||||
return topline[pos1:pos2]
|
return topline[pos1:pos2]
|
||||||
#end def parseSiteHandNo
|
#end def parseSiteHandNo
|
||||||
|
|
||||||
def parseTableLine(site, base, line):
|
def parseTableLine(base, line):
|
||||||
"""returns a dictionary with maxSeats and tableName"""
|
"""returns a dictionary with maxSeats and tableName"""
|
||||||
if site=="ps":
|
pos1=line.find('\'')+1
|
||||||
pos1=line.find('\'')+1
|
pos2=line.find('\'', pos1)
|
||||||
pos2=line.find('\'', pos1)
|
#print "table:",line[pos1:pos2]
|
||||||
#print "table:",line[pos1:pos2]
|
pos3=pos2+2
|
||||||
pos3=pos2+2
|
pos4=line.find("-max")
|
||||||
pos4=line.find("-max")
|
#print "seats:",line[pos3:pos4]
|
||||||
#print "seats:",line[pos3:pos4]
|
return {'maxSeats':int(line[pos3:pos4]), 'tableName':line[pos1:pos2]}
|
||||||
return {'maxSeats':int(line[pos3:pos4]), 'tableName':line[pos1:pos2]}
|
|
||||||
elif site=="ftp":
|
|
||||||
pos1=line.find("Table ")+6
|
|
||||||
pos2=line.find("-")-1
|
|
||||||
if base=="hold":
|
|
||||||
maxSeats=9
|
|
||||||
elif base=="stud":
|
|
||||||
maxSeats=8
|
|
||||||
|
|
||||||
if line.find("6 max")!=-1:
|
|
||||||
maxSeats=6
|
|
||||||
elif line.find("4 max")!=-1:
|
|
||||||
maxSeats=4
|
|
||||||
elif line.find("heads up")!=-1:
|
|
||||||
maxSeats=2
|
|
||||||
|
|
||||||
tableName = line[pos1:pos2]
|
|
||||||
for pattern in [' \(6 max\)', ' \(heads up\)', ' \(deep\)',
|
|
||||||
' \(deep hu\)', ' \(deep 6\)', ' \(2\)',
|
|
||||||
' \(edu\)', ' \(edu, 6 max\)', ' \(6\)',
|
|
||||||
' \(speed\)',
|
|
||||||
' no all-in', ' fast', ',', ' 50BB min', '\s+$']:
|
|
||||||
tableName = re.sub(pattern, '', tableName)
|
|
||||||
tableName = tableName.rstrip()
|
|
||||||
return {'maxSeats':maxSeats, 'tableName':tableName}
|
|
||||||
else:
|
|
||||||
raise FpdbError("invalid site ID")
|
|
||||||
#end def parseTableLine
|
#end def parseTableLine
|
||||||
|
|
||||||
#returns the hand no assigned by the poker site
|
#returns the hand no assigned by the poker site
|
||||||
|
@ -1340,23 +1260,17 @@ def parseTourneyNo(topline):
|
||||||
#end def parseTourneyNo
|
#end def parseTourneyNo
|
||||||
|
|
||||||
#parses a win/collect line. manipulates the passed array winnings, no explicit return
|
#parses a win/collect line. manipulates the passed array winnings, no explicit return
|
||||||
def parseWinLine(line, site, names, winnings, isTourney):
|
def parseWinLine(line, names, winnings, isTourney):
|
||||||
#print "parseWinLine: line:",line
|
#print "parseWinLine: line:",line
|
||||||
for i in xrange(len(names)):
|
for i in xrange(len(names)):
|
||||||
if (line.startswith(names[i].encode("latin-1"))): #found a winner
|
if (line.startswith(names[i].encode("latin-1"))): #found a winner
|
||||||
if isTourney:
|
if isTourney:
|
||||||
pos1=line.rfind("collected ")+10
|
pos1=line.rfind("collected ")+10
|
||||||
if (site=="ftp"):
|
pos2=line.find(" ", pos1)
|
||||||
pos2=line.find(")", pos1)
|
|
||||||
elif (site=="ps"):
|
|
||||||
pos2=line.find(" ", pos1)
|
|
||||||
winnings[i]+=int(line[pos1:pos2])
|
winnings[i]+=int(line[pos1:pos2])
|
||||||
else:
|
else:
|
||||||
pos1=line.rfind("$")+1
|
pos1=line.rfind("$")+1
|
||||||
if (site=="ftp"):
|
pos2=line.find(" ", pos1)
|
||||||
pos2=line.find(")", pos1)
|
|
||||||
elif (site=="ps"):
|
|
||||||
pos2=line.find(" ", pos1)
|
|
||||||
winnings[i]+=float2int(line[pos1:pos2])
|
winnings[i]+=float2int(line[pos1:pos2])
|
||||||
#end def parseWinLine
|
#end def parseWinLine
|
||||||
|
|
||||||
|
@ -1400,10 +1314,7 @@ def recogniseGametypeID(backend, db, cursor, topline, smallBlindLine, site_id, c
|
||||||
pos1=pos2+2
|
pos1=pos2+2
|
||||||
if isTourney:
|
if isTourney:
|
||||||
pos1-=1
|
pos1-=1
|
||||||
if (site_id==1): #ftp
|
pos2=topline.find(")")
|
||||||
pos2=topline.find(" ", pos1)
|
|
||||||
elif (site_id==2): #ps
|
|
||||||
pos2=topline.find(")")
|
|
||||||
|
|
||||||
if pos2<=pos1:
|
if pos2<=pos1:
|
||||||
pos2=topline.find(")", pos1)
|
pos2=topline.find(")", pos1)
|
||||||
|
@ -1543,27 +1454,8 @@ def recognisePlayerNo(line, names, atype):
|
||||||
raise FpdbError ("failed to recognise player in: "+line+" atype:"+atype)
|
raise FpdbError ("failed to recognise player in: "+line+" atype:"+atype)
|
||||||
#end def recognisePlayerNo
|
#end def recognisePlayerNo
|
||||||
|
|
||||||
#returns the site abbreviation for the given site
|
def recogniseSiteID():
|
||||||
def recogniseSite(line):
|
return 2
|
||||||
if (line.startswith("Full Tilt Poker")):
|
|
||||||
return "ftp"
|
|
||||||
elif (line.startswith("PokerStars")):
|
|
||||||
return "ps"
|
|
||||||
else:
|
|
||||||
raise FpdbError("failed to recognise site, line:"+line)
|
|
||||||
#end def recogniseSite
|
|
||||||
|
|
||||||
#returns the ID of the given site
|
|
||||||
def recogniseSiteID(cursor, site):
|
|
||||||
if (site=="ftp"):
|
|
||||||
return 1
|
|
||||||
#cursor.execute("SELECT id FROM Sites WHERE name = ('Full Tilt Poker')")
|
|
||||||
elif (site=="ps"):
|
|
||||||
return 2
|
|
||||||
#cursor.execute("SELECT id FROM Sites WHERE name = ('PokerStars')")
|
|
||||||
else:
|
|
||||||
raise FpdbError("invalid site in recogniseSiteID: "+site)
|
|
||||||
return cursor.fetchall()[0][0]
|
|
||||||
#end def recogniseSiteID
|
#end def recogniseSiteID
|
||||||
|
|
||||||
#removes trailing \n from the given array
|
#removes trailing \n from the given array
|
||||||
|
|
Loading…
Reference in New Issue
Block a user