Merge branch 'master' of git://git.assembla.com/free_poker_tools
This commit is contained in:
commit
59cfcea95d
|
@ -15,6 +15,9 @@
|
||||||
#In the "official" distribution you can find the license in
|
#In the "official" distribution you can find the license in
|
||||||
#agpl-3.0.txt in the docs folder of the package.
|
#agpl-3.0.txt in the docs folder of the package.
|
||||||
|
|
||||||
|
#fpdb modules
|
||||||
|
import Card
|
||||||
|
|
||||||
class DerivedStats():
|
class DerivedStats():
|
||||||
def __init__(self, hand):
|
def __init__(self, hand):
|
||||||
self.hand = hand
|
self.hand = hand
|
||||||
|
@ -88,6 +91,70 @@ class DerivedStats():
|
||||||
self.street3CheckCallRaiseDone = 0
|
self.street3CheckCallRaiseDone = 0
|
||||||
self.street4CheckCallRaiseChance = 0
|
self.street4CheckCallRaiseChance = 0
|
||||||
self.street4CheckCallRaiseDone = 0
|
self.street4CheckCallRaiseDone = 0
|
||||||
|
|
||||||
|
self.hands = {}
|
||||||
|
self.handsplayers = {}
|
||||||
|
|
||||||
def getStats():
|
def getStats(self, hand):
|
||||||
pass
|
|
||||||
|
for player in hand.players:
|
||||||
|
self.handsplayers[player[1]] = {}
|
||||||
|
|
||||||
|
self.assembleHands(self.hand)
|
||||||
|
self.assembleHandsPlayers(self.hand)
|
||||||
|
|
||||||
|
print "hands =", self.hands
|
||||||
|
print "handsplayers =", self.handsplayers
|
||||||
|
|
||||||
|
def assembleHands(self, hand):
|
||||||
|
self.hands['tableName'] = hand.tablename
|
||||||
|
self.hands['siteHandNo'] = hand.handid
|
||||||
|
self.hands['gametypeId'] = None # Leave None, handled later after checking db
|
||||||
|
self.hands['handStart'] = hand.starttime # format this!
|
||||||
|
self.hands['importTime'] = None
|
||||||
|
self.hands['seats'] = self.countPlayers(hand)
|
||||||
|
self.hands['maxSeats'] = hand.maxseats
|
||||||
|
self.hands['boardcard1'] = None
|
||||||
|
self.hands['boardcard2'] = None
|
||||||
|
self.hands['boardcard3'] = None
|
||||||
|
self.hands['boardcard4'] = None
|
||||||
|
self.hands['boardcard5'] = None
|
||||||
|
|
||||||
|
boardCard = 1
|
||||||
|
for street in hand.communityStreets:
|
||||||
|
for card in hand.board[street]:
|
||||||
|
self.hands['boardcard%s' % str(boardCard)] = Card.encodeCard(card)
|
||||||
|
boardCard += 1
|
||||||
|
|
||||||
|
def assembleHandsPlayers(self, hand):
|
||||||
|
self.vpip(self.hand)
|
||||||
|
for i, street in enumerate(hand.actionStreets[1:]):
|
||||||
|
self.aggr(self.hand, i)
|
||||||
|
|
||||||
|
def vpip(self, hand):
|
||||||
|
vpipers = set()
|
||||||
|
for act in hand.actions[hand.actionStreets[1]]:
|
||||||
|
if act[1] in ('calls','bets', 'raises'):
|
||||||
|
vpipers.add(act[0])
|
||||||
|
|
||||||
|
for player in hand.players:
|
||||||
|
if player[1] in vpipers:
|
||||||
|
self.handsplayers[player[1]]['vpip'] = True
|
||||||
|
else:
|
||||||
|
self.handsplayers[player[1]]['vpip'] = False
|
||||||
|
self.hands['playersVpi'] = len(vpipers)
|
||||||
|
|
||||||
|
def aggr(self, hand, i):
|
||||||
|
aggrers = set()
|
||||||
|
for act in hand.actions[hand.actionStreets[i]]:
|
||||||
|
if act[1] in ('completes', 'raises'):
|
||||||
|
aggrers.add(act[0])
|
||||||
|
|
||||||
|
for player in hand.players:
|
||||||
|
if player[1] in aggrers:
|
||||||
|
self.handsplayers[player[1]]['street%sAggr' % i] = True
|
||||||
|
else:
|
||||||
|
self.handsplayers[player[1]]['street%sAggr' % i] = False
|
||||||
|
|
||||||
|
def countPlayers(self, hand):
|
||||||
|
pass
|
|
@ -165,7 +165,7 @@ class GuiBulkImport():
|
||||||
self.lab_threads.set_alignment(1.0, 0.5)
|
self.lab_threads.set_alignment(1.0, 0.5)
|
||||||
|
|
||||||
# spin button - threads
|
# spin button - threads
|
||||||
threads_adj = gtk.Adjustment(value=0, lower=0, upper=10, step_incr=1, page_incr=1, page_size=0) #not sure what upper value should be!
|
threads_adj = gtk.Adjustment(value=0, lower=0, upper=32, step_incr=1, page_incr=1, page_size=0) #not sure what upper value should be!
|
||||||
self.spin_threads = gtk.SpinButton(adjustment=threads_adj, climb_rate=0.0, digits=0)
|
self.spin_threads = gtk.SpinButton(adjustment=threads_adj, climb_rate=0.0, digits=0)
|
||||||
self.table.attach(self.spin_threads, 4, 5, 0, 1, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
self.table.attach(self.spin_threads, 4, 5, 0, 1, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||||
self.spin_threads.show()
|
self.spin_threads.show()
|
||||||
|
|
|
@ -204,7 +204,9 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py.
|
||||||
logging.info("Unsupported game type: %s" % gametype)
|
logging.info("Unsupported game type: %s" % gametype)
|
||||||
|
|
||||||
if hand:
|
if hand:
|
||||||
|
# uncomment these to calculate some stats
|
||||||
# print hand
|
# print hand
|
||||||
|
# hand.stats.getStats(hand)
|
||||||
hand.writeHand(self.out_fh)
|
hand.writeHand(self.out_fh)
|
||||||
return hand
|
return hand
|
||||||
else:
|
else:
|
||||||
|
|
1
pyfpdb/makeexe.bat
Normal file
1
pyfpdb/makeexe.bat
Normal file
|
@ -0,0 +1 @@
|
||||||
|
python makeexe.py py2exe
|
10
pyfpdb/makeexe.py
Normal file
10
pyfpdb/makeexe.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from distutils.core import setup
|
||||||
|
import py2exe
|
||||||
|
opts = {
|
||||||
|
'py2exe': {
|
||||||
|
'includes': "pango,atk,gobject",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setup(name='Free Poker Database', version='0.12', console=[{"script":"fpdb.py"}])
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
|
|
||||||
# create .bat scripts in windows to try out different gtk dirs
|
# create .bat scripts in windows to try out different gtk dirs
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
if os.name != 'nt':
|
if os.name != 'nt':
|
||||||
print "\nThis script is only for windows\n"
|
print "\nThis script is only for windows\n"
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
dirs = re.split(os.pathsep, os.environ['PATH'])
|
dirs = re.split(os.pathsep, os.environ['PATH'])
|
||||||
# remove any trailing / or \ chars from dirs:
|
# remove any trailing / or \ chars from dirs:
|
||||||
dirs = [re.sub('[\\/]$','',p) for p in dirs]
|
dirs = [re.sub('[\\/]$','',p) for p in dirs]
|
||||||
# remove any dirs containing 'python' apart from those ending in 'python25', 'python26' or 'python':
|
# remove any dirs containing 'python' apart from those ending in 'python25', 'python26' or 'python':
|
||||||
dirs = [p for p in dirs if not re.search('python', p, re.I) or re.search('python25$', p, re.I) or re.search('python26$', p, re.I)]
|
dirs = [p for p in dirs if not re.search('python', p, re.I) or re.search('python25$', p, re.I) or re.search('python26$', p, re.I)]
|
||||||
# find gtk dirs:
|
# find gtk dirs:
|
||||||
gtkdirs = [p for p in dirs if re.search('gtk', p, re.I)]
|
gtkdirs = [p for p in dirs if re.search('gtk', p, re.I)]
|
||||||
|
|
||||||
lines = [ '@echo off\n\n'
|
lines = [ '@echo off\n\n'
|
||||||
, '<path goes here>'
|
, '<path goes here>'
|
||||||
, 'python fpdb.py\n\n'
|
, 'python fpdb.py\n\n'
|
||||||
, 'pause\n\n'
|
, 'pause\n\n'
|
||||||
]
|
]
|
||||||
if gtkdirs:
|
if gtkdirs:
|
||||||
i = 1
|
i = 1
|
||||||
for gpath in gtkdirs: # enumerate converts the \\ into \
|
for gpath in gtkdirs: # enumerate converts the \\ into \
|
||||||
tmpdirs = [p for p in dirs if not re.search('gtk', p, re.I) or p == gpath]
|
tmpdirs = [p for p in dirs if not re.search('gtk', p, re.I) or p == gpath]
|
||||||
tmppath = ";".join(tmpdirs)
|
tmppath = ";".join(tmpdirs)
|
||||||
lines[1] = 'PATH=' + tmppath + '\n\n'
|
lines[1] = 'PATH=' + tmppath + '\n\n'
|
||||||
bat = open('run_fpdb'+str(i)+'.bat', 'w')
|
bat = open('run_fpdb'+str(i)+'.bat', 'w')
|
||||||
bat.writelines(lines)
|
bat.writelines(lines)
|
||||||
bat.close()
|
bat.close()
|
||||||
i = i + 1
|
i = i + 1
|
||||||
else:
|
else:
|
||||||
print "\nno gtk directories found in your path - install gtk or edit the path manually\n"
|
print "\nno gtk directories found in your path - install gtk or edit the path manually\n"
|
||||||
|
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print "Error:", str(sys.exc_info())
|
print "Error:", str(sys.exc_info())
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# sys.stdin.readline()
|
# sys.stdin.readline()
|
||||||
|
|
42
utils/fix_table_desc.py
Normal file
42
utils/fix_table_desc.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
desc = """
|
||||||
|
+-------------+---------------------+------+-----+---------+----------------+
|
||||||
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
|
+-------------+---------------------+------+-----+---------+----------------+
|
||||||
|
| id | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
|
||||||
|
| tourneyId | int(10) unsigned | NO | MUL | NULL | |
|
||||||
|
| playerId | int(10) unsigned | NO | MUL | NULL | |
|
||||||
|
| payinAmount | int(11) | NO | | NULL | |
|
||||||
|
| rank | int(11) | NO | | NULL | |
|
||||||
|
| winnings | int(11) | NO | | NULL | |
|
||||||
|
| comment | text | YES | | NULL | |
|
||||||
|
| commentTs | datetime | YES | | NULL | |
|
||||||
|
+-------------+---------------------+------+-----+---------+----------------+
|
||||||
|
"""
|
||||||
|
|
||||||
|
table = """
|
||||||
|
{| border="1"
|
||||||
|
|+Gametypes Table
|
||||||
|
"""
|
||||||
|
|
||||||
|
# get rid of the verticle spacing and clean up
|
||||||
|
desc = re.sub("[\+\-]+", "", desc)
|
||||||
|
desc = re.sub("^\n+", "", desc) # there's probably a better way
|
||||||
|
desc = re.sub("\n\n", "\n", desc)
|
||||||
|
|
||||||
|
# the first line is the header info
|
||||||
|
temp, desc = re.split("\n", desc, 1)
|
||||||
|
temp = re.sub("\|", "!", temp)
|
||||||
|
temp = re.sub(" !", " !!", temp)
|
||||||
|
table += temp + " Comments\n"
|
||||||
|
|
||||||
|
# the rest is he body of the table
|
||||||
|
for line in re.split("\n", desc):
|
||||||
|
line = re.sub(" \|", " ||", line)
|
||||||
|
table += "|+\n" + line + "\n"
|
||||||
|
|
||||||
|
table += "|}\n"
|
||||||
|
print table
|
Loading…
Reference in New Issue
Block a user