Merge branch 'carl'

Conflicts:
	packaging/debian/changelog
	pyfpdb/PokerStarsToFpdb.py
	pyfpdb/TourneySummary.py
This commit is contained in:
steffen123 2010-07-08 22:33:09 +02:00
commit 3bff176970
24 changed files with 211 additions and 60 deletions

View File

@ -23,3 +23,7 @@ all:
snapshot:
git tag $(VERSION)-$(DATE)
git archive --prefix=fpdb-$(VERSION)-$(DATE)/ $(VERSION)-$(DATE) | gzip -9 > ../fpdb-$(VERSION)-$(DATE).tar.gz
release:
git tag $(VERSION)
git archive --prefix=fpdb-$(VERSION)/ $(VERSION) | gzip -9 > ../fpdb-$(VERSION).tar.gz

View File

@ -5,5 +5,5 @@ Exec=/usr/bin/fpdb
Icon=fpdb-icon.png
Terminal=true
Type=Application
Categories=Utility
Categories=Utility;GTK;Application

View File

@ -1,8 +1,8 @@
free-poker-tools (0.20~git20100616) unstable; urgency=low
free-poker-tools (0.20~git20100630) unstable; urgency=low
* Snapshot release
* Executable names have been changed to accommodate for some win32
trouble cases; update paths
trouble cases; install these files manually to build-tree
* Improved statistics
-- Mika Bostrom <bostik+fpdb@bostik.iki.fi> Wed, 16 Jun 2010 08:10:00 +0300

View File

@ -23,6 +23,13 @@ install: build
dh_installdirs
#
python setup.py install --root=debian/$(PACKAGE) --prefix=/usr --no-compile
# Copy *.pyw manually in packaging tree
cp pyfpdb/*.pyw debian/$(PACKAGE)/usr/lib/python2.6/site-packages/fpdb/
# Remove scripts that are only useful in win32
rm debian/$(PACKAGE)/usr/lib/python2.6/site-packages/fpdb//windows_make_bats.py
rm debian/$(PACKAGE)/usr/lib/python2.6/site-packages/fpdb/makeexe.py
rm debian/$(PACKAGE)/usr/lib/python2.6/site-packages/fpdb/py2exe_setup.py
binary-indep: build install
dh_testdir

View File

@ -1,11 +1,9 @@
Create MySqlPython windows installer for Python26
created by Gimick on 29th June 2010
Create MySqlPython version 1.2.2 windows installer for Python26
The FPDB exe needs to build against the MySql-Python project. Unfortunately, for python 2.6 there is no official installer for windows, and none is ever likely to be provided.
Community builds are available, but to reduce third-party dependencies, we will build our own here.
This walkthrough is derived from excellent installation instructions here ... http://www.bcspcsonline.com/wiki/index.php?title=MySQL-5.1.34_Python-2.6_Module_Build_Instructions
This walkthrough is derived from excellent installation instructions released under GNU Free Documentation License 1.2. The original work is here ... http://www.bcspcsonline.com/wiki/index.php?title=MySQL-5.1.34_Python-2.6_Module_Build_Instructions The Wiki author appears to be "Irondesk"
This version by Gimick on 29th June 2010
Content is available under GNU Free Documentation License 1.2
Step 0 Get a fresh XP installation
----------------------------------

View File

@ -1,12 +1,18 @@
Create MySqlPython windows installer for Python26
created by Gimick on 29th June 2010
Create MySqlPython version 1.2.3 windows installer for Python26
This walkthrough is derived from excellent installation instructions released under GNU Free Documentation License 1.2. The original work is here ... http://www.bcspcsonline.com/wiki/index.php?title=MySQL-5.1.34_Python-2.6_Module_Build_Instructions The Wiki author appears to be "Irondesk"
This version by Gimick on 29th June 2010
Content is available under GNU Free Documentation License 1.2
Premamble
---------
The FPDB exe needs to build against the MySql-Python project. Unfortunately, for python 2.6 there is no official installer for windows, and none is ever likely to be provided.
Community builds are available, but to reduce third-party dependencies, we will build our own here.
This walkthrough is derived from excellent installation instructions here ... http://www.bcspcsonline.com/wiki/index.php?title=MySQL-5.1.34_Python-2.6_Module_Build_Instructions
Step 0 Get a fresh XP installation
----------------------------------

View File

@ -1,20 +1,27 @@
PY2EXE walkthrough for Python 2.6 & FPDB 0.20
created by Gimick on 22nd June 2010
created on 22nd June 2010 by Gimick
This walkthrough is derived from comments in the py2exe script made by Ray and SqlCoder
Additional information, formatting, updating to Python 2.6 and sequencing added by Gimick
Content is available under the the GNU Affero General Public License version 3
Step 0 Get a fresh XP installation
----------------------------------
0.1/ Using XPhome 32bit
0.1/ Using XPhome or Pro 32bit
Step 1, Python install
----------------------
0.2/ Ensure the CPU supports SSE2 instruction set or better.
Step 1, dependency install
--------------------------
1.1/ install the following in sequence (accept all default options) there should be no errors !
Python 2.6.5 ... http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi
pywin 214 ... http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/pywin32-214.win32-py2.6.exe/download
numpy 1.4.1 ... http://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1-win32-superpack-python2.6.exe/download
matplotlib 0.99.3 ... http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.3/matplotlib-0.99.3.win32-py2.6.exe/download
pygtk 2.16.0 ... http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.16/pygtk-2.16.0.win32-py2.6.exe
pycairo 1.8.6 ... http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.8/pycairo-1.8.6.win32-py2.6.exe
@ -65,21 +72,60 @@ dos>path ... system should respond with ... PATH=c:\GTK\bin;C:\WIN........
dos> gtk-demo
Step 4 Get the fpdb GIT tree
----------------------------
4.1/ Best to take a copy to work with; following steps will assume that the fpdb folder is on the Desktop
#Step 5 Put MSVCP90.dll temporarily into the fpdb folder
#-------------------------------------------------------
5.3/ Install correct Numpy for this build
-----------------------------------------
Numpy needs special handling, as by default it will install an optimised version for the SSE level of your CPU (SSE3, SSE2 or noSSE). This means that the completed package will not run on an older CPU.
For this reason, do not just run the installer downloaded.
5.3.1/ download the package to the Desktop
numpy 1.4.1 ... http://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1-win32-superpack-python2.6.exe/download
5.3.2/ remove any existing numpy installation
Go to the control panel and uninstall "Python2.6 numpy-1.4.1"
5.3.3/ If you are wanting to build a package which works on all CPU's, install noSSE as follows:
dos> cd Desktop
dos> numpy-1.4.1-win32-superpack-python2.6.exe /arch nosse
5.3.4/ If you are wanting to build a package which works on SSE2 and better CPU's, install SSE2 as follows:
dos> cd Desktop
dos> numpy-1.4.1-win32-superpack-python2.6.exe /arch sse2
5.3.4/ At the end of the installation, click on "show details" to confirm the installation.
For no SSE:
"Target CPU handles SSE2"
"Target CPU handles SSE3"
"nosse install (arch value: nosse)"
"Install NO SSE"
Extract: numpy-1.4.1-nosse.exe... 100%
Execute: "C:\DOCUME~1\user\LOCALS~1\Temp\numpy-1.4.1-nosse.exe"
Completed
For SSE2:
"Target CPU handles SSE2"
"Target CPU handles SSE3"
"sse2 install (arch value: sse2)"
"Install SSE 2"
Extract: numpy-1.4.1-sse2.exe... 100%
Execute: "C:\DOCUME~1\user\LOCALS~1\Temp\numpy-1.4.1-sse2.exe"
Completed
###### Step 5 no longer required as py2exe is instructed not to include the visualc/c++ dll's
#
#py2exe will check for MSVCP90.dll. The version installed by python2.6.5runtime is not in the path, so we will put it in place #TEMPORARILY. This will/must be removed manually once the exe has been created, as we do not have a licence to redistribute.
#
#Search for MSVCP90.dll (should be found in C:\WINDOWS\WinSxS\...
#copy this file TEMPORARILY to the Desktop\fpdb\pyfpdb folder
Step 6 Run py2exe to generate fpdb.exe
--------------------------------------
@ -98,20 +144,14 @@ c:\GTK
Build notes:
There is a warning "c:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated import sets". This is probably coming from mysql-python see here https://bugs.launchpad.net/python-mysqldb/+bug/338387
There is a warning about dll's not included "umath.pyd - c:\Python26\lib\site-packages\numpy\core\umath.pyd" - reason for this is not understood at present. (Umath is apparently included in the built package).
#Step 7 Delete C++runtime
#------------------------
#
###### Step 7 is no longer required (see step 5 for reason)
#
#This is really really important, this file must NOT be distributed, so get rid of it now to avoid issues.
#
#7.1/ in Desktop\fpdb\pyfpdb\ remove the file msvcp90.dll
#
Step 7 not currently used
-------------------------
Has been deleted
Step 8 Drag out the completed bundle
------------------------------------
@ -136,13 +176,13 @@ Step 9 Initial run
Observe that the msvcp90.dll was provided by the python runtime package, so we don't have to install the separate package from Microsoft. End-users will, however need the dependency.
Step 11 pruning
---------------
11.1/ The generated folder is 100+MB and can be pruned by removing the following directories:
pyfpdb/lib/glib-2.0
pyfpdb/lib/gtk-2.0/include
pyfpdb/lib/pkgconfig
pyfpdb/share/aclocal
pyfpdb/share/doc
@ -152,10 +192,12 @@ pyfpdb/share/gtk-doc
pyfpdb/share/locale
pyfpdb/share/man
Step 12 rename folder
---------------------
12/ Rename the folder to something meaningful to the community
Rename the folder to something meaningful to the community. If you have built for NoSSE, append noSSE to the directory name.
Step 13 Compress to executable archive
--------------------------------------
@ -164,5 +206,8 @@ Step 13 Compress to executable archive
13.2/ Rightclick on fpdb executable folder, select 7zip Add to archive... select SFX archive option switch
13.3/ Test the created exe file
Step 14 If you need to build again for a different SSE level
------------------------------------------------------------
Go back to step 5 and run again.

View File

@ -177,7 +177,7 @@ or None if we fail to get the info """
# TODO: (1-on-1) does have that info in the game type line
if self.HORSEHand:
hand.maxseats = 8
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%Y-%m-%d %H:%M:%S")
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%Y-%m-%d %H:%M:%S")
return
def readPlayerStacks(self, hand):

View File

@ -105,7 +105,7 @@ class Betfair(HandHistoryConverter):
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
hand.handid = m.group('HID')
hand.tablename = m.group('TABLE')
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%A, %B %d, %H:%M:%S GMT %Y")
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%A, %B %d, %H:%M:%S GMT %Y")
#hand.buttonpos = int(m.group('BUTTON'))
def readPlayerStacks(self, hand):

View File

@ -156,7 +156,7 @@ or None if we fail to get the info """
hand.handid = m.group('HID1') + m.group('HID2')
hand.tablename = m.group('TABLE')[:-1]
hand.maxseats = 2 # This value may be increased as necessary
hand.starttime = datetime.datetime.strptime(m.group('DATETIME')[:12],
hand.startTime = datetime.datetime.strptime(m.group('DATETIME')[:12],
'%Y%m%d%H%M')
# Check that the hand is complete up to the awarding of the pot; if
# not, the hand is unparseable

View File

@ -97,7 +97,7 @@ class DerivedStats():
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['handStart'] = hand.startTime # format this!
self.hands['importTime'] = None
self.hands['seats'] = self.countPlayers(hand)
self.hands['maxSeats'] = hand.maxseats

View File

@ -154,7 +154,7 @@ or None if we fail to get the info """
# 2008/11/10 3:58:52 ET
#TODO: Do conversion from GMT to ET
#TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this)
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%Y/%m/%d - %H:%M:%S")
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%Y/%m/%d - %H:%M:%S")
return
def readPlayerStacks(self, hand):

View File

@ -201,7 +201,7 @@ class Fulltilt(HandHistoryConverter):
return None
hand.handid = m.group('HID')
hand.tablename = m.group('TABLE')
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d")
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d")
if m.group("CANCELLED") or m.group("PARTIAL"):
raise FpdbParseError(hid=m.group('HID'))

View File

@ -0,0 +1,61 @@
import imaplib
import Configuration
import os
import pprint
pp = pprint.PrettyPrinter(indent=4)
def open_imap_connection(verbose=False):
# Read the config file
# FIXME
hostname = 'imap.gmail.com'
port = 993
username = 'slartibartfast'
password = '42'
# Connect
if verbose: print "Connecting to %s" % hostname
connection = imaplib.IMAP4_SSL(hostname)
# Login to our account
if verbose: print "Logging in as %s" % username
connection.login(username, password)
return connection
if __name__ == '__main__':
# Read the config file
# FIXME
folder = "INBOX"
c = open_imap_connection(verbose=True)
try:
typ, data = c.list(directory=folder)
print typ, data
c.select('INBOX', readonly=True)
typ, msg_ids = c.search(None, '(SUBJECT "Results for PokerStars Tournament *")')
print typ, msg_ids
msgidlist = msg_ids[0].split(' ')
print msgidlist
for msg in msgidlist:
print 'HEADER:'
typ, msg_data = c.fetch(msg, '(BODY.PEEK[HEADER])')
for response_part in msg_data:
if isinstance(response_part, tuple):
print response_part[1]
print 'BODY TEXT:'
typ, msg_data = c.fetch(msg, '(BODY.PEEK[TEXT])')
for response_part in msg_data:
if isinstance(response_part, tuple):
print response_part[1]
finally:
try:
c.close()
except:
pass
c.logout()

View File

@ -138,7 +138,7 @@ class OnGame(HandHistoryConverter):
#TODO: Do conversion from GMT to ET
#TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this)
hand.starttime = time.strptime(m.group('DATETIME'), "%d %b %Y %I:%M %p")
hand.startTime = time.strptime(m.group('DATETIME'), "%d %b %Y %I:%M %p")
#hand.starttime = "%d/%02d/%02d %d:%02d:%02d ET" %(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')),
#int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))

View File

@ -0,0 +1,33 @@
import urllib2, re
import pprint
from BeautifulSoup import BeautifulSoup
playername = ''
if playername == '':
print "You need to manually enter the playername"
exit(0)
page = urllib2.urlopen("http://www.pocketfives.com/poker-scores/%s/" %playername)
soup = BeautifulSoup(page)
results = []
for table in soup.findAll('table'):
# print "Found %s" % table
for row in table.findAll('tr'):
tmp = []
for col in row.findAll('td'):
tmp = tmp + [col.string]
#print col.string
if len(tmp) > 3 and tmp[2] <> None:
results = results + [tmp]
cols = ['TOURNAMENT', 'SITE', 'DATE', 'PRIZEPOOL', 'BUY-IN', 'PLACE', 'WON']
pp = pprint.PrettyPrinter(indent=4)
for result in results:
print "Site: %s Date: %s\tPrizepool: %s\tBuyin: %s\tPosition: %s\tWon: %s" %(result[2], result[3], result[4], result[5], result[6], result[7])

View File

@ -281,7 +281,7 @@ class PartyPoker(HandHistoryConverter):
'July','August','September','October','November','December']
month = months.index(m2.group('M')) + 1
datetimestr = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), month,m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S'))
hand.starttime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S")
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S")
# FIXME: some timezone correction required
#tzShift = defaultdict(lambda:0, {'EDT': -5, 'EST': -6, 'MSKS': 3})
#hand.starttime -= datetime.timedelta(hours=tzShift[m2.group('TZ')])

View File

@ -226,7 +226,7 @@ class PokerStars(HandHistoryConverter):
datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'), a.group('M'),a.group('D'),a.group('H'),a.group('MIN'),a.group('S'))
#tz = a.group('TZ') # just assume ET??
#print " tz = ", tz, " datetime =", datetimestr
hand.starttime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
self.removeET(hand)
if key == 'HID':
hand.handid = info[key]

View File

@ -128,7 +128,7 @@ follow : whether to tail -f the input"""
#2008/09/07 06:23:14 ET
m2 = re.search("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)", info[key])
datetime = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), m2.group('M'),m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S'))
hand.starttime = time.strptime(datetime, "%Y/%m/%d %H:%M:%S")
hand.startTime = time.strptime(datetime, "%Y/%m/%d %H:%M:%S")
if key == 'HID':
hand.handid = info[key]
if key == 'TABLE':

View File

@ -137,7 +137,7 @@ class Win2day(HandHistoryConverter):
for key in info:
if key == 'DATETIME':
# Win2day uses UTC timestamp
hand.starttime = datetime.datetime.fromtimestamp(int(info[key]))
hand.startTime = datetime.datetime.fromtimestamp(int(info[key]))
if key == 'HID':
hand.handid = info[key]
if key == 'TABLE':

View File

@ -114,7 +114,7 @@ import Database
import Configuration
import Exceptions
VERSION = "0.20-pre4"
VERSION = "0.20"
class fpdb:
@ -230,9 +230,9 @@ class fpdb:
dia = gtk.AboutDialog()
dia.set_name("Free Poker Database (FPDB)")
dia.set_version(VERSION)
dia.set_copyright("2008-2010, Steffen, Eratosthenes, Carl Gherardi, Eric Blade, _mt, sqlcoder, Bostik, and others")
dia.set_comments("GTK AboutDialog comments here")
dia.set_license("GPL v3")
dia.set_copyright("Copyright 2008-2010, Steffen, Eratosthenes, Carl Gherardi, Eric Blade, _mt, sqlcoder, Bostik, and others")
dia.set_comments("")
dia.set_license("This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory")
dia.set_website("http://fpdb.sourceforge.net/")
dia.set_authors(['Steffen', 'Eratosthenes', 'Carl Gherardi',
'Eric Blade', '_mt', 'sqlcoder', 'Bostik', 'and others'])

View File

@ -231,8 +231,6 @@ pyfpdb/share/locale
pyfpdb/share/man
pyfpdb/share/themes/Default
Please double-check that msvcr90.dll is NOT in the distribution tree
Use 7-zip to zip up the distribution and create a self extracting archive and that's it!
"""

View File

@ -20,8 +20,7 @@ setup(name = 'fpdb',
package_dir = { 'fpdb' : 'pyfpdb' },
data_files = [
('/usr/share/doc/python-fpdb',
['docs/readme.txt', 'docs/release-notes.txt',
'docs/tabledesign.html', 'THANKS.txt']),
['THANKS.txt']),
('/usr/share/pixmaps',
['gfx/fpdb-icon.png', 'gfx/fpdb-icon2.png',
'gfx/fpdb-cards.png'