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-backend=2
db-host=localhost db-host=localhost
db-databaseName=fpdb db-databaseName=fpdb
db-user=fpdb db-user=fpdb
db-password=enterYourPwHere db-password=enterYourPwHere
tv-combinedStealFold=True imp-callFpdbHud=True
tv-combined2B3B=True tv-combinedStealFold=True
tv-combinedPostflop=True tv-combined2B3B=True
bulkImport-defaultPath=default tv-combinedPostflop=True
hud-defaultPath=default 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) alpha2 (release by 17Aug)
====== ======
change config file to windows line endings
seperate and improve instructions for update 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 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 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 re-run existing regression tests
alpha3 alpha3
====== ======
export imp-callFpdbHud to .conf
make it work with postgres
expand instructions for profile file
ftp: read maxSeats ftp: read maxSeats
add sf.net logo to webpage add sf.net logo to webpage
separate db table design version and last bugfix in importer 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" print "AutoImport is not recursive - please select the final directory in which the history files are"
else: else:
self.inputFile=self.path+os.sep+file 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" print "GuiBulkImport.import_dir done"
interval=int(self.intervalTBuffer.get_text(self.intervalTBuffer.get_start_iter(), self.intervalTBuffer.get_end_iter())) 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" print "BulkImport is not recursive - please select the final directory in which the history files are"
else: else:
self.inputFile=self.path+os.sep+file 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" print "GuiBulkImport.import_dir done"
def load_clicked(self, widget, data=None): def load_clicked(self, widget, data=None):

View File

@ -248,6 +248,7 @@ class fpdb:
self.settings['os']="windows" self.settings['os']="windows"
self.settings['tv-combinedStealFold']=True self.settings['tv-combinedStealFold']=True
self.settings['tv-combined2B3B']=True self.settings['tv-combined2B3B']=True
self.settings['imp-callFpdbHud']=True
if self.settings['os']=="windows": if self.settings['os']=="windows":
self.settings['bulkImport-defaultPath']="C:\\Program Files\\PokerStars\\HandHistory\\filename.txt" 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] self.settings['db-user']=lines[i][8:-1]
elif lines[i].startswith("db-password="): elif lines[i].startswith("db-password="):
self.settings['db-password']=lines[i][12:-1] 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="): elif lines[i].startswith("tv-combinedPostflop="):
if lines[i].find("True")!=-1: if lines[i].find("True")!=-1:
self.settings['tv-combinedPostflop']=True 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 = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event) self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy) 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_border_width(1)
self.window.set_size_request(1020,400) self.window.set_size_request(1020,400)
self.window.set_resizable(True) self.window.set_resizable(True)

View File

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

View File

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