p57 - added optional call to hud into importer

changed config file to windows line endings
started updating print_hand to new tables
This commit is contained in:
steffen123 2008-08-18 15:41:34 +01:00
parent 660530a166
commit 928e7262f4
7 changed files with 75 additions and 57 deletions

View File

@ -1,10 +1,11 @@
db-backend=2
db-host=localhost
db-databaseName=fpdb
db-user=fpdb
db-password=enterYourPwHere
tv-combinedStealFold=True
tv-combined2B3B=True
tv-combinedPostflop=True
bulkImport-defaultPath=default
hud-defaultPath=default
db-backend=2
db-host=localhost
db-databaseName=fpdb
db-user=fpdb
db-password=enterYourPwHere
imp-callFpdbHud=True
tv-combinedStealFold=True
tv-combined2B3B=True
tv-combinedPostflop=True
bulkImport-defaultPath=default
hud-defaultPath=default

View File

@ -3,15 +3,17 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug)
======
change config file to windows line endings
seperate and improve instructions for update
expand instructions for profile file
update status or make a support matrix table for website
add instructions for mailing list to contacts
ebuild: symlink doesnt work, USE gtk, more automation, update install-in-gentoo.txt, set permissions in it, copy docs to correct place, use games eclass or whatever to get games group notice, print notice about install-in-gentoo.txt and mysql --config
re-run existing regression tests
alpha3
======
export imp-callFpdbHud to .conf
make it work with postgres
expand instructions for profile file
ftp: read maxSeats
add sf.net logo to webpage
separate db table design version and last bugfix in importer

View File

@ -54,7 +54,7 @@ class GuiAutoImport (threading.Thread):
print "AutoImport is not recursive - please select the final directory in which the history files are"
else:
self.inputFile=self.path+os.sep+file
fpdb_import.import_file_dict(self)
fpdb_import.import_file_dict(self, self.settings)
print "GuiBulkImport.import_dir done"
interval=int(self.intervalTBuffer.get_text(self.intervalTBuffer.get_start_iter(), self.intervalTBuffer.get_end_iter()))

View File

@ -32,7 +32,7 @@ class GuiBulkImport (threading.Thread):
print "BulkImport is not recursive - please select the final directory in which the history files are"
else:
self.inputFile=self.path+os.sep+file
fpdb_import.import_file_dict(self)
fpdb_import.import_file_dict(self, self.settings)
print "GuiBulkImport.import_dir done"
def load_clicked(self, widget, data=None):

View File

@ -248,6 +248,7 @@ class fpdb:
self.settings['os']="windows"
self.settings['tv-combinedStealFold']=True
self.settings['tv-combined2B3B']=True
self.settings['imp-callFpdbHud']=True
if self.settings['os']=="windows":
self.settings['bulkImport-defaultPath']="C:\\Program Files\\PokerStars\\HandHistory\\filename.txt"
@ -269,6 +270,11 @@ class fpdb:
self.settings['db-user']=lines[i][8:-1]
elif lines[i].startswith("db-password="):
self.settings['db-password']=lines[i][12:-1]
elif lines[i].startswith("imp-callFpdbHud="):
if lines[i].find("True")!=-1:
self.settings['imp-callFpdbHud']=True
else:
self.settings['imp-callFpdbHud']=False
elif lines[i].startswith("tv-combinedPostflop="):
if lines[i].find("True")!=-1:
self.settings['tv-combinedPostflop']=True
@ -370,7 +376,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: alpha1+, p56")
self.window.set_title("Free Poker DB - version: alpha1+, p57")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)

View File

@ -34,9 +34,10 @@ def import_file(server, database, user, password, inputFile):
self.user=user
self.password=password
self.inputFile=inputFile
import_file_dict(self)
self.settings={'imp-callFpdbHud':False}
import_file_dict(self, settings)
def import_file_dict(options):
def import_file_dict(options, settings):
last_read_hand=0
if (options.inputFile=="stdin"):
inputFile=sys.stdin
@ -99,15 +100,14 @@ def import_file_dict(options):
hand=fpdb_simple.filterCrap(site, hand, isTourney)
try:
if (category=="holdem" or category=="omahahi" or category=="omahahilo" or category=="razz" or category=="studhi" or category=="studhilo"):
if (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz currently out of order")
last_read_hand=fpdb_parse_logic.mainParser(db, cursor, site, category, hand)
db.commit()
else:
raise fpdb_simple.FpdbError ("invalid category")
if (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz currently out of order")
last_read_hand=fpdb_parse_logic.mainParser(db, cursor, site, category, hand)
db.commit()
stored+=1
if settings['imp-callFpdbHud']:
print "call to HUD here"
db.commit()
except fpdb_simple.DuplicateError:
duplicates+=1

View File

@ -23,7 +23,7 @@ from optparse import OptionParser
import fpdb_util_lib as ful
parser = OptionParser()
parser.add_option("-n", "--hand_number", "--hand", type="int",
parser.add_option("-n", "--handNumber", "--hand", type="int",
help="Number of the hand to print")
parser.add_option("-p", "--password", help="The password for the MySQL user")
parser.add_option("-s", "--site", default="PokerStars",
@ -31,52 +31,61 @@ parser.add_option("-s", "--site", default="PokerStars",
(options, sys.argv) = parser.parse_args()
if options.hand_number==None or options.site==None:
if options.handNumber==None or options.site==None:
print "please supply a hand number and site name. TODO: make this work"
db = MySQLdb.connect("localhost", "fpdb", options.password, "fpdb")
cursor = db.cursor()
print "Connected to MySQL on localhost. Print Hand Utility"
cursor.execute("SELECT id FROM sites WHERE name=%s", (options.site,))
site_id=cursor.fetchone()[0]
print "options.site:",options.site,"site_id:",site_id
cursor.execute("SELECT id FROM Sites WHERE name=%s", (options.site,))
siteId=cursor.fetchone()[0]
print "options.site:",options.site,"siteId:",siteId
cursor.execute("""SELECT hands.* FROM hands INNER JOIN gametypes
ON hands.gametype_id = gametypes.id WHERE gametypes.site_id=%s AND hands.site_hand_no=%s""",
(site_id, options.hand_number))
hands_result=cursor.fetchone()
gametype_id=hands_result[2]
site_hand_no=options.hand_number
hand_id=hands_result[0]
hand_start=hands_result[3]
seat_count=hands_result[4]
print ""
print "From Table Hands"
print "================"
cursor.execute("""SELECT Hands.* FROM Hands INNER JOIN Gametypes
ON Hands.gametypeId = Gametypes.id WHERE Gametypes.siteId=%s AND Hands.siteHandNo=%s""",
(siteId, options.handNumber))
handsResult=cursor.fetchone()
handId=handsResult[0]
tableName=handsResult[1]
siteHandNo=options.handNumber
gametypeId=handsResult[3]
handStart=handsResult[4]
#skip importTime
seats=handsResult[6]
maxSeats=handsResult[7]
print "handId:", handId, " tableName:", tableName, " siteHandNo:", siteHandNo, " gametypeId:", gametypeId, " handStart:", handStart, " seats:", seats, " maxSeats:", maxSeats
print ""
print "From Table gametypes"
print "From Table Gametypes"
print "===================="
cursor.execute("""SELECT type, category, limit_type FROM gametypes WHERE id=%s""",
(gametype_id, ))
type_etc=cursor.fetchone()
type=type_etc[0]
category=type_etc[1]
limit_type=type_etc[2]
print "type:", type, " category:", category, " limit_type:", limit_type
cursor.execute("""SELECT type, base, category, limitType, hiLo FROM Gametypes WHERE id=%s""", (gametypeId, ))
typeEtc=cursor.fetchone()
type=typeEtc[0]
base=typeEtc[1]
category=typeEtc[2]
limitType=typeEtc[3]
hiLo=typeEtc[4]
print "type:", type, " base:", base, " category:", category, " limitType:", limitType, " hiLo:", hiLo
gt_string=""
do_bets=False
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
cursor.execute("SELECT small_blind FROM gametypes WHERE id=%s", (gametype_id, ))
gtString=""
doBets=False
if base=="hold":
cursor.execute("SELECT smallBlind FROM Gametypes WHERE id=%s", (gametypeId, ))
sb=cursor.fetchone()[0]
cursor.execute("SELECT big_blind FROM gametypes WHERE id=%s", (gametype_id, ))
cursor.execute("SELECT bigBlind FROM Gametypes WHERE id=%s", (gametypeId, ))
bb=cursor.fetchone()[0]
gt_string=("sb: "+str(sb)+" bb: "+str(bb))
if (limit_type=="fl"):
do_bets=True
elif (category=="razz" or category=="studhi" or category=="studhilo"):
do_bets=True
gtString=("sb: "+str(sb)+" bb: "+str(bb))
if (limitType=="fl"):
doBets=True
elif base=="stud":
doBets=True
if do_bets:
cursor.execute("SELECT small_bet FROM gametypes WHERE id=%s", (gametype_id, ))