Merge ../fpdb

This commit is contained in:
sqlcoder 2008-12-02 00:06:38 +00:00
commit 5884f2f66b
136 changed files with 15860 additions and 0 deletions

37
create-release.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
rm regression-test/*.found.txt
rm regression-test/*.pyc
rm pyfpdb/*.pyc
mkdir fpdb-$1
cp -R docs fpdb-$1/
cp -R packaging fpdb-$1/
cp -R pyfpdb fpdb-$1/
rm fpdb-$1/pyfpdb/HUD_config.*
cp pyfpdb/HUD_config.xml.example fpdb-$1/pyfpdb/HUD_config.xml
cp -R regression-test fpdb-$1/
cp -R utils fpdb-$1/
cd fpdb-$1
zip -r ../../fpdb-1.0_$1.zip *
tar -cf - * | bzip2 >> ../../fpdb-1.0_$1.tar.bz2
cd ..
rm -r fpdb-$1
echo "Please ensure the files are named fpdb-1.0_alpha*_p*.*"

47
docs/abbreviations.txt Normal file
View File

@ -0,0 +1,47 @@
HUD/table viewer
================
A3-7=3rd-7th street Complete/Raise percentage
AF=Flop Bet/Raise percentage
AT=River Bet/Raise percentage
AR=Turn Bet/Raise percentage
F3-7=3rd-7th street Fold percentage
FB=like FSB but for big blinds only
FF=Flop Fold percentage
FR=River Fold percentage
FSB=Fold to steal - combined of small and big blind (FSB means Fold Small Big). E.g. if a player faced a steal attempt in the SB 7 times and
FS=like FSB but for small blinds only.
FT=Turn Fold percentage
HD=Hands
PF3B4B=Pre Flop 3Bet or 4Bet
PFR=Pre Flop Raise
Postf A=Postflop (ie. flop+turn+river) Aggression%
Postf F=Postflop Fold %
SD/F=Showdown/Flop=WtSD=How often player went to showdown when he saw the flop
ST=Steal chance (nobody had entered the pot before the player in question, and the player is in cutoff, button or SB position)
W$wsF=Won $ when he saw flop
W$@SD=Won $ at showdown
VPI3=Voluntary Put In on 3rd Street (ie. call+complete+raise)
VPIP=Voluntary Put In Preflop (ie. call+raise)
Other
=====
CLI=Command Line Interface (Shell, Terminal, "DOS-window")
FTP=Full Tilt Poker
GUI=Graphical User Interface (normal interface with buttons and menus)
HUD=Heads-Up Display (shows stats directly in the poker software)
PS=PokerStars
MTT=Multi Table Tournament
SnG=Sit and Go
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

661
docs/agpl-3.0.txt Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.

75
docs/benchmarks.txt Normal file
View File

@ -0,0 +1,75 @@
benchmarks
==========
All measurements on my Athlon64@1.1GHz, 1 GB RAM, RAID5, Hardened Gentoo Linux 2.6.23
From svn47 all measurements on my Athlon64 X2@1GHz, 2GB RAM
All measurements were ran several times in a row, unless otherwise noted the computer was mostly idle
svn12/15 were with PostgreSQL, svn23 onwards with MySQL
All import measurements were taken immediately after reseting the tables
svn12, whilst compiling open office in the background
=====
reseting tables (incl filling default data): 0.5-0.6s
importing one hand from a file: 0.5-0.7s
svn15
=====
reseting tables (incl filling default data): 0.35-0.4s
importing one FTP hand from a file: 0.2-0.3s or 12-18k/hr
importing 51 FTP hands: 2.8-2.9s or 63-66k/hr
The large speedup will be partially due to not compiling in the background, and
partially due to less connecting/disconnecting the DB I'd imagine.
I'm VERY happy with this performance, but large gains could probably be made by
making the importer just a bit more sensible.
svn23
=====
reseting tables (incl filling default data): 0.3-0.35s
importing 75 PS hands: 3.2s or 84k/hr
importing 180 FTP hands: 7.7-7.9s 82k/hr
This is the rewrite in import_FTP_and_PS.py, svn12/15 are with import_file.py
Nice, it's substantially faster inspite of supporting PS and FTP (ish) rather
than just FTP and handling more special cases.
svn24
=====
importing 75 PS hands: 3.2-3.3s or 82k/hr
importing 507 FTP hands: 23.5-23.8s or 77k/hr
importing 947 FTP hands: 76.2-72.7s or 44k/hr
As you can see FTP has gotten about 6% slower on 500 hands - but the much expanded handling
of new cases (particularly the ante folding will be ALOT of extra string
comparisons) easily explains that. In fact I expected a much bigger impact.
(I suspect this is due to the parsing pausing whilst my shell catches up)
svn47
=====
It significantly slows down as the database gets larger, after a few thousand
hands it got to just one hand per second and slower. However, around 90% of the
CPU load was MySQL. Any tips are most welcome..
svn52 (whilst watching movie in a small window)
=====
Importing 2500 hands (mixed sites+types): 6m15s or 31k/hr (ran twice)
Of these 230 were skipped as duplicate or partial so counting 2270 hands
svn53 (whilst watching movie in a small window)
=====
Importing the 2270 hands from svn52: 1m50 or 74k/hr (82 if counting dupes/partial)
Importing my 35661 (plus 427 dupe/part) hands: 51m51s or 41k/hr (ran once)
The dbsize still has a significant impact, but with these sizes certainly it's
just not a problem. If anyone runs a larger database let me know how long it takes.
Thanks bwarycha for the tip with the foreign keys!
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

27
docs/codingstyle.txt Normal file
View File

@ -0,0 +1,27 @@
This is just a loose collection of things so far, but might as well make a start :)
A word on wrapping: Please avoid making manual line breaks, the computer can and therefore should do it. Whether people use a phone or a 40" super-uber-HD screen, they should be allowed to use as much of it as they wish/can. Incidentially, if anyone knows how to activate line wrap in Eclipse I'd really appreciate if you let me know.
Comments (or prints) with todo are things that are missing, bugs, or just messy code.
After every def (ie. at the end of the method) there should be a comment including the name, e.g.
#def end of parseActionLine
If you don't mind make names in java style, ie.:
Classes, files or tables like this: MyClassName
Methods and variables like this: myMethodName
I'll eventually change all my code to that style, too.
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

22
docs/db-todo.txt Normal file
View File

@ -0,0 +1,22 @@
stats to add
============
*CC,TotalColdCalls,TimesFacingRaisePreflop
**Folded to 3-Bet,FoldedToThreeBetPreflop,FacedThreeBetPreflop
Called 3-Bet,CalledThreeBetPreflop,FacedThreeBetPreflop
*Winning %,wonhand,TotalHands
**Flop Aggression Factor,timesaggressiveflop,timescalledflop
**Turn Aggression Factor,timesaggressiveturn,timescalledturn
**River Aggression Factor,timesaggressiveriver,timescalledriver
scoopedPot (useful for hi/lo split games)
couldSqueeze, didSqueeze, facedSqueeze, calledSqueeze -> if (player raises from EP) and (someone after him calls) and (someone after that goes all in)
Donk Bet Turn,DidDonkBetTurn,CouldDonkBetTurn -> EP raises, LP reraises, EP calls. If EP bets out after the flop, it is considered a donk bet
Float Turn,DidFloatTurn,CouldFloatTurn ->
other
=====
look at PT3 and HM tables see if i forgot anything
store all-in somewhere
add somewhere: mixed flag to denote that the game is part of a mixed game rotation
add tables for single draw (5card draw, 2-7 single draw, badugi) and tripple draw (2-7 tripple draw)

397
docs/fdl-1.2.txt Normal file
View File

@ -0,0 +1,397 @@
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

75
docs/filelist.txt Normal file
View File

@ -0,0 +1,75 @@
This is partially outdated
File list
=========
.:
docs/ Documentation files
pyfpdb/ The main program (in python)
setup/ Directory with files for setting up this program
regression-test/ Directory with test data, query scripts (in python) and the regression test script (in bash)
utils/ A couple of things that will migrate to the main prog soon
viewer/ Directory with the GUI (in Java)
./docs:
abbreviations.txt A list of abbreviations used and their meaning
agpl-3.0.txt License of the program (everything under /code)
benchmarks.txt Some benchmark results
codingstyle.txt Some notes on formatting. Feel free to ignore.
fdl-1.2.txt License of the documentation (the files in /)
filelist.txt This file
howto-import.txt Instructions on how to run the importer
install-in-gentoo.txt Installation instructions for Gentoo GNU/Linux
install-in-windows.txt Installation instructions for Windows
readme-dev.txt Some notes, pointers and such for developers or anyone else interested in changing fpdb
readme-overview.txt Some general info about this program - read that first
readme-user.txt Instructions on how to use fpdb
status.txt Details of support for poker types and sites
tabledesign.html Table design with comments
./pyfpdb:
fpdb.py The main GUI. This is what the user will start and use to access the other things.
fpdb_import.py Main import program. Calls methods in the other files.
Takes one hand history file as input. This is the file
you execute, do not run the other ones individually.
Except import_gui.py of course.
fpdb_parse_logic.py Parses a holdem/omaha/razz/stud hand.
fpdb_save_to_db.py Just methods to store the parsed data into SQL.
Seperate file because these calls are very unwieldy.
fpdb_simple.py Simple methods called by the other files. Most work is
actually done in this file to make the other ones look
much easier than they are.
import_gui.py GUI interface to the importer (obselete)
./setup:
insert-basedata.sql Fills sites and gametypes tables. Run this once after running the above.
recreate-tables.sql File for mysql to recreate the tables. THIS WILL DELETE EXISTING TABLES!!!
./testdata:
should be self explanatory
./utils:
dump_db_basedata.py Prints the contents of the tables sites and gametypes
fpdb_util_lib.py Helper methods for the utilities.
get_DB_stats.py Prints some counts (like no. of players in the DB)
get_player_stats.py Prints certain stats about players with CLI-passed constraints
mysql-reset-tables.sh Reset tables for MySQL. THIS WILL DELETE EXISTING TABLES!!!
print_hand.py Prints a hand in legible format.
psql-interactive.sh *nix script to connect to a PostgreSQL database in
interactive mode (note that we're currently only supporting MySQL)
regression-test.sh Resets tables and checks manually verified hands for errors
./viewer:
todo
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

View File

@ -0,0 +1,46 @@
Last checked: 1 Sep, p74
These instructions are for any Ubuntu Linux, but except for the name of the package management software it should be identical on other Linux distributions.
Using the package manager (I think it's called synaptics) install the dependencies: mysql, python, mysql-python, pygtk
I don't use ubuntu but I'd imagine it will at some point prompt you for a MySQL root password enter one and when it's done installing everything open a shell/terminal and type this:
mysql --user=root --password=YourMysqlRootPassword
It should say something like this:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.60-log Ubuntu Linux mysql-5.0.60-r1
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Now type this:
CREATE DATABASE fpdb;
Next you need to create a user. Type this (replacing newPassword with the password you want the fpdb user to have - this can, but for security shouldn't, be the same as the root mysql password):
GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;
Then download one of the alpha2 archives from the sourceforge page at https://sourceforge.net/projects/fpdb/ and unpack it into a folder of your choice.
Next create a directory called .fpdb (the . at the beginning is important) in your home directory, e.g. /home/steffen/.fpdb
Then copy the default.conf file from the docs directory of the archive into this new folder.
Finally edit default.conf with any texteditor and enter the fpdb password you entered above (in the GRANT ALL... command).
This should be it, try double clicking pyfpdb/fpdb.py or open it from a shell with python /path/to/fpdb/pyfpdb/fpdb.py
Now see readme-user.txt for usage instructions.
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

View File

@ -0,0 +1,58 @@
Everything is subject to change and the order does not indicate priority. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts.
Please also see db-todo.txt
before beta
===========
change to savannah?
Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu
make a quick benchmark of mysql and postgresql: import of my whole db, some tableviewer refreshes with and without updated file
Make tab and enter work as sensible in GUIs and implement Ctrl+Q, Ctrl+X and Alt+F4 for close.
use profile file for bulk import and table viewer settings and pathes
check that we read sitout correctly in: Full Tilt Poker Game #6150325318: Table Bogside
verify at least 2 or 3 sng hands
no rush but before 1.0RC
========================
improve handling of dead hand before BB, see git101/7bd1631
make DB version error offer reimport, recreation and continue.
In many places there are unnecessary database accesses or it regenerates information it already had before or just generally does things in obscenely inefficient ways. Optimise this
multi-select in bulk importer
cut down action_types array size to appropriate length
make the gui display errors
log file
move directory import code from gui to backend
convert fpdb_import to not require passing "self", generally clean the parameter passing
Doesn't handle Daylight Saving Time (I don't think at least)
ensure that refresh still takes no more than 10 seks on my P3M-800 (a quick run on git15 indicates this is ok now), or 5 with remote DB
select range of stakes and sng/mtt values and types for hud
recognise somewhere if a file is still active and if so keep it open and only read new hands rather than detecting dupes
return full ftp functionality
can wait till 1.x
=================
in all importer: stop doing if site=="ftp", make class constants for site_id instead
It treats fold due to disconnect as voluntary fold which is not ideal
aliases
repair hands where the seat lines are missing, happens when observing at FTP
flags for storing the reason for winning (best hi, tie for best low, etc.) to DB. not sure actually if this is such a good idea remember that there can be multiple reasons for the same player in the same hand
benchmark properly on mysql innodb, postgresql, more?
rename things like this: ClassName.methodName and variableName. update codingstyle
CLI (not ncurses, normal CLI) equivalent for fpdb.py
optimise/simplify storing by creating the SQL statements depending on hand rather than calling different methods
make range of activeSeats configurable for tv/hud
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

67
docs/readme-dev.txt Normal file
View File

@ -0,0 +1,67 @@
Hi,
This document is to serve as a little overview (later: full technical doc) for current and prospective developers with:
a) introduction into the code structure
b) organisational/legal things
What to do?
===========
- Anything you want.
- The most useful (because it's the most boring) would be to update print_hand.py, update the expected files (testdata/*.found.txt) and create more .found.txt to ensure import processing is running correctly.
- There's a list of various bugs, deficiencies and important missing features in known_bugs_and_planned_features.txt.
- In the main GUI there's various menu points marked with todo - all of these will have to be done eventually.
If you want to take a look at coding-style.txt.
Ideally use git (see git-instructions.txt for some commands) and let me know where to pull from, alternatively feel free to send patches or even just changed file in whatever code layout or naming convention you like best. I will, of course, still give you full credit.
Contact/Communication
=====================
If you start working on something please open a bug or feature request at sf to avoid someone else from doing the same
Please see readme-overview
Dependencies
============
Please let me know before you add any new dependencies and ensure that they are source-compatible between *nix and Windows
Code/File/Class Structure
=========================
Basically the code runs like this
fpdb.py -> bulk importer tab (import_threaded.py) -> fpdb_import.py -> fpdb_parse_logic.py -> fpdb_save_to_db.py
or
fpdb.py -> table viewer tab (table_viewer.py) (todo: -> libTableViewer)
All files call the simple methods that I just collected in fpdb_simple.py, to abstract the other files off the nitty gritty details as I was learning python.
I'm currently working on (amongst other things) integrating everything into the fpdb.py GUI with a view to allow easy creation of a CLI client, too.
Also see filelist.txt.
How to Commit
=============
Please make sure you read and accept the copyright policy as stated in this file. Then see git-instructions.txt. Don't get me wrong, I hate all this legalese, but unfortunately it's kinda necessary.
Copyright/Licensing
===================
Copyright by default is handled on a per-file basis. If you send in a patch or make a commit to an existing file it is done on the understanding that you transfer all rights (as far as legally possible in your jurisdiction) to the current copyright holder of that file, unless otherwise stated. If you create a new file please ensure to include a copyright and license statement.
The licenses used by this project are the AGPL3 for code and FDL1.2 for documentation. See readme-overview.txt for reasons and if you wish to use fpdb with different licensing.
Preferred File Formats
======================
Preferred: Where possible simple text-based formats, e.g. plain text (with Unix end of line char) or (X)HTML. Preferred picture format is PNG. IE-compability for HTML files is optional as IE was never meant to be a real web browser, if it were they would've implemented web standards.
Also good: Other free and open formats, e.g. ODF.
Not good: Any format that doesn't have full documentation freely and publicly available with a proper license for anyone to implement it. Sadly, Microsoft has chosen not fulfil these requirements for ISO MS OOXML to become a truly open standard.
License (of this file)
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

86
docs/readme-overview.txt Normal file
View File

@ -0,0 +1,86 @@
Summary
=======
A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Supports Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future. Some of this is not yet working though, please see status.txt and known-bugs-and-planned-features.txt
Contact
=======
Please note that this project has two hostings: one at assembla.com which holds are version control "central tree" (irrelevant for users) and everything else at http://sourceforge.net/projects/fpdb/.
The best means of contact are the sourceforge page: Use the bug, feature request or patch functions or just post in the forum.
Alternatively feel free to contact me directly:
mail: steffen(at)sycamoretest.info
jabber/xmpp/Google Talk: as above
ICQ: 7806355
MSN: steffenjf@gmx.de (don't email that)
But you could send all my hand histories to yourself!
=====================================================
At the end of the day this comes down to a question of trust, but unlike Windows and the poker client software you don't have to trust fpdb blindly. You can:
- Verify the source code yourself.
- Convince or pay someone to verify the source code for you.
- Use a personal firewall to completely block fpdb from the Internet
- (for the uber-paranoid) Get yourself the free virtualisation software VirtualBox, set up a VM (virtual machine) to run fpdb but run the poker software on your real PC. Then cut the VM off the Internet, fpdb doesn't need it. If you have a PC made in the last few years this should run fast enough as well. Note that most Windows licenses do NOT permit you to use two Windows installations at once, even if they are on the same PC.
Installing
==========
See the install-*.txt for your operating system. If your OS is missing or if you have problems let me know (contacts are further below). In particular I'd be happy to provide packages for GNU/Linux and *BSD distributions.
Using it
========
See readme-user.txt
If you have a problem, request or question see the contacts section below
Changing it
===========
See readme-dev.txt
Requirements
============
Software requirements are listed in requirements.txt
As for hardware, my main test machine is a Pentium 3-M 800 with 256 RAM and Gentoo GNU/Linux
(running the poker client through what most people will call emulation). So this
program will have to work on that. If you run an even more ancient machine and
its too slow let me know and I'll see what I can do :)
Why Free Software?
==================
This program is released under the terms of the free/libre software license AGPL3 as released by the FSF. The AGPL3 protects your rights and those of the wider community. As Richard Stallman, one of the founders of the free software movement, put it: "Free software is a matter of liberty, not price. To understand the concept, you should think of free as in free speech, not as in free beer." (well, it is both really, like the right to vote used to be free)
For example, a "pirated" copy of proprietary software X is free of charge, but you don't actually have a legal right to use it, you don't have any possibility to fix its bugs and you certainly don't have any legal right to share it with your friends. You also won't be able to get support, often not even security fixes. Actually, even if you pay hundreds of pounds for your program they deny your right to fix their errors for them. Imagine buying a car where you're not permitted (under threat of jail) to replace broken parts..
With free/libre software (also known as open source software, or short FOSS or FLOSS) on the other hand you get all these freedoms:
(note: the legally binding terms are in the license text, this is merely an amateur summary so normal people don't have to read pages of legalese)
Freedom 0: The freedom to use: To run the program, for any purpose. Free of Charge.
Freedom 1: The freedom to study and help yourself. This freedom guarantees your right to study and learn from the source code of the program, and to fix it if it is broken. If you're not a programmer yourself the developers will generally be happy to fix it for you, often even for free. Failing that you can always pay someone from the money you saved on not having to pay for it.
Freedom 2: The freedom to be a decent human being and help your neighbour: I don't threaten you with lawsuits or jail time if you share with your friends and neighbours, subject to the very modest restrictions of the AGPL3.
Freedom 3: The freedom to improve the program and release your improvements to the public (or parts thereof) so that the whole community benefits. Note that you are PERMITTED, but not REQUIRED to distribute your changes. If you do distribute your changes you must do so under the terms of the AGPL3 however.
Note that this is the license - I retain full copyright over my code, including the right to change the license for future versions. I do not intend to do this however. In any case, any version I released under AGPL3 remains available under that license forever, or more accurately until my copyright expires at which point it goes into the public domain.
I reject the concept of software patents as a crime and under the European Patent Agreement software patents - even if you mislabel them as "computer-implemented inventions" or whatever - are explicitly prohibited.
Can I get/use this under a different license?
=============================================
The short answer: Maybe.
The long one: As detailed, I fully support what the FSF does and aims to achieve with the GPL. However, I realise that many free software developers don't object to closed source, some don't even object to closed source profiteering of their charity, and I don't think I have any right to go and tell them they're wrong.
So if anyone wishes to use all or part of my code in another free software/open source project with an AGPL3-incompatible license such as BSD then let me know and we'll figure out a solution that makes everyone happy.
If you wish to use all or part of this in closed source let me know how much if anything that is worth to you and I'm sure we'll be able to reach an agreement. Note that you are NOT permitted to just use fpdb code in closed source development whether in-house or by an independent software developer, you will NEED an additionally agreement with me to get fpdb under different licensing conditions.
License of this Document
========================
The views expressed in this document are those of Steffen Jobbagy-Felso, other members of the fpdb team and external contributors may or may not agree.
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

43
docs/readme-user.txt Normal file
View File

@ -0,0 +1,43 @@
Before you do this make sure you setup the dependencies, the database, user, tables and config file.
Running it
==========
If you have python setup properly you can execute it by double clicking pyfpdb/fpdb.py.
Note however that all error messages are currently only printed if you call it from a shell. It'll be much easier to diagnose possible problems (which are likely in alpha stage) if you run it from a shell. In Windows XP it seems to automatically open a shell window with the fpdb window where you can see the command line output.
In Linux/MacOS/*BSD, e.g. if its in /home/sycamore/fpdb/, do this:
cd /home/sycamore/fpdb/pyfpdb
python fpdb.py
That will start the main GUI.
Have a look at the menus, the stuff that is marked todo is not yet implemented.
The main things are the bulk importer and the table viewer. To use the importer open it from the menu (import files and directories). You can set a few options at the bottom, then select a folder or single file in the main are and click Import. Please report any errors by one of the contacts listed in readme-overview.txt.
Currently this will block the interface, but you can open another instance of this program e.g. if you wanna play whilst a big import is running.
Please check the output at the shell for errors, if there are any please get in touch by one of the methods listed in readme-overview.txt
Table Viewer (tv)
=================
To use the table viewer open it from the menu, select the hand history file of the table you're at, and click the Import&Read&Refresh button. The abbreviations there are explained in abbreviations.txt, but feel free to ask. Note that most poker software will only create the file once the first hand you payed to play is finished.
In each column there is either just the number (hand count for current stake, range of seats and type of game) or a percentage and the number of hands that this percentage is based on. For example, in W$@SD (won $ at shodown) the number in brackets is how many showdowns that player has seen.
Reimporting
===========
Currently on most updates a reimport of the whole database is required. To do this open fpdb, click the menu Database and select Create/Recreate tables. Then import all your history files again.
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

93
docs/release-notes.txt Normal file
View File

@ -0,0 +1,93 @@
alpha2
======
Hi everyone,
we are proud to announce the second alpha release of fpdb, the free/libre open source poker tracker. The biggest highlight is the HUD for Linux made by Ray (and perhaps Mac, not sure). But for everyone fpdb now also supports PS tournaments (SnG and MTT) and FTP ring games. There is also a new auto-importer though it currently only runs on one file per instance (but you can open multiple instances of fpdb).
Fpdb also parses alot of new situations into the cache table for the HUD, most of which are already available through the Linux HUD. There have also been a large number of bugfixes for all kinds of things. For full details of the changes see the git commit comments.
You can download fpdb at https://sourceforge.net/project/showfiles.php?group_id=226872
Our website at http://fpdb.sourceforge.net/ will be updated shortly but in the meantime please note that the configuration file now resides in ~/.fpdb/default.conf on Linux/Mac and in C:\Documents and Settings\Application Data\fpdb\default.conf on Windows (on non-English Windows you have to translate the Documents and Settings, but not the Application data bit). Apart from that just follow the instructions on the site. I will be updating/improving the fpdb ebuild for Gentoo next week, please send me a PM or email if you would like a package for another Linux/BSD.
To use the HUD in Linux simply run the auto importer whilst having the table open. You will also have to rename HUD_config.xml.example to HUD_config.xml and edit the database parameters in there in addition to what is written in the install guide.
If you've been using fpdb alpha1 just delete the fpdb folder, follow the installation guide except for installing the dependencies, then run fpdb and run recreate tables. Note that you will have to reimport ALL your history files.
For external devs (in particular Youre Toast): The table design has gone through some changes, though most of it was just renaming to make a consistent naming scheme and to make it more flexible towards stud/razz type games. I do not expect to having to make any future changes to the existing fields but I cannot yet guarantee that. There will be some additional fields in particular in the HudCache table. Please let me know if you need any further fields. I realise my naming breaks the "database designer's convention" but for this project I feel ignoring this convention for the benefit of consistent naming between Python and SQL is ok.
Any questions and comments please post here, send me a PM or email, post a feature request or bug report on sourceforge or use any of the other means of contact listed on our webpage.
Enjoy,
The fpdb team
PS: I personally will be away Sun-Tue so I probably won't be responding to anything but feel free to message me anyways, but if you post here or at SF someone else might be able to help.
PPS: If you wanna know EXACTLY how this project is moving along follow the git tree over at [url]http://www.assembla.com/spaces/fpdb/trac_git_tool[/url]
alpha1
======
Hi everyone,
I am proud to announce the first release of my new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why I bothered when now with HM and PT3 there are at least two excellent packages to choose from.
Four main reasons:
1. Fpdb is free/libre open source software. In short, this means you don't depend on me if sth. is wrong or you want something more in this program as you can freely change it yourself. You also don't have to pay anything for it. If you like it and think I deserve to be paid just drop me a mail ;)
2. HM and PT3 only support holdem. Fpdb initially supports Holdem and Omaha, with Stud and Razz mostly implemented and coming soon.
3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs on any plattform that has the required software, which will cover roundabout 99.9% of PCs. Currently tested plattforms are Windows XP-x86 and Gentoo GNU/Linux-amd64 as well as -x86.
You still need to run Windows or wine to run the actual poker client though.
4. Fpdb won't irritate you with copy prevention measures.
To install it go to https://sourceforge.net/project/showfiles.php?group_id=226872 and download the zip or tar.bz2, unpack it, and follow the instructions in docs/install-in-* for your operating system (e.g. docs\install-in-windows.txt). Sourceforge lists the release files as source files, not as binary executables - this is correct, python will automagically compile as and when required.
This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing alltogether.
If anyone wishes to help with development that would be very very welcome and I've put a few notes in docs/readme-dev.txt in the download for what you could do. Or just start coding and send me the patches :)
If you're not a programmer and you're not interested in learning it you can still help simply by trying it out and sending bug reports and feature requests. To avoid unrealistic expectations I'd like to state that it'll be a long time until fpdb reaches feature parity to established paid-for closed source software.
Feature List (short now, growing fast ;) ):
You can edit/add whatever you like, it's all python and SQL. The code should be fairly straightforward I think and I put some notes into readme-dev.txt but feel free to ask.
Backend, Distribution
=====================
- Choice of MySQL/InnoDB or PostgreSQL. (not tested on PostgreSQL)
- It is possible to run the database on one PC, the importer on another, and then access the database with the table viewer or HUD from a third PC. (note: do NOT do this unencrypted over an untrusted network like your employer's LAN or the Internet!)
Site/Game Support
=================
- Initially only full support for PS, FTP coming soon
- Supports Holdem, Omaha Hi and Omaha Hi/Lo. Stud and Razz coming soon.
- Supports No Limit, Pot Limit, Fixed Limit NL, Cap NL and Cap PL
Note that currently it does not display extra stats for NL/PL so usefulness is limited for these limit types. Suggestions welcome, I don't play these.
- Supports ring/cash games, SnG/MTT coming soon
Tableviewer (tv)
===========
Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:
- VPIP, PFR and Preflop 3B/4B (3B/4B is not quite correct I think)
- Raise and Fold % on flop, turn and river. Fold only counts hands when someone raised. This can be displayed per street or as one combined value each for aggression and folding.
- Number of hands this is based on.
- SD/F (aka WtSD, proportion of hands where player went to showdown after seeing flop)
- W$wSF (Won $ when seen Flop)
- W$@SD (Won $ at showdown)
For all stats it also displays how many hands this particular is based on
IMPORTANT: The database format WILL undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a safe place with any tracking software. Should you however end up loosing your files somehow let me know and I'll try to help.
Please send any feedback, feature requests/suggestions, bug reports and animal names to steffen@sycamoretest.info, pick one of the contact methods listed in readme-overview.txt, send me a PM here or reply to this post.
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

76
docs/status.txt Normal file
View File

@ -0,0 +1,76 @@
For all support please note that the tables WILL be changed, almost certainly without keeping backwards compatibility. Therefore you should keep your history files after import so you can re-import when necessary. Should you lose history files and need a "database updater" let me know.
If support for another site/game would encourage you to help with this software please let me know at steffen@sycamoretest.info.
IMPORTANT: There appears to be a bug in at least up to git34 in reading WtSD/W$wsF/W$SD
Holdem/Omaha ring games on PokerStars
======================================
Works, quite well tested, works in table viewer and is useful now. Functionality is quite limited so far though. This includes the holdem/omaha parts of HORSE, HOSE and any other mixed game
Stud/Razz ring games on PokerStars
==================================
Broken - used to work, hardly tested. Needs to be updated to new infrastructure using a HudData table rather than hands_players_flags. Will fix this shortly.
Tournaments/SnGs
================
Broken - used to work, hardly tested. Needs to be updated to new infrastructure.. Will probably fix this shortly
Full Tilt Poker
===============
Might work - used to work and was very well test. It should import them (except HudData), but I believe the table viewer won't work. Would be easy to fix I think, volunteers welcome. This used to work in a pre-alpha but basically was left behind during updates to the other stuff.
Other Sites
===========
Patches/Volunteers welcome. Should be quite easy.
GUI
===
Alpha - the infrastructure stands and is fast enough, now "just" need to add more functionality.
HUD
===
Not started - volunteers welcome. I found a *nix utility based on xlib that does half the work for this (most of the other half is already in the table viewer), see http://www.roard.com/docs/cookbook/cbsu19.html. There's also a python implementation of xlib which should run even on Windows.
Packaging
=========
Gentoo GNU/Linux: I'll make ebuilds, if you want one now let me know.
Other free/libre systems (e.g. other GNU/Linux-Distros, *BSD, and I'd love to help in getting this to work on any Hurd based system): Let me know what you use (Distribution, version and CPU type) and I'll make a package.
Windows/MacOSX: Manual installation of dependencies for now, integrated installer would be nice - volunteers welcome, but I'll do it eventually in any case.
Regression Testing
==================
The query scripts are done-ish, need to verify more data so it can be used in automated regression testing.
Database Backends
=================
- MySQL InnoDB is the default
- PostgreSQL should work but I haven't tried it. If it doesn't please let me know.
- MySQL ISAM won't be supported since it is not transactional
Legal
=====
General: This will offer more or less the same kind of functionality as HM and PT so there shouldn't be any problem on any site that allows tracking.
PS: I have asked them and they said that due to the fast changing nature
of pre-release software they don't review that. However, looking at their
posted guidelines we're fine
FTP: I sent them an email and what I described there was ok for them.
I will write them again for "certification" on release of 1.0
To avoid any misunderstandings, PS and FTP obviously do not sponsor, endorse, or support fpdb. They allow using it, that's all. Any problems with fpdb should be reported to us, not the poker site.
A note on viewing/tracking mucked hands. Many people will say this is cheating. I agree. However, I don't make the rules on these sites. The sites that store mucked hands into the history file clearly think that being able to see other people's mucked hands is ok. This software - like HM and PT - merely takes info provided by the poker site and makes it more easily accessible.
Apparently PS has now turned this off :)
License
=======
Trademarks of third parties have been used under Fair Use or similar laws.
Copyright 2008 Steffen Jobbagy-Felso
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 as published by the Free Software Foundation; with
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license can be found in fdl-1.2.txt
The program itself is licensed under AGPLv3, see agpl-3.0.txt

920
docs/tabledesign.html Normal file
View File

@ -0,0 +1,920 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>Free Poker DB Tabledesign</TITLE>
</HEAD>
<BODY LANG="en-GB">
<P>See commit comments for version info, see status.txt for status.</P>
<P>Direct suggestions, praise and animal names to steffen@sycamoretest.info or check readme-overview.txt for more contacts</P>
<P>I decided to be generous on the sizes of the types - if computing experience shows one thing then its that it will come back to bite you in the ass if you save 2 bits in the wrong place. If performance and/or db size are too bad we can still shrink some fields.</P>
<p>Relationships are noted in the comment (need to double check that all are listed)</P>
<p>If you want more comments or if anything is confusing or bad let me know.</P>
<p>All money/cash amounts are stored in cents/pennies/whatever (e.g. $4.27 would be stored a 427). Chips are stored as-is (e.g. 3675 chips would be stored as 3675).</P>
<p>Notes on use/editing:</P>
<p>Any change to this must be carried to to the table creation code in fpdb_db.py or at least an entry to known bugs is to be made.</P>
<P>If the code (in particular the importer) and this document disagree then this document is to be considered authorative.</P>
<p><b>License</b><br>
Trademarks of third parties have been used under Fair Use or similar laws.<br>
Copyright 2008 Steffen Jobbagy-Felso<br>
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 as published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found in fdl-1.2.txt<br>
The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<p>See readme.txt for copying</P>
<p><B>Table Settings</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>version</P></TD>
<TD><P>smallint</P></TD>
<TD><P>the git version of the database (ie. table design changes and major bugfixes require a bump)</P></TD>
</TR>
</TABLE>
<p><B>Table Players</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>name</P></TD>
<TD><P>varchar(32)</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>siteId</P></TD>
<TD><P>smallint</P></TD>
<TD><P>references Sites.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>comment</P></TD>
<TD><P>text</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Table Autorates</B></P>
<p>An autorating is a computer-&quot;recognised&quot; label/category for a player. Examples could include &quot;Calling Station&quot; if a player has &lt;20% each for aggression and folding postflop. Or &quot;Tight-Aggressive/Aggressive&quot; for players with &lt;20% VPIP, &gt;10% PFR and &gt;40% postflop aggression.</P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>playerId</P></TD>
<TD><P>int</P></TD>
<TD><P>references Players.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>gametypeId</P></TD>
<TD><P>smallint</P></TD>
<TD><P>references Gametypes.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>description</P></TD>
<TD><P>varchar(50)</P></TD>
<TD><P>autorating description</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>shortDesc</P></TD>
<TD><P>char(8)</P></TD>
<TD><P>short description e.g. for display in HUD</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>ratingTime</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P>timestamp of rating</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>handCount</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands rating is based on</P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Table Gametypes</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>smallint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>siteId</P></TD>
<TD><P>smallint</P></TD>
<TD><P>references sites.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>type</P></TD>
<TD><P>char(4)</P></TD>
<TD><p>valid entries:<br>
ring - ringgames aka cash games<br>
tour - tournament incl SnG</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>base</P></TD>
<TD><P>char(4)</P></TD>
<TD><p>The underlying structure. valid entries:<br>
hold - Holdem and Omaha<br>
stud - Stud and Razz<br>
draw - (incl Badugi)</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>category</P></TD>
<TD><P>varchar(9)</P></TD>
<TD><p>valid entries:<br>
holdem=Texas Hold'em<br>
omahahi=Omaha High only<br>
omahahilo=Omaha 8 or better<br>
razz=Razz<br>
studhi=7 Card Stud High only<br>
studhilo=7 Card Stud 8 or better<br>
fivedraw=Five Card Draw<br>
27_1draw=2-7 Single Draw<br>
27_3draw=2-7 Tripple Draw<br>
badugi=Badugi</p></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>limitType</P></TD>
<TD><P>char(2)</P></TD>
<TD><p>nl=No Limit<br>
cn=Cap No Limit<br>
pl=Pot Limit<br>
cp=Cap Pot Limit<br>
fl=Fixed Limit</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>hiLo</P></TD>
<TD><P>char(1)</P></TD>
<TD><p>Whether the game is hi, lo or both. Valid Entries:<br>
h - High only<br>
l - Low only<br>
s - Hi/Lo Split</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>smallBlind</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>bigBlind</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>smallBet</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>bigBet</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Table Sites</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>smallint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>name</P></TD>
<TD><P>varchar(32)</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>currency</P></TD>
<TD><P>char(3)</P></TD>
<TD><P>currency code, e.g. USD, GBP, EUR</P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Table Hands</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field Name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>tableName</P></TD>
<TD><P>varchar(20)</P></TD>
<TD><P>The site's name for the current table</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>siteHandNo</P></TD>
<TD><P>bigint</P></TD>
<TD><P>the site's hand number</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>gametypeId</P></TD>
<TD><P>smallint</P></TD>
<TD><P>references gametypes.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>handStart</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P>start date&amp;time of the hand</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>importTime</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P>date&amp;time of import of this hand</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>seats</P></TD>
<TD><P>smallint</P></TD>
<TD><P>number of used seats (ie. that got dealt cards)</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>maxSeats</P></TD>
<TD><P>smallint</P></TD>
<TD><P>number of available seats</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>comment</P></TD>
<TD><P>text</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Table BoardCards</B></P>
<p>cardX -&gt; can be 1 through 5</P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field Name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>handId</P></TD>
<TD><P>bigint</P></TD>
<TD><P>the site's hand number</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>cardXValue</P></TD>
<TD><P>smallint</P></TD>
<TD><P>2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x, kept=k (draw only)</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>cardXSuit</P></TD>
<TD><P>char(1)</P></TD>
<TD><P>h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x</P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Table HandsPlayers</B></P>
<p>cardX: can be 1 through 20, one for each card. In holdem only 1-2 of these are used, in omaha 1-4, in stud/razz 1-7, in single draw games 1-10 is used and in badugi 1-16 (4*4) is used.</P>
<p>For the draw games: the first 5 (badugi: 4) cards are the initial cards, the next 5 (badugi: 4) are after the first draw. If a player keeps some cards then those cards' spaces are filled with "k", short for "kept".<br>
Example 1: If a player gets 2-6 spades for his first five cards and decides to throw away the 4 and then gets a 7 of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 4, 5, 6, k, k, 7, k, k<br>
Example 2: If a player gets 2, 3, 5, 8, J of spades for his first five cards and decides to throw away the 2 and the 3 and then gets a Q and K of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 5, 8, J, Q, K, k, k, k<br>
Note that it will k in the space of which card was there previously, so in example 2 where the player kept the last 3 cards, the last 3 fields of the first draw (ie. card8-10Value) are replaced with k.</p>
<p>I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.</P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field Name</P></TD>
<TD><P>Type</P></TD><TD>
<P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>handId</P></TD>
<TD><P>bigint</P></TD>
<TD><P>references Hands.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>playerId</P></TD>
<TD><P>int</P></TD>
<TD><P>references Players.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>startCash</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD></TR>
<TR VALIGN=TOP>
<TD><P>position</P></TD>
<TD><P>char(1)</P></TD>
<TD><p>BB=B, SB=S, Button=0, Cutoff=1, etc.<br>
This is used in holdem/omaha only.</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>seatNo</P></TD>
<TD><P>smallint</P></TD>
<TD><p>The seat in which the person was sitting - necessary for HUD</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>ante</P></TD>
<TD><P>int</P></TD>
<TD><P>note: for cash this could be boolean, but in tourneys you may enter a hand with less than the full ante</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>cardXValue</P></TD>
<TD><P>smallint</P></TD>
<TD><p>2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x<br>
see note above table</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>cardXSuit</P></TD>
<TD><P>char(1)</P></TD>
<TD><P>h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>winnings</P></TD>
<TD><P>int</P></TD>
<TD><P>winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is)</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>rake</P></TD>
<TD><P>int</P></TD>
<TD><P>rake for this player for this hand</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>comment</P></TD>
<TD><P>text</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>tourneysPlayersId</P></TD>
<TD><P>bigint</P></TD>
<TD><P>references TourneysPlayers.id</P></TD>
</TR>
</TABLE>
<p><BR></P>
<P><B>Table HudCache</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P><b>Field Name</b></P></TD>
<TD><P><b>Type</b></P></TD>
<TD><P><b>Comment</b></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P><br></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>gametypeId</P></TD>
<TD><P>smallint</P></TD>
<TD><P>references gametypes.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>playerId</P></TD>
<TD><P>int</P></TD>
<TD><P>references players.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>activeSeats</P></TD>
<TD><P>smallint</P></TD>
<TD><P>range 2-10</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>position</P></TD>
<TD><P>char(1)</P></TD>
<TD><P>Position for which this row applies. In this table this can be B(BB), S(SB), D(Dealer/Button), C(Cutoff), M(Middle - the 3 before cutoff) or E (Early - the 3 before Middle)</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>tourneyTypeId</P></TD>
<TD><P>smallint</P></TD>
<TD><P>References TourneyTypes.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>HDs</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands this player played in this gametype with this number of seats</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street0VPI</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player paid to see flop<br>
Please note that this already includes street0Aggr!<br>
To calculate limp just deduct street0Aggr from this number</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street0Aggr</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player raised before flop</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street0_3B4BChance</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player had chance to 3B or 4B</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street0_3B4BDone</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player 3bet/4bet before flop</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street1Seen</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player saw flop/street4</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street2Seen</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player saw turn/street5</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street3Seen</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player saw river/street6</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street4Seen</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player saw street7</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>sawShowdown</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player saw showdown</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street1Aggr</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player raised flop/street4</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street2Aggr</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player raised turn/street5</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street3Aggr</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player raised river/street6</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street4Aggr</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where player raised street7</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>otherRaisedStreet1</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised flop/street4</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>otherRaisedStreet2</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised turn/street5</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>otherRaisedStreet3</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised river/street6</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>otherRaisedStreet4</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised street7</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToOtherRaisedStreet1</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised flop/street4 and the player folded</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToOtherRaisedStreet2</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised Turn/street5 and the player folded</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToOtherRaisedStreet3</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised River/street6 and the player folded</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToOtherRaisedStreet4</P></TD>
<TD><P>int</P></TD>
<TD><P>number of hands where someone else raised street7 and the player folded</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>wonWhenSeenStreet1</P></TD>
<TD><P>float</P></TD>
<TD><P>How many hands the player won after seeing the flop/street4 - this can be a "partial win" if the pot is split.<br>
To be completely clear, this stores a hand count, NOT a money amount.</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>wonAtSD</P></TD>
<TD><P>float</P></TD>
<TD><P>As wonWhenSeenStreet1, but for showdown.</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>stealAttemptChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player was in CO, BTN or SB and nobody has called yet</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>stealAttempted</P></TD>
<TD><P>int</P></TD>
<TD><P>Player took a chance per the above condition</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldBbToStealChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Somebody tried to steal BB from player</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldedBbToSteal</P></TD>
<TD><P>int</P></TD>
<TD><P>Player folded BB to steal attempt</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldSbToStealChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Somebody tried to steal SB from player</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldedSbToSteal</P></TD>
<TD><P>int</P></TD>
<TD><P>Player folded SB to steal attempt</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street1CBChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player had chance to make continuation bet on flop/street4</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street1CBDone</P></TD>
<TD><P>int</P></TD>
<TD><P>Player used chance to make continuation bet on flop/street4</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street2CBChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player had chance to make continuation bet on turn/street5</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street2CBDone</P></TD>
<TD><P>int</P></TD>
<TD><P>Player used chance to make continuation bet on turn/street5</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street3CBChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player had chance to make continuation bet on river/street6</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street3CBDone</P></TD>
<TD><P>int</P></TD>
<TD><P>Player used chance to make continuation bet on river/street6</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street4CBChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player had chance to make continuation bet on street7</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street4CBDone</P></TD>
<TD><P>int</P></TD>
<TD><P>Player used chance to make continuation bet on street7</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToStreet1CBChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player had chance to fold to continuation bet on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToStreet1CBDone</P></TD>
<TD><P>int</P></TD>
<TD><P>Player used chance to fold to continuation bet on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToStreet2CBChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player had chance to fold to continuation bet on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToStreet2CBDone</P></TD>
<TD><P>int</P></TD>
<TD><P>Player used chance to fold to continuation bet on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToStreet3CBChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player had chance to fold to continuation bet on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToStreet3CBDone</P></TD>
<TD><P>int</P></TD>
<TD><P>Player used chance to fold to continuation bet on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToStreet4CBChance</P></TD>
<TD><P>int</P></TD>
<TD><P>Player had chance to fold to continuation bet on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>foldToStreet4CBDone</P></TD>
<TD><P>int</P></TD>
<TD><P>Player used chance to fold to continuation bet on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>totalProfit</P></TD>
<TD><P>int</P></TD>
<TD><P>how much money in cents the player made</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street1CheckCallRaiseChance</P></TD>
<TD><P>int</P></TD>
<TD><P>How often player had the chance to do a check-raise or a call-raise on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street1CheckCallRaiseDone</P></TD>
<TD><P>int</P></TD>
<TD><P>How often player used the chance to do a check-raise or a call-raise on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street2CheckCallRaiseChance</P></TD>
<TD><P>int</P></TD>
<TD><P>How often player had the chance to do a check-raise or a call-raise on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street2CheckCallRaiseDone</P></TD>
<TD><P>int</P></TD>
<TD><P>How often player used the chance to do a check-raise or a call-raise on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street3CheckCallRaiseChance</P></TD>
<TD><P>int</P></TD>
<TD><P>How often player had the chance to do a check-raise or a call-raise on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street3CheckCallRaiseDone</P></TD>
<TD><P>int</P></TD>
<TD><P>How often player used the chance to do a check-raise or a call-raise on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street4CheckCallRaiseChance</P></TD>
<TD><P>int</P></TD>
<TD><P>How often player had the chance to do a check-raise or a call-raise on this street</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street4CheckCallRaiseDone</P></TD>
<TD><P>int</P></TD>
<TD><P>How often player used the chance to do a check-raise or a call-raise on this street</P></TD>
</TR>
</TABLE>
<P></P>
<P><B>Table HandsActions</B></P>
<p>Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.</P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field Name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>handPlayerId</P></TD>
<TD><P>bigint</P></TD>
<TD><P>references HandsPlayers.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>street</P></TD>
<TD><P>smallint</P></TD>
<TD><p>street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud</P><P>-1 for seen showdown</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>actionNo</P></TD>
<TD><P>smallint</P></TD>
<TD><P>action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)<br>
Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>action</P></TD>
<TD><P>char(5)</P></TD>
<TD><P>Bet stands for bring in, complete, bet, double bet, raise and double raise, since they all - technically - do the same thing. Unbet is used for when an uncalled bet is returned, this will have a negative value for amount.</P>
<P>Other valid values: blind call check fold</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>allIn</P></TD>
<TD><P>boolean</P></TD>
<TD><P>Whether the player went all-in on this action</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>amount</P></TD>
<TD><P>int</P></TD>
<TD><P>amount put into the middle for this action</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>comment</P></TD>
<TD><P>text</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Tournament Tables</B></P>
<p><BR></P>
<p><B>Table Tourneys</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>tourneyTypeId</P></TD>
<TD><P>smallint</P></TD>
<TD><P>References TourneyTypes.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>siteTourneyNo</P></TD>
<TD><P>bigint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>entries</P></TD>
<TD><P>int</P></TD>
<TD><P>-1 if unknown</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>prizepool</P></TD>
<TD><P>int</P></TD>
<TD><p>Need this as separate field to support rebuy/addon</P><P>-1 if unknown</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>startTime</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P>Empty if unknown</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>comment</P></TD>
<TD><P>text</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Table TourneyTypes</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>siteId</P></TD>
<TD><P>smallint</P></TD>
<TD><P>References Sites.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>buyin</P></TD>
<TD><P>int</P></TD>
<TD><P>Buy-in in cents. Without rebuy/add-on</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>fee</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>knockout</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>rebuyOrAddon</P></TD>
<TD><P>boolean</P></TD>
<TD><P>Whether rebuys or add-ons are possible</P></TD>
</TR>
</TABLE>
<p><BR></P>
<p><B>Table TourneysPlayers</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP>
<TD><P>Field Name</P></TD>
<TD><P>Type</P></TD>
<TD><P>Comment</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>tourneyId</P></TD>
<TD><P>int</P></TD>
<TD><P>References Tourneys.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>playerId</P></TD>
<TD><P>int</P></TD>
<TD><P>References Players.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>payinAmount</P></TD>
<TD><P>int</P></TD>
<TD><P>Buyin, fee, rebuys and add-ons</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>rank</P></TD>
<TD><P>int</P></TD>
<TD><P>Finishing rank</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>winnings</P></TD>
<TD><P>signed int</P></TD>
<TD><P>Winnings (not profit) by this player, -1 if unknown.</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>comment</P></TD>
<TD><P>text</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
</TABLE>
</BODY>
</HTML>

View File

@ -0,0 +1,178 @@
#!/usr/bin/pugs
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
module LibFpdbImport;
use v6;
#use strict;
use LibFpdbShared;
#use LibFpdbImport2;
class Player {
has Str $name;
has Int $start_cash;
has Card @.cards;
has Char $position;
submethod BUILD (Str @strings) {
say "todo: implement Player.BUILD";
}#end Player.BUILD
our Player method find_players(@strings) {
#todo: i think this should be sub since its a class method not an instance method
say "todo: implement Player.find_players";
}
}#end class Player
class Line {
has Str $line;
has Bool $processed;
our protected submethod BUILD() {
say "todo: implement Line.BUILD?"
}#end Line.BUILD
our Line method recognise_and_parse(@strings) {
#todo: i think this should be sub since its a class method not an instance method
say "todo: implement Line.recognise_and_parse";
}#end Line.recognise_and_parse
}#end class Line
class ActionLine is Line {
has Player $player;
has Str $type;
has Int $amount;
has Bool $all_in;
has Int $action_no;
}#end class ActionLine
class WinLine is Line {
has Player $player;
has Int $amount;
}#end class WinLine
class RakeLine is Line {
has Int $amount;
}#end class RakeLine
class CardLine is Line {
has Bool $board_line;
has Player $player;
has Card @cards;
}#end class CardLine
#for useless lines
class CrapLine is Line {
has Str $type;
}#end class CrapLine
class Hand {
has Line @.lines;
#has Str @strings;
has Site $site;
has Str $currency;
has Str $type;
has Str $category;
has Str $limit_type;#todo: above ; missing causes error, but that doesnt list ; as a possibility
has Player @.players;
has Card @.board;
has Int $db_id;
submethod BUILD(Str @strings) {
Util.debug("running Hand.BUILD");
say "strings:",@strings;
#this contructor automatically parses the hand. call .store for storing
@.players=Player.find_players(@strings);
@.lines=Line.recognise_and_parse(@strings);
for @strings -> $line {
if class_of(line)==CardLine {
if line.board {
board=line.cards;
} else {
for player in players {
if line.player==player {
player.cards=line.cards;
}
}
}
}
}
}#end Hand.BUILD
our Bool method is_holdem(){
if category==("holdem"|"omahahi"|"omahahilo") {
return True;
} else {
return False;
}
}#end Hand.is_holdem
our Bool method is_stud(){
return not is_holdem();
}#end Hand.is_stud
our Bool method store($db) {
say "todo: Hand.store";
}#end Hand.store
}#end class Hand
class Importer {
#todo: be Thread?
submethod BUILD (Database $db, Str $filename) {
Util.debug("running Importer.BUILD");
if (not ($db.is_connected())) {
Util.fatal("not connected to DB");
}
my IO $?filehandle=$filename;
#for =$filehandle -> $line {say $line}
my Str @lines =$filehandle;
my Int $hand_start=0;
my Int $hand_end=0;
my Int $loopcount=0;
loop {#one loop of this per hand
$loopcount++;
say "loopcount", $loopcount;
my Int $current_line_index=$hand_end+1; #previous hand end is new hand start
for (my Int $i, $i<5, $i++) {#remove blank hands
if (@lines[$current_line_index].bytes) < 6 {
$current_line_index++;
} else {
$hand_start=$current_line_index;
break;
}
}
my Bool $continue=True; #todo: this is dumb, find out correct loop
while $continue {#loop through the lines to find end of hand
$current_line_index++;
if (@lines[$current_line_index].bytes) < 6 {
$hand_end=$current_line_index;
$continue=False;
}
}#end of find end of hand loop
my Str @handlines=@lines[$hand_start..$hand_end];
my Hand $hand .= new(:lines(@handlines));
$hand.store($db);
say "todo: record \$db_id";
say "todo: terminate on EOF";
}
}#end new Importer
}#end class Importer

View File

@ -0,0 +1,84 @@
#!/usr/bin/pugs
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
module LibFpdbShared;
use v6;
#use strict;
class Util {
method debug(Str $string) {
#todo: i think this should be sub since its a class method not an instance method
say "debug notice: ", $string;
}#end debug_msg
sub warn(Str $string) {
say "todo: Util.warning";
}#end warning
sub fatal(Str $string, Database $db) {
say "todo: Util.fatal_error";
}#end fatal_error
}#end class Util
class Database {
has Str $backend;
has Str $host;
has Str $name;
has Str $user;
my Str $password;
submethod BUILD (Str $!backend, Str $!host, Str $!name, Str $!user, Str $!password) {
Util.debug("running Database.BUILD");
self.connect();
}#end new Database
our method connect() {
say "todo: db.connect";
}#end connect
method disconnect() {
say "todo: db.disconnect";
}#end disconnect
method cancel_import() {
say "todo: db.cancel_import";
}#end cancel_import
my method drop_tables() {
#todo: make this one private
say "todo: db.drop_tables";
}#end drop_tables
method recreate_tables() {
say "todo: db.recreate_tables";
}#end recreate_tables
#returns the id of the insert
our Int method insert(Str $sql_command) {
#todo: is it a bug that i need the "our" above?
say "todo: db.insert";
return 0;
}#end insert
our Str method fetch(Str $sql_command) {
say "todo: db.fetch";
}#end fetch
our Bool method is_connected() {
say "todo: db.is_connected";
}#end
}#end class Database

View File

@ -0,0 +1,17 @@
#!/usr/bin/pugs
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.

View File

@ -0,0 +1,29 @@
#!/usr/bin/pugs
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
use v6;
#use strict;
use LibFpdbImport;
use LibFpdbShared;
my Database $db .= new(:backend<MySQL InnoDB>, :host<localhost>, :database<fpdb>, :user<fpdb>, :password<myPW>);
#todo: below doesnt work
my Importer $imp .= new(:db($db), :filename<HH-LHE1.txt>);
#perlbug?: adding another named argument that isnt listed in the constructor gave very weird error.
say $imp;

View File

@ -0,0 +1,62 @@
# Copyright 1999-2008 Gentoo Foundation
# Gentoo had nothing to do with the production of this ebuild, but I'm pre-emptively transferring all copyrights (as far as legally possible under my local jurisdiction) to them.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-util/fpdb/fpdb-1.0_alpha8_p137.ebuild,v 1.0 2008/10/17 steffen@sycamoretest.info Exp $
NEED_PYTHON=2.3
#inherit distutils
MY_P="fpdb-${PV}"
DESCRIPTION="A database program to track your online poker games"
HOMEPAGE="https://sourceforge.net/projects/fpdb/"
SRC_URI="mirror://sourceforge/fpdb/${MY_P}.tar.bz2"
LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
#note: this should work on other architectures too, please send me your experiences
IUSE=""
RDEPEND="virtual/mysql
dev-python/mysql-python
>=x11-libs/gtk+-2.10
dev-python/pygtk
dev-python/numpy
dev-python/matplotlib"
DEPEND="${RDEPEND}"
src_install() {
DIRINST="${D}usr/share/games/fpdb/"
mkdir -p "${DIRINST}"
cp -R * "${DIRINST}" || die
DIRBIN="${D}usr/games/bin/"
mkdir -p "${DIRBIN}"
#echo "pathes"
#echo "${DIRINST}pyfpdb/fpdb.py"
#echo "${DIRBIN}fpdb.py"
#echo
echo "cd /usr/share/games/fpdb/pyfpdb/ && python fpdb.py" > "${DIRBIN}fpdb" || die
chmod 755 "${DIRBIN}fpdb" || die
}
#src_test() {
#}
pkg_postinst() {
elog "Fpdb has been installed and can be called by executing /usr/games/bin/fpdb"
elog "You need to perform a couple more steps manually."
elog "Please also make sure you followed instructions from previous emerges, in particular make sure you configured mysql and set a root pw for it"
elog "Now run this command to connect to MySQL: mysql --user=root --password=yourPassword"
elog "In the mysql command line interface you need to type these two lines (make sure you get the ; at the end)"
elog "In the second line replace \"newPassword\" with a password of your choice"
elog "CREATE DATABASE fpdb;"
elog "GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;"
elog "Finally copy the default config file from ${DIRINST}docs/default.conf to ~/.fpdb/ for every user that is to use fpdb."
elog "You will need to edit the default.conf, in particular you need to replace the password with what you entered in the \"GRANT ALL...\""
elog "Finally run the GUI and click the menu database -> recreate tables"
elog "That's it! See our webpage at http://fpdb.sourceforge.net for more documentation"
elog " "
}

View File

@ -0,0 +1,62 @@
# Copyright 1999-2008 Gentoo Foundation
# Gentoo had nothing to do with the production of this ebuild, but I'm pre-emptively transferring all copyrights (as far as legally possible under my local jurisdiction) to them.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-util/fpdb/fpdb-1.0_alpha8_p137.ebuild,v 1.0 2008/10/17 steffen@sycamoretest.info Exp $
NEED_PYTHON=2.3
#inherit distutils
MY_P="fpdb-${PV}"
DESCRIPTION="A database program to track your online poker games"
HOMEPAGE="https://sourceforge.net/projects/fpdb/"
SRC_URI="mirror://sourceforge/fpdb/${MY_P}.tar.bz2"
LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
#note: this should work on other architectures too, please send me your experiences
IUSE=""
RDEPEND="virtual/mysql
dev-python/mysql-python
>=x11-libs/gtk+-2.10
dev-python/pygtk
dev-python/numpy
dev-python/matplotlib"
DEPEND="${RDEPEND}"
src_install() {
DIRINST="${D}usr/share/games/fpdb/"
mkdir -p "${DIRINST}"
cp -R * "${DIRINST}" || die
DIRBIN="${D}usr/games/bin/"
mkdir -p "${DIRBIN}"
#echo "pathes"
#echo "${DIRINST}pyfpdb/fpdb.py"
#echo "${DIRBIN}fpdb.py"
#echo
echo "cd /usr/share/games/fpdb/pyfpdb/ && python fpdb.py" > "${DIRBIN}fpdb" || die
chmod 755 "${DIRBIN}fpdb" || die
}
#src_test() {
#}
pkg_postinst() {
elog "Fpdb has been installed and can be called by executing /usr/games/bin/fpdb"
elog "You need to perform a couple more steps manually."
elog "Please also make sure you followed instructions from previous emerges, in particular make sure you configured mysql and set a root pw for it"
elog "Now run this command to connect to MySQL: mysql --user=root --password=yourPassword"
elog "In the mysql command line interface you need to type these two lines (make sure you get the ; at the end)"
elog "In the second line replace \"newPassword\" with a password of your choice"
elog "CREATE DATABASE fpdb;"
elog "GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;"
elog "Finally copy the default config file from ${DIRINST}docs/default.conf to ~/.fpdb/ for every user that is to use fpdb."
elog "You will need to edit the default.conf, in particular you need to replace the password with what you entered in the \"GRANT ALL...\""
elog "Finally run the GUI and click the menu database -> recreate tables"
elog "That's it! See our webpage at http://fpdb.sourceforge.net for more documentation"
elog " "
}

View File

@ -0,0 +1,182 @@
;"%programfiles%\MySQL\MySQL Server 5.0\bin\mysqld" --remove
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Includes
#include <GUIConstantsEx.au3>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Variables
Dim $rootPwd = ""
Dim $fpdbUserPwd = ""
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Welcome message and option to abort. Change of working dir to \fpdbEnv
Dim $welcomeBox = MsgBox(4100, "fpdb environment installation", "This installer will automatically create the environment which is needed to run fpdb." & @CRLF & @CRLF & _
"This means installing and configuring MySQL and Python including some special modules," & @CRLF & "creating a directory for your fpdb user profile and adding gtk to your path." & @CRLF & @CRLF & _
"You are advised to close all aplications before you proceed." & @CRLF & @CRLF & _
"DON'T use the keyboard or the mouse during installation unless you are asked to! Just WAIT until the message box 'End of Installation' pops up!" & @CRLF & @CRLF & _
"If you want to continue the installation click 'Yes'." & @CRLF & "If you want to abort the installation click 'No'.")
If $welcomeBox == 7 Then
Exit ;Exit Installation if 'No' button is clicked in message box
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Ask user for mysql root password
GUICreate("FPDB Environment Installation", 600, 400)
GUICtrlCreateLabel("For the installation of the FPDB Environment the MySQL root password and your poker database password are needed.", 20, 25)
GUICtrlCreateLabel("In case MySQL and/or your fpdb poker database aren't installed on your computer, just pick a password.", 20, 50)
GUICtrlCreateLabel("MySQL Root Password:", 20, 100)
$rootPw = GUICtrlCreateInput("your password here", 150, 100, 100, 20)
GUICtrlCreateLabel("Retype password:", 290, 100)
$rootPwR = GUICtrlCreateInput("", 420, 100, 100, 20)
GUICtrlCreateLabel("Poker DB User Password:", 20, 150)
$userPw = GUICtrlCreateInput("your password here", 150, 150, 100, 20)
GUICtrlCreateLabel("Retype password:", 290, 150)
$userPwR = GUICtrlCreateInput("", 420, 150, 100, 20)
$okbutton = GUICtrlCreateButton("OK", 270, 200, 60, 20)
$status = GUICtrlCreateLabel("This is the status line. It describes what the installer is doing at the moment.", 20, 250, 560)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $okbutton
If Not(GUICtrlRead($rootPw) == GUICtrlRead($rootPwR)) OR GUICtrlRead($rootPw) == "" Then
MsgBox(16, "", "The passwords don't macht! Try again!", 20, 250)
ElseIf Not(GUICtrlRead($userPw) == GUICtrlRead($userPwR)) OR GUICtrlRead($userPw) == "" Then
MsgBox(16, "", "The passwords don't macht! Try again!", 20, 250)
Else
$rootPwd = GUICtrlRead($rootPw)
$fpdbUserPwd = GUICtrlRead($userPw)
GUICtrlSetState($okbutton, $GUI_DISABLE)
ExitLoop
EndIf
EndSelect
WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Files Needed
FileInstall("fpdb\7za.exe", "7za.exe")
FileInstall("fpdb\MySQL Server 5.0.7z", "MySQL Server 5.0.7z")
FileInstall("fpdb\gtk.7z", "gtk.7z")
FileInstall("fpdb\python-2.5.2.msi", "python-2.5.2.msi")
FileInstall("fpdb\pymysql.7z", "pymysql.7z")
FileInstall("fpdb\pycairo.7z", "pycairo.7z")
FileInstall("fpdb\pygobject.7z", "pygobject.7z")
FileInstall("fpdb\pygtk.7z", "pygtk.7z")
FileInstall("fpdb\psykopg2.7z", "psykopg2.7z")
FileInstall("fpdb\pywin32.7z", "pywin32.7z")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MySQL Install and configuration
If NOT FileExists(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql.exe") Then
GUICtrlSetData($status, "Installing MySQL Database Management System and creating MySQL windows service.")
RunWait('7za.exe x "MySQL Server 5.0.7z" -o"' & EnvGet("programfiles") & '\MySQL\" -aoa', "", @SW_HIDE)
RunWait('"' & EnvGet("programfiles") & '\MySQL\MySQL Server 5.0\bin\mysqld" --install', "", @SW_HIDE)
RunWait("net start mysql", "", @SW_HIDE)
ProcessWait("mysqld.exe")
GUICtrlSetData($status, "Securing important MySQL user accounts.")
Sleep(5000)
FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql1.txt", "DELETE FROM mysql.user WHERE User = '';" & @CRLF)
FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql1.txt", "UPDATE mysql.user SET Password = PASSWORD('" & $rootPwd & "') WHERE User = 'root';" & @CRLF)
FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql1.txt", "FLUSH PRIVILEGES;" & @CRLF)
RunWait(@ComSpec & ' /c mysql --user=root -e "source mysql1.txt"', EnvGet("programfiles") & '\MySQL\MySQL Server 5.0\bin\', @SW_HIDE)
EndIf
If NOT FileExists(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\data\fpdb") Then
GUICtrlSetData($status, "Creating fpdb database.")
FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql2.txt", "create database fpdb;" & @CRLF)
RunWait(@ComSpec & ' /c mysql --user=root --password=' & $rootPwd & ' -e "source mysql2.txt"', EnvGet("programfiles") & '\MySQL\MySQL Server 5.0\bin\', @SW_HIDE)
EndIf
GUICtrlSetData($status, "Creating MySQL user 'fpdb' and granting privileges.")
FileWrite(EnvGet("programfiles") & "\MySQL\MySQL Server 5.0\bin\mysql3.txt", "GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY '" & $fpdbUserPwd & "' WITH GRANT OPTION;" & @CRLF)
RunWait(@ComSpec & ' /c mysql --user=root --password=' & $rootPwd & ' -e "source mysql3.txt"', EnvGet("programfiles") & '\MySQL\MySQL Server 5.0\bin\', @SW_HIDE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GTK
GUICtrlSetData($status, "Installing GTK.")
RunWait('7za.exe x "gtk.7z" -oc:\ -aoa', "", @SW_HIDE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Python 2.5 Installation
GUICtrlSetData($status, "Installing Python 2.5.2")
RunWait("msiexec /quiet /i python-2.5.2.msi", "", @SW_HIDE) ;Install Python without user interaction
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; pymysql
GUICtrlSetData($status, "Installing pymysql")
RunWait('7za.exe x "pymysql.7z" -oC:\Python25\Lib\site-packages -aoa', "", @SW_HIDE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; pycairo
GUICtrlSetData($status, "Installing pycairo")
RunWait('7za.exe x "pycairo.7z" -oC:\ -aoa', "", @SW_HIDE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; pygobject
GUICtrlSetData($status, "Installing pygobject")
RunWait('7za.exe x "pygobject.7z" -oC:\ -aoa', "", @SW_HIDE)
RunWait(@ComSpec & ' /c C:\Python25\python.exe pygobject_postinstall.py -install', "C:\Python25\SCRIPTS", @SW_HIDE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; pygtk
GUICtrlSetData($status, "Installing pygtk")
RunWait('7za.exe x "pygtk.7z" -oC:\ -aoa', "", @SW_HIDE)
RunWait(@ComSpec & ' /c C:\Python25\python.exe pygtk_postinstall.py -install', "C:\Python25\SCRIPTS", @SW_HIDE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; psykopg2
GUICtrlSetData($status, "Installing psykopg2")
RunWait('7za.exe x "psykopg2.7z" -oC:\ -aoa', "", @SW_HIDE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; pywin32
GUICtrlSetData($status, "Installing pywin32 for Python 2.5")
RunWait('7za.exe x "pywin32.7z" -oC:\ -aoa', "", @SW_HIDE)
RunWait(@ComSpec & ' /c C:\Python25\python.exe pywin32_postinstall.py -install', "C:\Python25\SCRIPTS", @SW_HIDE)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Creating directory for default.conf and coping the file into it
GUICtrlSetData($status, "Creating and installing default.conf file.")
$file = FileOpen("default.conf", 1)
FileWriteLine($file, "db-backend=2" & @CRLF)
FileWriteLine($file, "db-host=localhost" & @CRLF)
FileWriteLine($file, "db-databaseName=fpdb" & @CRLF)
FileWriteLine($file, "db-user=fpdb" & @CRLF)
FileWriteLine($file, "db-password=" & $fpdbUserPwd & @CRLF)
FileWriteLine($file, "tv-combinedStealFold=True" & @CRLF)
FileWriteLine($file, "tv-combined2B3B=True" & @CRLF)
FileWriteLine($file, "tv-combinedPostflop=True" & @CRLF)
FileWriteLine($file, "bulkImport-defaultPath=default" & @CRLF)
FileWriteLine($file, "hud-defaultPath=default" & @CRLF)
FileWriteLine($file, "imp-callFpdbHud=True" & @CRLF)
FileClose($file)
FileCopy("default.conf", EnvGet("appdata") & "\fpdb\", 9)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Registry
GUICtrlSetData($status, "Creating backup of path variable and adding GTK and Python to path variable.")
RegWrite("HKEY_CURRENT_USER\Environment", "PathBackup", "REG_SZ", RegRead("HKEY_CURRENT_USER\Environment", "path"))
RegWrite("HKEY_CURRENT_USER\Environment", "path", "REG_SZ", RegRead("HKEY_CURRENT_USER\Environment", "path") & ';C:\gtk\bin;C:\Python25')
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Delete installation files
GUICtrlSetData($status, "Deleting temporary installation files.")
FileDelete("7za.exe")
FileDelete("MySQL Server 5.0.7z")
FileDelete("gtk.7z")
FileDelete("python-2.5.2.msi")
FileDelete("pymysql.7z")
FileDelete("pycairo.7z")
FileDelete("pygobject.7z")
FileDelete("pygtk.7z")
FileDelete("psykopg2.7z")
FileDelete("pywin32.7z")
FileDelete("default.conf")
$goodbyeBox = MsgBox(4100, "End of Installation", "The Computer needs to be restarted for the installation to be complete." & @CRLF & _
"After that you can start fpdb by double clicking the file fpdb.py which is located in the folder pyfpdb of the fpdb build you downloaded." & @CRLF & _
"If you haven't downloaded fpdb yet you can do it here: http://ovh.dl.sourceforge.net/sourceforge/fpdb/fpdb-alpha2-p68.zip" & @CRLF & @CRLF & _
"If you want to restart the computer now click 'Yes'." & @CRLF & _
"If you want to restart the computer later click 'No'.")
If $goodbyeBox == 7 Then
Exit ;Exit Installation if 'No' button is clicked in message box
EndIf
Run("shutdown.exe -r -t 0")

22
prepare-git.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
rm regression-test/*.found.txt
rm regression-test/*.pyc
rm pyfpdb/*.pyc
git-add--interactive

BIN
pyfpdb/Cards01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

66
pyfpdb/CliFpdb.py Executable file
View File

@ -0,0 +1,66 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import os
import sys
import fpdb_simple
from optparse import OptionParser
try:
import MySQLdb
except:
diaSQLLibMissing = gtk.Dialog(title="Fatal Error - SQL interface library missing", parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK))
print "Please note that the CLI importer only works with MySQL, if you use PostgreSQL this error is expected."
import fpdb_import
import fpdb_db
if __name__ == "__main__":
#process CLI parameters
parser = OptionParser()
parser.add_option("-c", "--handCount", default="0", type="int",
help="Number of hands to import (default 0 means unlimited)")
parser.add_option("-d", "--database", default="fpdb", help="The MySQL database to use (default fpdb)")
parser.add_option("-e", "--errorFile", default="failed.txt",
help="File to store failed hands into. (default: failed.txt) Not implemented.")
parser.add_option("-f", "--inputFile", "--file", "--inputfile", default="stdin",
help="The file you want to import (remember to use quotes if necessary)")
parser.add_option("-m", "--minPrint", "--status", default="50", type="int",
help="How often to print a one-line status report (0 means never, default is 50)")
parser.add_option("-p", "--password", help="The password for the MySQL user")
parser.add_option("-q", "--quiet", action="store_true",
help="If this is passed it doesn't print a total at the end nor the opening line. Note that this purposely does NOT change --minPrint")
parser.add_option("-s", "--server", default="localhost",
help="Hostname/IP of the MySQL server (default localhost)")
parser.add_option("-u", "--user", default="fpdb", help="The MySQL username (default fpdb)")
parser.add_option("-x", "--failOnError", action="store_true",
help="If this option is passed it quits when it encounters any error")
(options, sys.argv) = parser.parse_args()
settings={'imp-callFpdbHud':False, 'db-backend':2}
settings['db-host']=options.server
settings['db-user']=options.user
settings['db-password']=options.password
settings['db-databaseName']=options.database
settings['handCount']=options.handCount
settings['failOnError']=options.failOnError
importer = fpdb_import.Importer(options, settings)
importer.addImportFile(options.inputFile)
importer.runImport()

578
pyfpdb/Configuration.py Executable file
View File

@ -0,0 +1,578 @@
#!/usr/bin/env python
"""Configuration.py
Handles HUD configuration files.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# Standard Library modules
import os
import sys
import string
import traceback
import shutil
import xml.dom.minidom
from xml.dom.minidom import Node
class Layout:
def __init__(self, max):
self.max = int(max)
self.location = []
for i in range(self.max + 1): self.location.append(None)
def __str__(self):
temp = " Layout = %d max, width= %d, height = %d, fav_seat = %d\n" % (self.max, self.width, self.height, self.fav_seat)
temp = temp + " Locations = "
for i in range(1, len(self.location)):
temp = temp + "(%d,%d)" % self.location[i]
return temp + "\n"
class Site:
def __init__(self, node):
self.site_name = node.getAttribute("site_name")
self.table_finder = node.getAttribute("table_finder")
self.screen_name = node.getAttribute("screen_name")
self.site_path = node.getAttribute("site_path")
self.HH_path = node.getAttribute("HH_path")
self.decoder = node.getAttribute("decoder")
self.hudopacity = node.getAttribute("hudopacity")
self.hudbgcolor = node.getAttribute("bgcolor")
self.hudfgcolor = node.getAttribute("fgcolor")
self.converter = node.getAttribute("converter")
self.layout = {}
for layout_node in node.getElementsByTagName('layout'):
max = int( layout_node.getAttribute('max') )
lo = Layout(max)
lo.fav_seat = int( layout_node.getAttribute('fav_seat') )
lo.width = int( layout_node.getAttribute('width') )
lo.height = int( layout_node.getAttribute('height') )
for location_node in layout_node.getElementsByTagName('location'):
lo.location[int( location_node.getAttribute('seat') )] = (int( location_node.getAttribute('x') ), int( location_node.getAttribute('y')))
self.layout[lo.max] = lo
def __str__(self):
temp = "Site = " + self.site_name + "\n"
for key in dir(self):
if key.startswith('__'): continue
if key == 'layout': continue
value = getattr(self, key)
if callable(value): continue
temp = temp + ' ' + key + " = " + str(value) + "\n"
for layout in self.layout:
temp = temp + "%s" % self.layout[layout]
return temp
class Stat:
def __init__(self):
pass
def __str__(self):
temp = " stat_name = %s, row = %d, col = %d, tip = %s, click = %s, popup = %s\n" % (self.stat_name, self.row, self.col, self.tip, self.click, self.popup)
return temp
class Game:
def __init__(self, node):
self.game_name = node.getAttribute("game_name")
self.db = node.getAttribute("db")
self.rows = int( node.getAttribute("rows") )
self.cols = int( node.getAttribute("cols") )
self.stats = {}
for stat_node in node.getElementsByTagName('stat'):
stat = Stat()
stat.stat_name = stat_node.getAttribute("stat_name")
stat.row = int( stat_node.getAttribute("row") )
stat.col = int( stat_node.getAttribute("col") )
stat.tip = stat_node.getAttribute("tip")
stat.click = stat_node.getAttribute("click")
stat.popup = stat_node.getAttribute("popup")
stat.hudprefix = stat_node.getAttribute("hudprefix")
stat.hudsuffix = stat_node.getAttribute("hudsuffix")
self.stats[stat.stat_name] = stat
def __str__(self):
temp = "Game = " + self.game_name + "\n"
temp = temp + " db = %s\n" % self.db
temp = temp + " rows = %d\n" % self.rows
temp = temp + " cols = %d\n" % self.cols
for stat in self.stats.keys():
temp = temp + "%s" % self.stats[stat]
return temp
class Database:
def __init__(self, node):
self.db_name = node.getAttribute("db_name")
self.db_server = node.getAttribute("db_server")
self.db_ip = node.getAttribute("db_ip")
self.db_user = node.getAttribute("db_user")
self.db_type = node.getAttribute("db_type")
self.db_pass = node.getAttribute("db_pass")
def __str__(self):
temp = 'Database = ' + self.db_name + '\n'
for key in dir(self):
if key.startswith('__'): continue
value = getattr(self, key)
if callable(value): continue
temp = temp + ' ' + key + " = " + value + "\n"
return temp
class Mucked:
def __init__(self, node):
self.name = node.getAttribute("mw_name")
self.cards = node.getAttribute("deck")
self.card_wd = node.getAttribute("card_wd")
self.card_ht = node.getAttribute("card_ht")
self.rows = node.getAttribute("rows")
self.cols = node.getAttribute("cols")
self.format = node.getAttribute("stud")
def __str__(self):
temp = 'Mucked = ' + self.name + "\n"
for key in dir(self):
if key.startswith('__'): continue
value = getattr(self, key)
if callable(value): continue
temp = temp + ' ' + key + " = " + value + "\n"
return temp
class Popup:
def __init__(self, node):
self.name = node.getAttribute("pu_name")
self.pu_stats = []
for stat_node in node.getElementsByTagName('pu_stat'):
self.pu_stats.append(stat_node.getAttribute("pu_stat_name"))
def __str__(self):
temp = "Popup = " + self.name + "\n"
for stat in self.pu_stats:
temp = temp + " " + stat
return temp + "\n"
class Import:
def __init__(self, node):
self.interval = node.getAttribute("interval")
self.callFpdbHud = node.getAttribute("callFpdbHud")
def __str__(self):
return " interval = %s\n callFpdbHud = %s\n" % (self.interval, self.callFpdbHud)
class Tv:
def __init__(self, node):
self.combinedStealFold = node.getAttribute("combinedStealFold")
self.combined2B3B = node.getAttribute("combined2B3B")
self.combinedPostflop = node.getAttribute("combinedPostflop")
def __str__(self):
return (" combinedStealFold = %s\n combined2B3B = %s\n combinedPostflop = %s\n" %
(self.combinedStealFold, self.combined2B3B, self.combinedPostflop) )
class Config:
def __init__(self, file = None):
# "file" is a path to an xml file with the fpdb/HUD configuration
# we check the existence of "file" and try to recover if it doesn't exist
self.default_config_path = self.get_default_config_path()
if not file == None: # configuration file path has been passed
if not os.path.exists(file):
print "Configuration file %s not found. Using defaults." % (file)
sys.stderr.write("Configuration file %s not found. Using defaults." % (file))
file = None
if file == None: # configuration file path not passed or invalid
file = self.find_config() #Look for a config file in the normal places
if file == None: # no config file in the normal places
file = self.find_example_config() #Look for an example file to edit
if not file == None:
pass
if file == None: # that didn't work either, just die
print "No HUD_config_xml found. Exiting"
sys.stderr.write("No HUD_config_xml found. Exiting")
sys.exit()
# Parse even if there was no real config file found and we are using the example
# If using the example, we'll edit it later
try:
print "Reading configuration file %s\n" % (file)
doc = xml.dom.minidom.parse(file)
except:
print "Error parsing %s. See error log file." % (file)
traceback.print_exc(file=sys.stderr)
print "press enter to continue"
sys.stdin.readline()
sys.exit()
self.doc = doc
self.file = file
self.supported_sites = {}
self.supported_games = {}
self.supported_databases = {}
self.mucked_windows = {}
self.popup_windows = {}
# s_sites = doc.getElementsByTagName("supported_sites")
for site_node in doc.getElementsByTagName("site"):
site = Site(node = site_node)
self.supported_sites[site.site_name] = site
# s_games = doc.getElementsByTagName("supported_games")
for game_node in doc.getElementsByTagName("game"):
game = Game(node = game_node)
self.supported_games[game.game_name] = game
# s_dbs = doc.getElementsByTagName("supported_databases")
for db_node in doc.getElementsByTagName("database"):
db = Database(node = db_node)
self.supported_databases[db.db_name] = db
# s_dbs = doc.getElementsByTagName("mucked_windows")
for mw_node in doc.getElementsByTagName("mw"):
mw = Mucked(node = mw_node)
self.mucked_windows[mw.name] = mw
# s_dbs = doc.getElementsByTagName("popup_windows")
for pu_node in doc.getElementsByTagName("pu"):
pu = Popup(node = pu_node)
self.popup_windows[pu.name] = pu
for imp_node in doc.getElementsByTagName("import"):
imp = Import(node = imp_node)
self.imp = imp
for tv_node in doc.getElementsByTagName("tv"):
tv = Tv(node = tv_node)
self.tv = tv
db = self.get_db_parameters('fpdb')
if db['db-password'] == 'YOUR MYSQL PASSWORD':
df_file = self.find_default_conf()
if df_file == None: # this is bad
pass
else:
df_parms = self.read_default_conf(df_file)
self.set_db_parameters(db_name = 'fpdb', db_ip = df_parms['db-host'],
db_user = df_parms['db-user'],
db_pass = df_parms['db-password'])
self.save(file=os.path.join(self.default_config_path, "HUD_config.xml"))
def find_config(self):
"""Looks in cwd and in self.default_config_path for a config file."""
if os.path.exists('HUD_config.xml'): # there is a HUD_config in the cwd
file = 'HUD_config.xml' # so we use it
else: # no HUD_config in the cwd, look where it should be in the first place
config_path = os.path.join(self.default_config_path, 'HUD_config.xml')
if os.path.exists(config_path):
file = config_path
else:
file = None
return file
def get_default_config_path(self):
"""Returns the path where the fpdb config file _should_ be stored."""
if os.name == 'posix':
config_path = os.path.join(os.path.expanduser("~"), '.fpdb')
elif os.name == 'nt':
config_path = os.path.join(os.environ["APPDATA"], 'fpdb')
else: config_path = None
return config_path
def find_default_conf(self):
if os.name == 'posix':
config_path = os.path.join(os.path.expanduser("~"), '.fpdb', 'default.conf')
elif os.name == 'nt':
config_path = os.path.join(os.environ["APPDATA"], 'fpdb', 'default.conf')
else: config_path = False
if config_path and os.path.exists(config_path):
file = config_path
else:
file = None
return file
def read_default_conf(self, file):
parms = {}
fh = open(file, "r")
for line in fh:
line = string.strip(line)
(key, value) = line.split('=')
parms[key] = value
fh.close
return parms
def find_example_config(self):
if os.path.exists('HUD_config.xml.example'): # there is a HUD_config in the cwd
file = 'HUD_config.xml.example' # so we use it
print "No HUD_config.xml found, using HUD_config.xml.example.\n", \
"A HUD_config.xml will be written. You will probably have to edit it."
sys.stderr.write("No HUD_config.xml found, using HUD_config.xml.example.\n" + \
"A HUD_config.xml will be written. You will probably have to edit it.")
else:
file = None
return file
def get_site_node(self, site):
for site_node in self.doc.getElementsByTagName("site"):
if site_node.getAttribute("site_name") == site:
return site_node
def get_db_node(self, db_name):
for db_node in self.doc.getElementsByTagName("database"):
if db_node.getAttribute("db_name") == db_name:
return db_node
return None
def get_layout_node(self, site_node, layout):
for layout_node in site_node.getElementsByTagName("layout"):
if layout_node.getAttribute("max") == None:
return None
if int( layout_node.getAttribute("max") ) == int( layout ):
return layout_node
def get_location_node(self, layout_node, seat):
for location_node in layout_node.getElementsByTagName("location"):
if int( location_node.getAttribute("seat") ) == int( seat ):
return location_node
def save(self, file = None):
if not file == None:
f = open(file, 'w')
self.doc.writexml(f)
f.close()
else:
shutil.move(self.file, self.file+".backup")
f = open(self.file, 'w')
self.doc.writexml(f)
f.close
def edit_layout(self, site_name, max, width = None, height = None,
fav_seat = None, locations = None):
print "max = ", max
site_node = self.get_site_node(site_name)
layout_node = self.get_layout_node(site_node, max)
if layout_node == None: return
for i in range(1, max + 1):
location_node = self.get_location_node(layout_node, i)
location_node.setAttribute("x", str( locations[i-1][0] ))
location_node.setAttribute("y", str( locations[i-1][1] ))
self.supported_sites[site_name].layout[max].location[i] = ( locations[i-1][0], locations[i-1][1] )
def get_db_parameters(self, name = None):
if name == None: name = 'fpdb'
db = {}
try:
db['db-databaseName'] = name
db['db-host'] = self.supported_databases[name].db_ip
db['db-user'] = self.supported_databases[name].db_user
db['db-password'] = self.supported_databases[name].db_pass
db['db-server'] = self.supported_databases[name].db_server
if string.lower(self.supported_databases[name].db_server) == 'mysql':
db['db-backend'] = 2
elif string.lower(self.supported_databases[name].db_server) == 'postgresql':
db['db-backend'] = 3
else: db['db-backend'] = None # this is big trouble
except:
pass
return db
def set_db_parameters(self, db_name = 'fpdb', db_ip = None, db_user = None,
db_pass = None, db_server = None, db_type = None):
db_node = self.get_db_node(db_name)
if not db_node == None:
if not db_ip == None: db_node.setAttribute("db_ip", db_ip)
if not db_user == None: db_node.setAttribute("db_user", db_user)
if not db_pass == None: db_node.setAttribute("db_pass", db_pass)
if not db_server == None: db_node.setAttribute("db_server", db_server)
if not db_type == None: db_node.setAttribute("db_type", db_type)
if self.supported_databases.has_key(db_name):
if not db_ip == None: self.supported_databases[db_name].dp_ip = db_ip
if not db_user == None: self.supported_databases[db_name].dp_user = db_user
if not db_pass == None: self.supported_databases[db_name].dp_pass = db_pass
if not db_server == None: self.supported_databases[db_name].dp_server = db_server
if not db_type == None: self.supported_databases[db_name].dp_type = db_type
return
def get_tv_parameters(self):
tv = {}
try:
tv['combinedStealFold'] = self.tv.combinedStealFold
tv['combined2B3B'] = self.tv.combined2B3B
tv['combinedPostflop'] = self.tv.combinedPostflop
except: # Default tv parameters
tv['combinedStealFold'] = True
tv['combined2B3B'] = True
tv['combinedPostflop'] = True
return tv
def get_import_parameters(self):
imp = {}
try:
imp['imp-callFpdbHud'] = self.imp.callFpdbHud
imp['hud-defaultInterval'] = int(self.imp.interval)
except: # Default import parameters
imp['imp-callFpdbHud'] = True
imp['hud-defaultInterval'] = 10
return imp
def get_default_paths(self, site = "PokerStars"):
paths = {}
try:
paths['hud-defaultPath'] = os.path.expanduser(self.supported_sites[site].HH_path)
paths['bulkImport-defaultPath'] = os.path.expanduser(self.supported_sites[site].HH_path)
except:
paths['hud-defaultPath'] = "default"
paths['bulkImport-defaultPath'] = "default"
return paths
def get_default_colors(self, site = "PokerStars"):
colors = {}
if self.supported_sites[site].hudopacity == "":
colors['hudopacity'] = 0.90
else:
colors['hudopacity'] = float(self.supported_sites[site].hudopacity)
if self.supported_sites[site].hudbgcolor == "":
colors['hudbgcolor'] = "#FFFFFF"
else:
colors['hudbgcolor'] = self.supported_sites[site].hudbgcolor
if self.supported_sites[site].hudfgcolor == "":
colors['hudfgcolor'] = "#000000"
else:
colors['hudfgcolor'] = self.supported_sites[site].hudfgcolor
return colors
def get_locations(self, site = "PokerStars", max = "8"):
try:
locations = self.supported_sites[site].layout[max].location
except:
locations = ( ( 0, 0), (684, 61), (689, 239), (692, 346),
(586, 393), (421, 440), (267, 440), ( 0, 361),
( 0, 280), (121, 280), ( 46, 30) )
return locations
def get_site_parameters(self, site):
"""Returns a dict of the site parameters for the specified site"""
if not self.supported_sites.has_key(site):
return None
parms = {}
parms["converter"] = self.supported_sites[site].converter
parms["decoder"] = self.supported_sites[site].decoder
parms["hudbgcolor"] = self.supported_sites[site].hudbgcolor
parms["hudfgcolor"] = self.supported_sites[site].hudfgcolor
parms["hudopacity"] = self.supported_sites[site].hudopacity
parms["screen_name"] = self.supported_sites[site].screen_name
parms["site_path"] = self.supported_sites[site].site_path
parms["table_finder"] = self.supported_sites[site].table_finder
parms["HH_path"] = self.supported_sites[site].HH_path
return parms
def set_site_parameters(self, site_name, converter = None, decoder = None,
hudbgcolor = None, hudfgcolor = None,
hudopacity = None, screen_name = None,
site_path = None, table_finder = None,
HH_path = None):
"""Sets the specified site parameters for the specified site."""
site_node = self.get_site_node(site_name)
if not db_node == None:
if not converter == None: site_node.setAttribute("converter", converter)
if not decoder == None: site_node.setAttribute("decoder", decoder)
if not hudbgcolor == None: site_node.setAttribute("hudbgcolor", hudbgcolor)
if not hudfgcolor == None: site_node.setAttribute("hudfgcolor", hudfgcolor)
if not hudopacity == None: site_node.setAttribute("hudopacity", hudopacity)
if not screen_name == None: site_node.setAttribute("screen_name", screen_name)
if not site_path == None: site_node.setAttribute("site_path", site_path)
if not table_finder == None: site_node.setAttribute("table_finder", table_finder)
if not HH_path == None: site_node.setAttribute("HH_path", HH_path)
if self.supported_databases.has_key(db_name):
if not converter == None: self.supported_sites[site].converter = converter
if not decoder == None: self.supported_sites[site].decoder = decoder
if not hudbgcolor == None: self.supported_sites[site].hudbgcolor = hudbgcolor
if not hudfgcolor == None: self.supported_sites[site].hudfgcolor = hudfgcolor
if not hudopacity == None: self.supported_sites[site].hudopacity = hudopacity
if not screen_name == None: self.supported_sites[site].screen_name = screen_name
if not site_path == None: self.supported_sites[site].site_path = site_path
if not table_finder == None: self.supported_sites[site].table_finder = table_finder
if not HH_path == None: self.supported_sites[site].HH_path = HH_path
return
if __name__== "__main__":
c = Config()
print "\n----------- SUPPORTED SITES -----------"
for s in c.supported_sites.keys():
print c.supported_sites[s]
print "----------- END SUPPORTED SITES -----------"
print "\n----------- SUPPORTED GAMES -----------"
for game in c.supported_games.keys():
print c.supported_games[game]
print "----------- END SUPPORTED GAMES -----------"
print "\n----------- SUPPORTED DATABASES -----------"
for db in c.supported_databases.keys():
print c.supported_databases[db]
print "----------- END SUPPORTED DATABASES -----------"
print "\n----------- MUCKED WINDOW FORMATS -----------"
for w in c.mucked_windows.keys():
print c.mucked_windows[w]
print "----------- END MUCKED WINDOW FORMATS -----------"
print "\n----------- POPUP WINDOW FORMATS -----------"
for w in c.popup_windows.keys():
print c.popup_windows[w]
print "----------- END MUCKED WINDOW FORMATS -----------"
print "\n----------- IMPORT -----------"
# print c.imp
print "----------- END IMPORT -----------"
print "\n----------- TABLE VIEW -----------"
# print c.tv
print "----------- END TABLE VIEW -----------"
c.edit_layout("PokerStars", 6, locations=( (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6) ))
c.save(file="testout.xml")
print "db = ", c.get_db_parameters()
# print "tv = ", c.get_tv_parameters()
# print "imp = ", c.get_import_parameters()
print "paths = ", c.get_default_paths("PokerStars")
print "colors = ", c.get_default_colors("PokerStars")
print "locs = ", c.get_locations("PokerStars", 8)
for site in c.supported_sites.keys():
print "site = ", site,
print c.get_site_parameters(site)

208
pyfpdb/Database.py Normal file
View File

@ -0,0 +1,208 @@
#!/usr/bin/env python
"""Database.py
Create and manage the database objects.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# postmaster -D /var/lib/pgsql/data
# Standard Library modules
import sys
import traceback
# pyGTK modules
# FreePokerTools modules
import Configuration
import SQL
class Database:
def __init__(self, c, db_name, game):
if c.supported_databases[db_name].db_server == 'postgresql':
# psycopg2 database module for posgres via DB-API
import psycopg2
try:
self.connection = psycopg2.connect(host = c.supported_databases[db_name].db_ip,
user = c.supported_databases[db_name].db_user,
password = c.supported_databases[db_name].db_pass,
database = c.supported_databases[db_name].db_name)
except:
print "Error opening database connection %s. See error log file." % (file)
traceback.print_exc(file=sys.stderr)
print "press enter to continue"
sys.stdin.readline()
sys.exit()
elif c.supported_databases[db_name].db_server == 'mysql':
# mysql bindings
import MySQLdb
try:
self.connection = MySQLdb.connect(host = c.supported_databases[db_name].db_ip,
user = c.supported_databases[db_name].db_user,
passwd = c.supported_databases[db_name].db_pass,
db = c.supported_databases[db_name].db_name)
cur_iso = self.connection.cursor()
cur_iso.execute('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED')
cur_iso.close()
except:
print "Error opening database connection %s. See error log file." % (file)
traceback.print_exc(file=sys.stderr)
print "press enter to continue"
sys.stdin.readline()
sys.exit()
else:
print "Database = %s not recognized." % (c.supported_databases[db_name].db_server)
sys.stderr.write("Database not recognized, exiting.\n")
print "press enter to continue"
sys.exit()
self.type = c.supported_databases[db_name].db_type
self.sql = SQL.Sql(game = game, type = self.type)
def close_connection(self):
self.connection.close()
def get_table_name(self, hand_id):
c = self.connection.cursor()
c.execute(self.sql.query['get_table_name'], (hand_id, ))
row = c.fetchone()
return row
def get_last_hand(self):
c = self.connection.cursor()
c.execute(self.sql.query['get_last_hand'])
row = c.fetchone()
return row[0]
def get_xml(self, hand_id):
c = self.connection.cursor()
c.execute(self.sql.query['get_xml'], (hand_id))
row = c.fetchone()
return row[0]
def get_recent_hands(self, last_hand):
c = self.connection.cursor()
c.execute(self.sql.query['get_recent_hands'], {'last_hand': last_hand})
return c.fetchall()
def get_hand_info(self, new_hand_id):
c = self.connection.cursor()
c.execute(self.sql.query['get_hand_info'], new_hand_id)
return c.fetchall()
def get_actual_seat(self, hand_id, name):
c = self.connection.cursor()
c.execute(self.sql.query['get_actual_seat'], (hand_id, name))
row = c.fetchone()
return row[0]
# def get_cards(self, hand):
# this version is for the PTrackSv2 db
# c = self.connection.cursor()
# c.execute(self.sql.query['get_cards'], hand)
# colnames = [desc[0] for desc in c.description]
# cards = {}
# for row in c.fetchall():
# s_dict = {}
# for name, val in zip(colnames, row):
# s_dict[name] = val
# cards[s_dict['seat_number']] = s_dict
# return (cards)
def get_cards(self, hand):
# this version is for the fpdb db
c = self.connection.cursor()
c.execute(self.sql.query['get_cards'], hand)
colnames = [desc[0] for desc in c.description]
cards = {}
for row in c.fetchall():
s_dict = {}
for name, val in zip(colnames, row):
s_dict[name] = val
cards[s_dict['seat_number']] = s_dict
return (cards)
def get_stats_from_hand(self, hand, player_id = False):
c = self.connection.cursor()
if not player_id: player_id = "%"
# get the players in the hand and their seats
# c.execute(self.sql.query['get_players_from_hand'], (hand, player_id))
c.execute(self.sql.query['get_players_from_hand'], (hand, ))
names = {}
seats = {}
for row in c.fetchall():
names[row[0]] = row[2]
seats[row[0]] = row[1]
# now get the stats
# c.execute(self.sql.query['get_stats_from_hand'], (hand, hand, player_id))
c.execute(self.sql.query['get_stats_from_hand'], (hand, hand))
colnames = [desc[0] for desc in c.description]
stat_dict = {}
for row in c.fetchall():
t_dict = {}
for name, val in zip(colnames, row):
t_dict[name] = val
# print t_dict
t_dict['screen_name'] = names[t_dict['player_id']]
t_dict['seat'] = seats[t_dict['player_id']]
stat_dict[t_dict['player_id']] = t_dict
return stat_dict
def get_player_id(self, config, site, player_name):
print "site = %s, player name = %s" % (site, player_name)
c = self.connection.cursor()
c.execute(self.sql.query['get_player_id'], {'player': player_name, 'site': site})
row = c.fetchone()
return row[0]
if __name__=="__main__":
c = Configuration.Config()
db_connection = Database(c, 'fpdb', 'holdem') # mysql fpdb holdem
# db_connection = Database(c, 'fpdb-p', 'test') # mysql fpdb holdem
# db_connection = Database(c, 'PTrackSv2', 'razz') # mysql razz
# db_connection = Database(c, 'ptracks', 'razz') # postgres
print "database connection object = ", db_connection.connection
print "database type = ", db_connection.type
h = db_connection.get_last_hand()
print "last hand = ", h
hero = db_connection.get_player_id(c, 'PokerStars', 'nutOmatic')
print "nutOmatic is id_player = %d" % hero
stat_dict = db_connection.get_stats_from_hand(h)
for p in stat_dict.keys():
print p, " ", stat_dict[p]
print "nutOmatics stats:"
stat_dict = db_connection.get_stats_from_hand(h, hero)
for p in stat_dict.keys():
print p, " ", stat_dict[p]
db_connection.close_connection
print "press enter to continue"
sys.stdin.readline()

645
pyfpdb/FpdbSQLQueries.py Normal file
View File

@ -0,0 +1,645 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
############################################################################
#
# File for DB queries used in fpdb
#
import sys
import os
class FpdbSQLQueries:
def __init__(self, db):
self.query = {}
self.dbname = db
#Boilerplate code.
# if(self.dbname == 'MySQL InnoDB'):
# self.query[''] = """ """
# elif(self.dbname == 'PostgreSQL'):
# elif(self.dbname == 'SQLite'):
################################
# List tables
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['list_tables'] = """SHOW TABLES"""
elif(self.dbname == 'PostgreSQL'):
self.query['list_tables'] = """SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"""
elif(self.dbname == 'SQLite'):
self.query['list_tables'] = """ """
##################################################################
# Drop Tables - MySQL, PostgreSQL and SQLite all share same syntax
##################################################################
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL') or (self.dbname == 'SQLite'):
self.query['drop_table'] = """DROP TABLE IF EXISTS """
################################
# Create Tables
################################
################################
# Create Settings
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createSettingsTable'] = """CREATE TABLE Settings (
version SMALLINT NOT NULL)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createSettingsTable'] = """CREATE TABLE Settings (version SMALLINT)"""
elif(self.dbname == 'SQLite'):
#Probably doesn't work.
self.query['createSettingsTable'] = """ """
################################
# Create Sites
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createSitesTable'] = """CREATE TABLE Sites (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
name varchar(32) NOT NULL,
currency char(3) NOT NULL)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createSitesTable'] = """CREATE TABLE Sites (
id SERIAL UNIQUE, PRIMARY KEY (id),
name varchar(32),
currency char(3))"""
elif(self.dbname == 'SQLite'):
self.query['createSitesTable'] = """ """
################################
# Create Gametypes
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createGametypesTable'] = """CREATE TABLE Gametypes (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
type char(4) NOT NULL,
base char(4) NOT NULL,
category varchar(9) NOT NULL,
limitType char(2) NOT NULL,
hiLo char(1) NOT NULL,
smallBlind int,
bigBlind int,
smallBet int NOT NULL,
bigBet int NOT NULL)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createGametypesTable'] = """CREATE TABLE Gametypes (
id SERIAL UNIQUE, PRIMARY KEY (id),
siteId INTEGER, FOREIGN KEY (siteId) REFERENCES Sites(id),
type char(4),
base char(4),
category varchar(9),
limitType char(2),
hiLo char(1),
smallBlind int,
bigBlind int,
smallBet int,
bigBet int)"""
elif(self.dbname == 'SQLite'):
self.query['createGametypesTable'] = """ """
################################
# Create Players
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createPlayersTable'] = """CREATE TABLE Players (
id INT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
name VARCHAR(32) CHARACTER SET utf8 NOT NULL,
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
comment text,
commentTs DATETIME)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createPlayersTable'] = """CREATE TABLE Players (
id SERIAL UNIQUE, PRIMARY KEY (id),
name VARCHAR(32),
siteId INTEGER, FOREIGN KEY (siteId) REFERENCES Sites(id),
comment text,
commentTs timestamp without time zone)"""
elif(self.dbname == 'SQLite'):
self.query['createPlayersTable'] = """ """
################################
# Create Autorates
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createAutoratesTable'] = """CREATE TABLE Autorates (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
description varchar(50) NOT NULL,
shortDesc char(8) NOT NULL,
ratingTime DATETIME NOT NULL,
handCount int NOT NULL)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createAutoratesTable'] = """CREATE TABLE Autorates (
id BIGSERIAL UNIQUE, PRIMARY KEY (id),
playerId INT, FOREIGN KEY (playerId) REFERENCES Players(id),
gametypeId INT, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
description varchar(50),
shortDesc char(8),
ratingTime timestamp without time zone,
handCount int)"""
elif(self.dbname == 'SQLite'):
self.query['createAutoratesTable'] = """ """
################################
# Create Hands
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createHandsTable'] = """CREATE TABLE Hands (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
tableName VARCHAR(20) NOT NULL,
siteHandNo BIGINT NOT NULL,
gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
handStart DATETIME NOT NULL,
importTime DATETIME NOT NULL,
seats SMALLINT NOT NULL,
maxSeats SMALLINT NOT NULL,
comment TEXT,
commentTs DATETIME)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createHandsTable'] = """CREATE TABLE Hands (
id BIGSERIAL UNIQUE, PRIMARY KEY (id),
tableName VARCHAR(20),
siteHandNo BIGINT,
gametypeId INT, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
handStart timestamp without time zone,
importTime timestamp without time zone,
seats SMALLINT,
maxSeats SMALLINT,
comment TEXT,
commentTs timestamp without time zone)"""
elif(self.dbname == 'SQLite'):
self.query['createHandsTable'] = """ """
################################
# Create Gametypes
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createBoardCardsTable'] = """CREATE TABLE BoardCards (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
handId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handId) REFERENCES Hands(id),
card1Value smallint NOT NULL,
card1Suit char(1) NOT NULL,
card2Value smallint NOT NULL,
card2Suit char(1) NOT NULL,
card3Value smallint NOT NULL,
card3Suit char(1) NOT NULL,
card4Value smallint NOT NULL,
card4Suit char(1) NOT NULL,
card5Value smallint NOT NULL,
card5Suit char(1) NOT NULL)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createBoardCardsTable'] = """CREATE TABLE BoardCards (
id BIGSERIAL UNIQUE, PRIMARY KEY (id),
handId BIGINT, FOREIGN KEY (handId) REFERENCES Hands(id),
card1Value smallint,
card1Suit char(1),
card2Value smallint,
card2Suit char(1),
card3Value smallint,
card3Suit char(1),
card4Value smallint,
card4Suit char(1),
card5Value smallint,
card5Suit char(1))"""
elif(self.dbname == 'SQLite'):
self.query['createBoardCardsTable'] = """ """
################################
# Create TourneyTypes
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
buyin INT NOT NULL,
fee INT NOT NULL,
knockout INT NOT NULL,
rebuyOrAddon BOOLEAN NOT NULL)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
id SERIAL, PRIMARY KEY (id),
siteId INT, FOREIGN KEY (siteId) REFERENCES Sites(id),
buyin INT,
fee INT,
knockout INT,
rebuyOrAddon BOOLEAN)"""
elif(self.dbname == 'SQLite'):
self.query['createTourneyTypesTable'] = """ """
################################
# Create Tourneys
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
id INT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
siteTourneyNo BIGINT NOT NULL,
entries INT NOT NULL,
prizepool INT NOT NULL,
startTime DATETIME NOT NULL,
comment TEXT,
commentTs DATETIME)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
id SERIAL UNIQUE, PRIMARY KEY (id),
tourneyTypeId INT, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
siteTourneyNo BIGINT,
entries INT,
prizepool INT,
startTime timestamp without time zone,
comment TEXT,
commentTs timestamp without time zone)"""
elif(self.dbname == 'SQLite'):
self.query['createTourneysTable'] = """ """
################################
# Create HandsPlayers
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createHandsPlayersTable'] = """CREATE TABLE HandsPlayers (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
handId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handId) REFERENCES Hands(id),
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
startCash INT NOT NULL,
position CHAR(1),
seatNo SMALLINT NOT NULL,
ante INT,
card1Value smallint NOT NULL,
card1Suit char(1) NOT NULL,
card2Value smallint NOT NULL,
card2Suit char(1) NOT NULL,
card3Value smallint,
card3Suit char(1),
card4Value smallint,
card4Suit char(1),
card5Value smallint,
card5Suit char(1),
card6Value smallint,
card6Suit char(1),
card7Value smallint,
card7Suit char(1),
winnings int NOT NULL,
rake int NOT NULL,
comment text,
commentTs DATETIME,
tourneysPlayersId BIGINT UNSIGNED, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createHandsPlayersTable'] = """CREATE TABLE HandsPlayers (
id BIGSERIAL UNIQUE, PRIMARY KEY (id),
handId BIGINT, FOREIGN KEY (handId) REFERENCES Hands(id),
playerId INT, FOREIGN KEY (playerId) REFERENCES Players(id),
startCash INT,
position CHAR(1),
seatNo SMALLINT,
ante INT,
card1Value smallint,
card1Suit char(1),
card2Value smallint,
card2Suit char(1),
card3Value smallint,
card3Suit char(1),
card4Value smallint,
card4Suit char(1),
card5Value smallint,
card5Suit char(1),
card6Value smallint,
card6Suit char(1),
card7Value smallint,
card7Suit char(1),
winnings int,
rake int,
comment text,
commentTs timestamp without time zone,
tourneysPlayersId BIGINT, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))"""
elif(self.dbname == 'SQLite'):
self.query['createHandsPlayersTable'] = """ """
################################
# Create TourneysPlayers
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createTourneysPlayersTable'] = """CREATE TABLE TourneysPlayers (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
tourneyId INT UNSIGNED NOT NULL, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
payinAmount INT NOT NULL,
rank INT NOT NULL,
winnings INT NOT NULL,
comment TEXT,
commentTs DATETIME)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createTourneysPlayersTable'] = """CREATE TABLE TourneysPlayers (
id BIGSERIAL UNIQUE, PRIMARY KEY (id),
tourneyId INT, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
playerId INT, FOREIGN KEY (playerId) REFERENCES Players(id),
payinAmount INT,
rank INT,
winnings INT,
comment TEXT,
commentTs timestamp without time zone)"""
elif(self.dbname == 'SQLite'):
self.query['createTourneysPlayersTable'] = """ """
################################
# Create HandsActions
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createHandsActionsTable'] = """CREATE TABLE HandsActions (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
handPlayerId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
street SMALLINT NOT NULL,
actionNo SMALLINT NOT NULL,
action CHAR(5) NOT NULL,
allIn BOOLEAN NOT NULL,
amount INT NOT NULL,
comment TEXT,
commentTs DATETIME)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createHandsActionsTable'] = """CREATE TABLE HandsActions (
id BIGSERIAL UNIQUE, PRIMARY KEY (id),
handPlayerId BIGINT, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
street SMALLINT,
actionNo SMALLINT,
action CHAR(5),
allIn BOOLEAN,
amount INT,
comment TEXT,
commentTs timestamp without time zone)"""
elif(self.dbname == 'SQLite'):
self.query['createHandsActionsTable'] = """ """
################################
# Create HudCache
################################
if(self.dbname == 'MySQL InnoDB'):
self.query['createHudCacheTable'] = """CREATE TABLE HudCache (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
activeSeats SMALLINT NOT NULL,
position CHAR(1),
tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
HDs INT NOT NULL,
street0VPI INT NOT NULL,
street0Aggr INT NOT NULL,
street0_3B4BChance INT NOT NULL,
street0_3B4BDone INT NOT NULL,
street1Seen INT NOT NULL,
street2Seen INT NOT NULL,
street3Seen INT NOT NULL,
street4Seen INT NOT NULL,
sawShowdown INT NOT NULL,
street1Aggr INT NOT NULL,
street2Aggr INT NOT NULL,
street3Aggr INT NOT NULL,
street4Aggr INT NOT NULL,
otherRaisedStreet1 INT NOT NULL,
otherRaisedStreet2 INT NOT NULL,
otherRaisedStreet3 INT NOT NULL,
otherRaisedStreet4 INT NOT NULL,
foldToOtherRaisedStreet1 INT NOT NULL,
foldToOtherRaisedStreet2 INT NOT NULL,
foldToOtherRaisedStreet3 INT NOT NULL,
foldToOtherRaisedStreet4 INT NOT NULL,
wonWhenSeenStreet1 FLOAT NOT NULL,
wonAtSD FLOAT NOT NULL,
stealAttemptChance INT NOT NULL,
stealAttempted INT NOT NULL,
foldBbToStealChance INT NOT NULL,
foldedBbToSteal INT NOT NULL,
foldSbToStealChance INT NOT NULL,
foldedSbToSteal INT NOT NULL,
street1CBChance INT NOT NULL,
street1CBDone INT NOT NULL,
street2CBChance INT NOT NULL,
street2CBDone INT NOT NULL,
street3CBChance INT NOT NULL,
street3CBDone INT NOT NULL,
street4CBChance INT NOT NULL,
street4CBDone INT NOT NULL,
foldToStreet1CBChance INT NOT NULL,
foldToStreet1CBDone INT NOT NULL,
foldToStreet2CBChance INT NOT NULL,
foldToStreet2CBDone INT NOT NULL,
foldToStreet3CBChance INT NOT NULL,
foldToStreet3CBDone INT NOT NULL,
foldToStreet4CBChance INT NOT NULL,
foldToStreet4CBDone INT NOT NULL,
totalProfit INT NOT NULL,
street1CheckCallRaiseChance INT NOT NULL,
street1CheckCallRaiseDone INT NOT NULL,
street2CheckCallRaiseChance INT NOT NULL,
street2CheckCallRaiseDone INT NOT NULL,
street3CheckCallRaiseChance INT NOT NULL,
street3CheckCallRaiseDone INT NOT NULL,
street4CheckCallRaiseChance INT NOT NULL,
street4CheckCallRaiseDone INT NOT NULL)
ENGINE=INNODB"""
elif(self.dbname == 'PostgreSQL'):
self.query['createHudCacheTable'] = """CREATE TABLE HudCache (
id BIGSERIAL UNIQUE, PRIMARY KEY (id),
gametypeId INT, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
playerId INT, FOREIGN KEY (playerId) REFERENCES Players(id),
activeSeats SMALLINT,
position CHAR(1),
tourneyTypeId INT, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
HDs INT,
street0VPI INT,
street0Aggr INT,
street0_3B4BChance INT,
street0_3B4BDone INT,
street1Seen INT,
street2Seen INT,
street3Seen INT,
street4Seen INT,
sawShowdown INT,
street1Aggr INT,
street2Aggr INT,
street3Aggr INT,
street4Aggr INT,
otherRaisedStreet1 INT,
otherRaisedStreet2 INT,
otherRaisedStreet3 INT,
otherRaisedStreet4 INT,
foldToOtherRaisedStreet1 INT,
foldToOtherRaisedStreet2 INT,
foldToOtherRaisedStreet3 INT,
foldToOtherRaisedStreet4 INT,
wonWhenSeenStreet1 FLOAT,
wonAtSD FLOAT,
stealAttemptChance INT,
stealAttempted INT,
foldBbToStealChance INT,
foldedBbToSteal INT,
foldSbToStealChance INT,
foldedSbToSteal INT,
street1CBChance INT,
street1CBDone INT,
street2CBChance INT,
street2CBDone INT,
street3CBChance INT,
street3CBDone INT,
street4CBChance INT,
street4CBDone INT,
foldToStreet1CBChance INT,
foldToStreet1CBDone INT,
foldToStreet2CBChance INT,
foldToStreet2CBDone INT,
foldToStreet3CBChance INT,
foldToStreet3CBDone INT,
foldToStreet4CBChance INT,
foldToStreet4CBDone INT,
totalProfit INT,
street1CheckCallRaiseChance INT,
street1CheckCallRaiseDone INT,
street2CheckCallRaiseChance INT,
street2CheckCallRaiseDone INT,
street3CheckCallRaiseChance INT,
street3CheckCallRaiseDone INT,
street4CheckCallRaiseChance INT,
street4CheckCallRaiseDone INT)"""
elif(self.dbname == 'SQLite'):
self.query['createHudCacheTable'] = """ """
################################
# Queries used in GuiGraphViewer
################################
# Returns all cash game handIds and the money won(winnings is the final pot)
# by the playerId for a single site.
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL'):
self.query['getRingWinningsAllGamesPlayerIdSite'] = """SELECT handId, winnings FROM HandsPlayers
INNER JOIN Players ON HandsPlayers.playerId = Players.id
INNER JOIN Hands ON Hands.id = HandsPlayers.handId
WHERE Players.name = %s AND Players.siteId = %s AND (tourneysPlayersId IS NULL)
ORDER BY handStart"""
elif(self.dbname == 'SQLite'):
#Probably doesn't work.
self.query['getRingWinningsAllGamesPlayerIdSite'] = """SELECT handId, winnings FROM HandsPlayers
INNER JOIN Players ON HandsPlayers.playerId = Players.id
INNER JOIN Hands ON Hands.id = HandsPlayers.handId
WHERE Players.name = %s AND Players.siteId = %s AND (tourneysPlayersId IS NULL)
ORDER BY handStart"""
# Returns the profit for a given ring game handId, Total pot - money invested by playerId
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL'):
self.query['getRingProfitFromHandId'] = """SELECT SUM(amount) FROM HandsActions
INNER JOIN HandsPlayers ON HandsActions.handPlayerId = HandsPlayers.id
INNER JOIN Players ON HandsPlayers.playerId = Players.id
WHERE Players.name = %s AND HandsPlayers.handId = %s
AND Players.siteId = %s AND (tourneysPlayersId IS NULL)"""
elif(self.dbname == 'SQLite'):
#Probably doesn't work.
self.query['getRingProfitFromHandId'] = """SELECT SUM(amount) FROM HandsActions
INNER JOIN HandsPlayers ON HandsActions.handPlayerId = HandsPlayers.id
INNER JOIN Players ON HandsPlayers.playerId = Players.id
WHERE Players.name = %s AND HandsPlayers.handId = %s
AND Players.siteId = %s AND (tourneysPlayersId IS NULL)"""
if __name__== "__main__":
from optparse import OptionParser
print "FpdbSQLQueries starting from CLI"
#process CLI parameters
usage = "usage: %prog [options]"
parser = OptionParser()
parser.add_option("-t", "--type", dest="dbtype", help="Available 'MySQL InnoDB', 'PostgreSQL', 'SQLite'(default: MySQL InnoDB)", default="MySQL InnoDB")
parser.add_option("-s", "--show", action="store_true", dest="showsql", help="Show full SQL output")
parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
(options, args) = parser.parse_args()
if options.verbose:
print """No additional output available in this file"""
obj = FpdbSQLQueries(options.dbtype)
print "Available Queries for '" + options.dbtype + "':"
for key in obj.query:
print " " + key
if options.showsql:
print obj.query[key]

216
pyfpdb/GuiAutoImport.py Normal file
View File

@ -0,0 +1,216 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import threading
import subprocess
import pygtk
pygtk.require('2.0')
import gtk
import gobject
import os
import time
import fpdb_import
class GuiAutoImport (threading.Thread):
def starsBrowseClicked(self, widget, data):
"""runs when user clicks browse on auto import tab"""
#print "start of GuiAutoImport.starsBrowseClicked"
current_path=self.starsDirPath.get_text()
dia_chooser = gtk.FileChooserDialog(title="Please choose the path that you want to auto import",
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
#dia_chooser.set_current_folder(pathname)
dia_chooser.set_filename(current_path)
#dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
response = dia_chooser.run()
if response == gtk.RESPONSE_OK:
#print dia_chooser.get_filename(), 'selected'
self.starsDirPath.set_text(dia_chooser.get_filename())
elif response == gtk.RESPONSE_CANCEL:
print 'Closed, no files selected'
dia_chooser.destroy()
#end def GuiAutoImport.starsBrowseClicked
def tiltBrowseClicked(self, widget, data):
"""runs when user clicks browse on auto import tab"""
#print "start of GuiAutoImport.tiltBrowseClicked"
current_path=self.tiltDirPath.get_text()
dia_chooser = gtk.FileChooserDialog(title="Please choose the path that you want to auto import",
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
#dia_chooser.set_current_folder(pathname)
dia_chooser.set_filename(current_path)
#dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
response = dia_chooser.run()
if response == gtk.RESPONSE_OK:
#print dia_chooser.get_filename(), 'selected'
self.tiltDirPath.set_text(dia_chooser.get_filename())
elif response == gtk.RESPONSE_CANCEL:
print 'Closed, no files selected'
dia_chooser.destroy()
#end def GuiAutoImport.tiltBrowseClicked
def do_import(self):
"""Callback for timer to do an import iteration."""
self.importer.runUpdated()
print "GuiAutoImport.import_dir done"
return True
def startClicked(self, widget, data):
"""runs when user clicks start on auto import tab"""
# Check to see if we have an open file handle to the HUD and open one if we do not.
# bufsize = 1 means unbuffered
# We need to close this file handle sometime.
# TODO: Allow for importing from multiple dirs - REB 29AUG2008
# As presently written this function does nothing if there is already a pipe open.
# That is not correct. It should open another dir for importing while piping the
# results to the same pipe. This means that self.path should be a a list of dirs
# to watch.
try: #uhhh, I don't this this is the best way to check for the existence of an attr
getattr(self, "pipe_to_hud")
except AttributeError:
if os.name == 'nt':
command = "python HUD_main.py" + " %s" % (self.database)
bs = 0 # windows is not happy with line buffing here
self.pipe_to_hud = subprocess.Popen(command, bufsize = bs, stdin = subprocess.PIPE,
universal_newlines=True)
else:
cwd = os.getcwd()
command = os.path.join(cwd, 'HUD_main.py')
bs = 1
self.pipe_to_hud = subprocess.Popen((command, self.database), bufsize = bs, stdin = subprocess.PIPE,
universal_newlines=True)
# self.pipe_to_hud = subprocess.Popen((command, self.database), bufsize = bs, stdin = subprocess.PIPE,
# universal_newlines=True)
# command = command + " %s" % (self.database)
# print "command = ", command
# self.pipe_to_hud = os.popen(command, 'w')
self.starspath=self.starsDirPath.get_text()
self.tiltpath=self.tiltDirPath.get_text()
# Add directory to importer object.
self.importer.addImportDirectory(self.starspath, True, "PokerStars", "passthrough")
self.importer.addImportDirectory(self.tiltpath, True, "FullTilt", "passthrough")
self.do_import()
interval=int(self.intervalEntry.get_text())
gobject.timeout_add(interval*1000, self.do_import)
#end def GuiAutoImport.startClicked
def get_vbox(self):
"""returns the vbox of this thread"""
return self.mainVBox
#end def get_vbox
def __init__(self, settings, config, debug=True):
"""Constructor for GuiAutoImport"""
self.settings=settings
self.config=config
self.importer = fpdb_import.Importer(self,self.settings)
self.importer.setCallHud(True)
self.importer.setMinPrint(30)
self.importer.setQuiet(False)
self.importer.setFailOnError(False)
self.importer.setHandCount(0)
# self.importer.setWatchTime()
self.server=settings['db-host']
self.user=settings['db-user']
self.password=settings['db-password']
self.database=settings['db-databaseName']
self.mainVBox=gtk.VBox(False,1)
self.mainVBox.show()
self.settingsHBox = gtk.HBox(False, 0)
self.mainVBox.pack_start(self.settingsHBox, False, True, 0)
self.settingsHBox.show()
self.intervalLabel = gtk.Label("Interval (ie. break) between imports in seconds:")
self.settingsHBox.pack_start(self.intervalLabel)
self.intervalLabel.show()
self.intervalEntry=gtk.Entry()
self.intervalEntry.set_text(str(self.settings['hud-defaultInterval']))
self.settingsHBox.pack_start(self.intervalEntry)
self.intervalEntry.show()
self.pathHBox = gtk.HBox(False, 0)
self.mainVBox.pack_start(self.pathHBox, False, True, 0)
self.pathHBox.show()
self.pathStarsLabel = gtk.Label("Path to PokerStars auto-import:")
self.pathHBox.pack_start(self.pathStarsLabel, False, False, 0)
self.pathStarsLabel.show()
self.starsDirPath=gtk.Entry()
paths = self.config.get_default_paths("PokerStars")
self.starsDirPath.set_text(paths['hud-defaultPath'])
self.pathHBox.pack_start(self.starsDirPath, False, True, 0)
self.starsDirPath.show()
self.browseButton=gtk.Button("Browse...")
self.browseButton.connect("clicked", self.starsBrowseClicked, "Browse clicked")
self.pathHBox.pack_start(self.browseButton, False, False, 0)
self.browseButton.show()
self.pathTiltLabel = gtk.Label("Path to Full Tilt auto-import:")
self.pathHBox.pack_start(self.pathTiltLabel, False, False, 0)
self.pathTiltLabel.show()
self.tiltDirPath=gtk.Entry()
paths = self.config.get_default_paths("Full Tilt")
self.tiltDirPath.set_text(paths['hud-defaultPath'])
self.pathHBox.pack_start(self.tiltDirPath, False, True, 0)
self.tiltDirPath.show()
self.browseButton=gtk.Button("Browse...")
self.browseButton.connect("clicked", self.tiltBrowseClicked, "Browse clicked")
self.pathHBox.pack_start(self.browseButton, False, False, 0)
self.browseButton.show()
self.startButton=gtk.Button("Start Autoimport")
self.startButton.connect("clicked", self.startClicked, "start clicked")
self.mainVBox.add(self.startButton)
self.startButton.show()
#end of GuiAutoImport.__init__
if __name__== "__main__":
def destroy(*args): # call back for terminating the main eventloop
gtk.main_quit()
settings = {}
settings['db-host'] = "192.168.1.100"
settings['db-user'] = "mythtv"
settings['db-password'] = "mythtv"
settings['db-databaseName'] = "fpdb"
settings['hud-defaultInterval'] = 10
settings['hud-defaultPath'] = 'C:/Program Files/PokerStars/HandHistory/nutOmatic'
settings['imp-callFpdbHud'] = True
i = GuiAutoImport(settings)
main_window = gtk.Window()
main_window.connect("destroy", destroy)
main_window.add(i.mainVBox)
main_window.show()
gtk.main()

152
pyfpdb/GuiBulkImport.py Normal file
View File

@ -0,0 +1,152 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import threading
import fpdb_simple
import fpdb_import
import pygtk
pygtk.require('2.0')
import gtk
import os #todo: remove this once import_dir is in fpdb_import
class GuiBulkImport (threading.Thread):
def import_dir(self):
"""imports a directory, non-recursive. todo: move this to fpdb_import so CLI can use it"""
self.path=self.inputFile
self.importer.addImportDirectory(self.path)
self.importer.runImport()
print "GuiBulkImport.import_dir done"
def load_clicked(self, widget, data=None):
self.inputFile=self.chooser.get_filename()
self.handCount=self.hand_count_tbuffer.get_text(self.hand_count_tbuffer.get_start_iter(), self.hand_count_tbuffer.get_end_iter())
if (self.handCount=="unlimited" or self.handCount=="Unlimited"):
self.importer.setHandCount(0)
else:
self.importer.setHandCount(int(self.handCount))
self.errorFile="failed.txt"
self.minPrint=self.min_print_tbuffer.get_text(self.min_print_tbuffer.get_start_iter(), self.min_print_tbuffer.get_end_iter())
if (self.minPrint=="never" or self.minPrint=="Never"):
self.importer.setMinPrint(0)
else:
self.importer.setMinPrint=int(self.minPrint)
self.quiet=self.info_tbuffer.get_text(self.info_tbuffer.get_start_iter(), self.info_tbuffer.get_end_iter())
if (self.quiet=="yes"):
self.importer.setQuiet(False)
else:
self.importer.setQuiet(True)
self.failOnError=self.fail_error_tbuffer.get_text(self.fail_error_tbuffer.get_start_iter(), self.fail_error_tbuffer.get_end_iter())
if (self.failOnError=="no"):
self.importer.setFailOnError(False)
else:
self.importer.setFailOnError(True)
if os.path.isdir(self.inputFile):
self.import_dir()
else:
self.importer.addImportFile(self.inputFile)
self.importer.runImport()
self.importer.clearFileList()
def get_vbox(self):
"""returns the vbox of this thread"""
return self.vbox
#end def get_vbox
def run (self):
print "todo: implement bulk import thread"
#end def run
def __init__(self, db, settings, config):
self.db=db
self.settings=settings
self.config=config
self.importer = fpdb_import.Importer(self,self.settings)
self.vbox=gtk.VBox(False,1)
self.vbox.show()
self.chooser = gtk.FileChooserWidget()
self.chooser.set_filename(self.settings['bulkImport-defaultPath'])
#chooser.set_default_response(gtk.RESPONSE_OK)
#self.filesel.ok_button.connect_object("clicked", gtk.Widget.destroy, self.filesel)
self.vbox.add(self.chooser)
self.chooser.show()
self.settings_hbox = gtk.HBox(False, 0)
self.vbox.pack_end(self.settings_hbox, False, True, 0)
self.settings_hbox.show()
self.hand_count_label = gtk.Label("Hands to import per file")
self.settings_hbox.add(self.hand_count_label)
self.hand_count_label.show()
self.hand_count_tbuffer=gtk.TextBuffer()
self.hand_count_tbuffer.set_text("unlimited")
self.hand_count_tview=gtk.TextView(self.hand_count_tbuffer)
self.settings_hbox.add(self.hand_count_tview)
self.hand_count_tview.show()
self.min_hands_label = gtk.Label("Status every")
self.settings_hbox.add(self.min_hands_label)
self.min_hands_label.show()
self.min_print_tbuffer=gtk.TextBuffer()
self.min_print_tbuffer.set_text("never")
self.min_print_tview=gtk.TextView(self.min_print_tbuffer)
self.settings_hbox.add(self.min_print_tview)
self.min_print_tview.show()
self.toggles_hbox = gtk.HBox(False, 0)
self.vbox.pack_end(self.toggles_hbox, False, True, 0)
self.toggles_hbox.show()
self.info_label = gtk.Label("Print start/end info:")
self.toggles_hbox.add(self.info_label)
self.info_label.show()
self.info_tbuffer=gtk.TextBuffer()
self.info_tbuffer.set_text("yes")
self.info_tview=gtk.TextView(self.info_tbuffer)
self.toggles_hbox.add(self.info_tview)
self.info_tview.show()
self.fail_error_label = gtk.Label("Fail on error:")
self.toggles_hbox.add(self.fail_error_label)
self.fail_error_label.show()
self.fail_error_tbuffer=gtk.TextBuffer()
self.fail_error_tbuffer.set_text("no")
self.fail_error_tview=gtk.TextView(self.fail_error_tbuffer)
self.toggles_hbox.add(self.fail_error_tview)
self.fail_error_tview.show()
self.load_button = gtk.Button("Import") #todo: rename variables to import too
self.load_button.connect("clicked", self.load_clicked, "Import clicked")
self.toggles_hbox.add(self.load_button)
self.load_button.show()
threading.Thread.__init__ ( self )
print "initialised new bulk import thread (not actually a thread yet)"
#end class import_threaded

145
pyfpdb/GuiGraphViewer.py Normal file
View File

@ -0,0 +1,145 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import threading
import pygtk
pygtk.require('2.0')
import gtk
import os
#import pokereval
try:
from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
from numpy import arange, cumsum
from pylab import *
except:
print "Failed to load libs for graphing, graphing will not function. Please install numpy and matplotlib if you want to use graphs."
print "This is of no consequence for other parts of the program, e.g. import and HUD are NOT affected by this problem."
import fpdb_import
import fpdb_db
class GuiGraphViewer (threading.Thread):
def get_vbox(self):
"""returns the vbox of this thread"""
return self.mainVBox
#end def get_vbox
def showClicked(self, widget, data):
try: self.canvas.destroy()
except AttributeError: pass
name=self.nameEntry.get_text()
site=self.siteEntry.get_text()
if site=="PS":
site=2
sitename="PokerStars: "
elif site=="FTP":
site=1
sitename="Full Tilt: "
else:
print "invalid text in site selection in graph, defaulting to PS"
site=2
self.fig = Figure(figsize=(5,4), dpi=100)
#Set graph properties
self.ax = self.fig.add_subplot(111)
#
self.ax.set_title("Profit graph for ring games")
#Set axis labels and grid overlay properites
self.ax.set_xlabel("Hands", fontsize = 12)
self.ax.set_ylabel("$", fontsize = 12)
self.ax.grid(color='g', linestyle=':', linewidth=0.2)
text = "All Hands, " + sitename + str(name)
self.ax.annotate (text, (61,25), xytext =(0.1, 0.9) , textcoords ="axes fraction" ,)
#Get graph data from DB
line = self.getRingProfitGraph(name, site)
#Draw plot
self.ax.plot(line,)
self.canvas = FigureCanvas(self.fig) # a gtk.DrawingArea
self.mainVBox.pack_start(self.canvas)
self.canvas.show()
#end of def showClicked
def getRingProfitGraph(self, name, site):
self.cursor.execute(self.sql.query['getRingWinningsAllGamesPlayerIdSite'], (name, site))
winnings = self.db.cursor.fetchall()
profit=range(len(winnings))
for i in profit:
self.cursor.execute(self.sql.query['getRingProfitFromHandId'], (name, winnings[i][0], site))
spent = self.db.cursor.fetchone()
profit[i]=(i, winnings[i][1]-spent[0])
y=map(lambda x:float(x[1]), profit)
line = cumsum(y)
return line/100
#end of def getRingProfitGraph
def __init__(self, db, settings, querylist, config, debug=True):
"""Constructor for GraphViewer"""
self.debug=debug
#print "start of GraphViewer constructor"
self.db=db
self.cursor=db.cursor
self.settings=settings
self.sql=querylist
self.mainVBox = gtk.VBox(False, 0)
self.mainVBox.show()
self.settingsHBox = gtk.HBox(False, 0)
self.mainVBox.pack_start(self.settingsHBox, False, True, 0)
self.settingsHBox.show()
self.nameLabel = gtk.Label("Name of the player to be graphed:")
self.settingsHBox.pack_start(self.nameLabel)
self.nameLabel.show()
self.nameEntry=gtk.Entry()
self.nameEntry.set_text("name")
self.settingsHBox.pack_start(self.nameEntry)
self.nameEntry.show()
self.siteLabel = gtk.Label("Site (PS or FTP):")
self.settingsHBox.pack_start(self.siteLabel)
self.siteLabel.show()
self.siteEntry=gtk.Entry()
self.siteEntry.set_text("PS")
self.settingsHBox.pack_start(self.siteEntry)
self.siteEntry.show()
#Note: Assumes PokerStars is in the config
self.nameEntry.set_text(config.supported_sites["PokerStars"].screen_name)
self.showButton=gtk.Button("Show/Refresh")
self.showButton.connect("clicked", self.showClicked, "show clicked")
self.settingsHBox.pack_start(self.showButton)
self.showButton.show()
#end of GuiGraphViewer.__init__

309
pyfpdb/GuiTableViewer.py Normal file
View File

@ -0,0 +1,309 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import threading
import pygtk
pygtk.require('2.0')
import gtk
import os
import fpdb_simple
try:
import MySQLdb
except:
diaSQLLibMissing = gtk.Dialog(title="Fatal Error - SQL interface library missing", parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK))
label = gtk.Label("Please note that the table viewer only works with MySQL, if you use PostgreSQL this error is expected.")
diaSQLLibMissing.vbox.add(label)
label.show()
label = gtk.Label("Since the HUD now runs on all supported plattforms I do not see any point in table viewer anymore, if you disagree please send a message to steffen@sycamoretest.info")
diaSQLLibMissing.vbox.add(label)
label.show()
response = diaSQLLibMissing.run()
#sys.exit(1)
import fpdb_import
import fpdb_db
class GuiTableViewer (threading.Thread):
def hudDivide (self, a, b):
if b==0:
return "n/a"
else:
return str(int((a/float(b))*100))+"%"
#end def hudDivide
def browse_clicked(self, widget, data):
"""runs when user clicks browse on tv tab"""
#print "start of table_viewer.browser_clicked"
current_path=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
dia_chooser = gtk.FileChooserDialog(title="Please choose the file for which you want to open the Table Viewer",
action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
#dia_chooser.set_current_folder(pathname)
dia_chooser.set_filename(current_path)
#dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
response = dia_chooser.run()
if response == gtk.RESPONSE_OK:
#print dia_chooser.get_filename(), 'selected'
self.filename_tbuffer.set_text(dia_chooser.get_filename())
elif response == gtk.RESPONSE_CANCEL:
print 'Closed, no files selected'
dia_chooser.destroy()
#end def table_viewer.browse_clicked
def prepare_data(self):
"""prepares the data for display by refresh_clicked, returns a 2D array"""
#print "start of prepare_data"
arr=[]
#first prepare the header row
if (self.category=="holdem" or self.category=="omahahi" or self.category=="omahahilo"):
tmp=("Name", "HDs", "VPIP", "PFR", "PF3B4B", "ST")
tmp+=("FS", "FB")
tmp+=("CB", )
tmp+=("2B", "3B")
tmp+=("AF", "FF", "AT", "FT", "AR", "FR")
tmp+=("WtSD", "W$wsF", "W$SD")
else:
raise fpdb_simple.FpdbError("reimplement stud")
arr.append(tmp)
#then the data rows
for player in range(len(self.player_names)):
tmp=[]
tmp.append(self.player_names[player][0])
seatCount=len(self.player_names)
if seatCount>=8:
minSeats,maxSeats=7,10
elif seatCount==7:
minSeats,maxSeats=6,10
elif seatCount==6 or seatCount==5:
minSeats,maxSeats=seatCount-1,seatCount+1
elif seatCount==4:
minSeats,maxSeats=4,5
elif seatCount==2 or seatCount==3:
minSeats,maxSeats=seatCount,seatCount
else:
fpdb_simple.FpdbError("invalid seatCount")
self.cursor.execute("SELECT * FROM HudCache WHERE gametypeId=%s AND playerId=%s AND activeSeats>=%s AND activeSeats<=%s", (self.gametype_id, self.player_ids[player][0], minSeats, maxSeats))
rows=self.cursor.fetchall()
row=[]
for field_no in range(len(rows[0])):
row.append(rows[0][field_no])
for row_no in range(len(rows)):
if row_no==0:
pass
else:
for field_no in range(len(rows[row_no])):
if field_no<=3:
pass
else:
#print "in prep data, row_no:",row_no,"field_no:",field_no
row[field_no]+=rows[row_no][field_no]
tmp.append(str(row[6]))#Hands
tmp.append(self.hudDivide(row[7],row[6])) #VPIP
tmp.append(self.hudDivide(row[8],row[6])) #PFR
tmp.append(self.hudDivide(row[10],row[9])+" ("+str(row[9])+")") #PF3B4B
tmp.append(self.hudDivide(row[31],row[30])+" ("+str(row[30])+")") #ST
tmp.append(self.hudDivide(row[35],row[34])+" ("+str(row[34])+")") #FS
tmp.append(self.hudDivide(row[33],row[32])+" ("+str(row[32])+")") #FB
tmp.append(self.hudDivide(row[37],row[36])+" ("+str(row[36])+")") #CB
tmp.append(self.hudDivide(row[39],row[38])+" ("+str(row[38])+")") #2B
tmp.append(self.hudDivide(row[41],row[40])+" ("+str(row[40])+")") #3B
tmp.append(self.hudDivide(row[16],row[11])+" ("+str(row[11])+")") #AF
tmp.append(self.hudDivide(row[24],row[20])+" ("+str(row[20])+")") #FF
tmp.append(self.hudDivide(row[17],row[12])+" ("+str(row[12])+")") #AT
tmp.append(self.hudDivide(row[25],row[21])+" ("+str(row[21])+")") #FT
tmp.append(self.hudDivide(row[18],row[13])+" ("+str(row[13])+")") #AR
tmp.append(self.hudDivide(row[26],row[22])+" ("+str(row[22])+")") #FR
tmp.append(self.hudDivide(row[15],row[11])) #WtSD
tmp.append(self.hudDivide(row[28],row[11])) #W$wSF
tmp.append(self.hudDivide(row[29],row[15])+" ("+str(row[15])+")") #W$@SD
arr.append(tmp)
return arr
#end def table_viewer.prepare_data
def refresh_clicked(self, widget, data):
"""runs when user clicks refresh"""
#print "start of table_viewer.refresh_clicked"
arr=self.prepare_data()
try: self.data_table.destroy()
except AttributeError: pass
self.data_table=gtk.Table(rows=len(arr), columns=len(arr[0]), homogeneous=False)
self.main_vbox.pack_start(self.data_table)
self.data_table.show()
for row in range(len(arr)):
for column in range (len(arr[row])):
eventBox=gtk.EventBox()
new_label=gtk.Label(arr[row][column])
if row%2==0: #
bg_col="white"
if column==0 or (column>=5 and column<=10):
bg_col="lightgrey"
else:
bg_col="lightgrey"
if column==0 or (column>=5 and column<=10):
bg_col="grey"
#style = eventBox.get_style()
#style.font.height=8
#eventBox.set_style(style)
eventBox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bg_col))
eventBox.add(new_label)
self.data_table.attach(child=eventBox, left_attach=column, right_attach=column+1, top_attach=row, bottom_attach=row+1)
eventBox.show()
new_label.show()
#end def table_viewer.refresh_clicked
def read_names_clicked(self, widget, data):
"""runs when user clicks read names"""
#print "start of table_viewer.read_names_clicked"
self.db.reconnect()
self.cursor=self.db.cursor
#self.hands_id=self.last_read_hand_id
self.db.cursor.execute("SELECT gametypeId FROM Hands WHERE id=%s", (self.hands_id, ))
self.gametype_id=self.db.cursor.fetchone()[0]
self.cursor.execute("SELECT category FROM Gametypes WHERE id=%s", (self.gametype_id, ))
self.category=self.db.cursor.fetchone()[0]
#print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
self.db.cursor.execute("""SELECT DISTINCT Players.id FROM HandsPlayers
INNER JOIN Players ON HandsPlayers.playerId=Players.id
WHERE handId=%s""", (self.hands_id, ))
self.player_ids=self.db.cursor.fetchall()
#print "self.player_ids:",self.player_ids
self.db.cursor.execute("""SELECT DISTINCT Players.name FROM HandsPlayers
INNER JOIN Players ON HandsPlayers.playerId=Players.id
WHERE handId=%s""", (self.hands_id, ))
self.player_names=self.db.cursor.fetchall()
#print "self.player_names:",self.player_names
#end def table_viewer.read_names_clicked
def import_clicked(self, widget, data):
"""runs when user clicks import"""
#print "start of table_viewer.import_clicked"
self.inputFile=self.filename_tbuffer.get_text(self.filename_tbuffer.get_start_iter(), self.filename_tbuffer.get_end_iter())
self.server=self.db.host
self.database=self.db.database
self.user=self.db.user
self.password=self.db.password
self.importer = fpdb_import.Importer(self, self.settings)
self.importer.setMinPrint(0)
self.importer.setQuiet(False)
self.importer.setFailOnError(False)
self.importer.setHandCount(0)
self.importer.addImportFile(self.inputFile)
self.importer.runImport()
self.hands_id=self.importer.handsId
#end def table_viewer.import_clicked
def all_clicked(self, widget, data):
"""runs when user clicks all"""
#print "start of table_viewer.all_clicked"
self.import_clicked(widget, data)
self.read_names_clicked(widget, data)
self.refresh_clicked(widget, data)
#end def table_viewer.all_clicked
def get_vbox(self):
"""returns the vbox of this thread"""
return self.main_vbox
#end def get_vbox
def __init__(self, db, settings, debug=True):
"""Constructor for table_viewer"""
self.debug=debug
#print "start of table_viewer constructor"
self.db=db
self.cursor=db.cursor
self.settings=settings
self.main_vbox = gtk.VBox(False, 0)
self.main_vbox.show()
self.settings_hbox = gtk.HBox(False, 0)
self.main_vbox.pack_end(self.settings_hbox, False, True, 0)
self.settings_hbox.show()
self.filename_label = gtk.Label("Path of history file")
self.settings_hbox.pack_start(self.filename_label, False, False)
self.filename_label.show()
self.filename_tbuffer=gtk.TextBuffer()
self.filename_tbuffer.set_text(self.settings['hud-defaultPath'])
self.filename_tview=gtk.TextView(self.filename_tbuffer)
self.settings_hbox.pack_start(self.filename_tview, True, True, padding=5)
self.filename_tview.show()
self.browse_button=gtk.Button("Browse...")
self.browse_button.connect("clicked", self.browse_clicked, "Browse clicked")
self.settings_hbox.pack_start(self.browse_button, False, False)
self.browse_button.show()
self.button_hbox = gtk.HBox(False, 0)
self.main_vbox.pack_end(self.button_hbox, False, True, 0)
self.button_hbox.show()
#self.import_button = gtk.Button("Import")
#self.import_button.connect("clicked", self.import_clicked, "Import clicked")
#self.button_hbox.add(self.import_button)
#self.import_button.show()
#self.read_names_button = gtk.Button("Read Names")
#self.read_names_button.connect("clicked", self.read_names_clicked, "Read clicked")
#self.button_hbox.add(self.read_names_button)
#self.read_names_button.show()
#self.refresh_button = gtk.Button("Show/Refresh data")
#self.refresh_button.connect("clicked", self.refresh_clicked, "Refresh clicked")
#self.button_hbox.add(self.refresh_button)
#self.refresh_button.show()
self.all_button = gtk.Button("Import&Read&Refresh")
self.all_button.connect("clicked", self.all_clicked, "All clicked")
self.button_hbox.add(self.all_button)
self.all_button.show()
#end of table_viewer.__init__

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FreePokerToolsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FreePokerToolsConfig.xsd">
<supported_sites>
<site enabled="True" site_name="PokerStars" table_finder="PokerStars.exe" screen_name="DO NOT NEED THIS YET" site_path="~/.wine/drive_c/Program Files/PokerStars/" HH_path="~/.wine/drive_c/Program Files/PokerStars/HandHistory/abc/" decoder="pokerstars_decode_table" converter="passthrough" supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<layout max="8" width="792" height="546" fav_seat="0">
<location seat="1" x="684" y="61"> </location>
<location seat="2" x="689" y="239"> </location>
<location seat="3" x="692" y="346"> </location>
<location seat="4" x="525" y="402"> </location>
<location seat="5" x="259" y="402"> </location>
<location seat="6" x="0" y="348"> </location>
<location seat="7" x="0" y="240"> </location>
<location seat="8" x="0" y="35"> </location>
</layout>
<layout max="6" width="792" height="546" fav_seat="0">
<location seat="1" x="681" y="119"> </location>
<location seat="2" x="681" y="301"> </location>
<location seat="3" x="487" y="369"> </location>
<location seat="4" x="226" y="369"> </location>
<location seat="5" x="0" y="301"> </location>
<location seat="6" x="0" y="119"> </location>
</layout>
<layout max="10" width="792" height="546" fav_seat="0">
<location seat="1" x="684" y="61"> </location>
<location seat="2" x="689" y="239"> </location>
<location seat="3" x="692" y="346"> </location>
<location seat="4" x="586" y="393"> </location>
<location seat="5" x="421" y="440"> </location>
<location seat="6" x="267" y="440"> </location>
<location seat="7" x="0" y="361"> </location>
<location seat="8" x="0" y="280"> </location>
<location seat="9" x="121" y="280"> </location>
<location seat="10" x="46" y="30"> </location>
</layout>
<layout max="9" width="792" height="546" fav_seat="0">
<location seat="1" x="560" y="0"> </location>
<location seat="2" x="679" y="123"> </location>
<location seat="3" x="688" y="309"> </location>
<location seat="4" x="483" y="370"> </location>
<location seat="5" x="444" y="413"> </location>
<location seat="6" x="224" y="372"> </location>
<location seat="7" x="0" y="307"> </location>
<location seat="8" x="0" y="121"> </location>
<location seat="9" x="140" y="0"> </location>
</layout>
<layout fav_seat="0" height="546" max="2" width="792">
<location seat="1" x="651" y="288"> </location>
<location seat="2" x="10" y="288"> </location>
</layout>
</site>
<site enabled="True" site_name="Full Tilt" table_finder="FullTiltPoker.exe" screen_name="DO NOT NEED THIS YET" site_path="~/.wine/drive_c/Program Files/Full Tilt Poker/" HH_path="~/.wine/drive_c/Program Files/Full Tilt Poker/HandHistory/abc/" decoder="fulltilt_decode_table" converter="passthrough" supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<layout fav_seat="0" height="547" max="8" width="794">
<location seat="1" x="640" y="64"> </location>
<location seat="2" x="650" y="230"> </location>
<location seat="3" x="650" y="385"> </location>
<location seat="4" x="588" y="425"> </location>
<location seat="5" x="92" y="425"> </location>
<location seat="6" x="0" y="373"> </location>
<location seat="7" x="0" y="223"> </location>
<location seat="8" x="25" y="50"> </location>
</layout>
<layout fav_seat="0" height="547" max="6" width="794">
<location seat="1" x="640" y="58"> </location>
<location seat="2" x="654" y="288"> </location>
<location seat="3" x="615" y="424"> </location>
<location seat="4" x="70" y="421"> </location>
<location seat="5" x="0" y="280"> </location>
<location seat="6" x="70" y="58"> </location>
</layout>
<layout fav_seat="0" height="547" max="2" width="794">
<location seat="1" x="651" y="288"> </location>
<location seat="2" x="10" y="288"> </location>
</layout>
<layout fav_seat="0" height="547" max="9" width="794">
<location seat="1" x="634" y="38"> </location>
<location seat="2" x="667" y="184"> </location>
<location seat="3" x="667" y="321"> </location>
<location seat="4" x="667" y="445"> </location>
<location seat="5" x="337" y="459"> </location>
<location seat="6" x="0" y="400"> </location>
<location seat="7" x="0" y="322"> </location>
<location seat="8" x="0" y="181"> </location>
<location seat="9" x="70" y="53"> </location>
</layout>
</site>
<site enabled="False" site_name="Everleaf" table_finder="Poker.exe" screen_name="DO NOT NEED THIS YET" site_path="" HH_path="" decoder="Unknown" converter="EverleafToFpdb" supported_games="holdem,razz,omahahi,omahahilo,studhi" fgcolor="#48D1CC" bgcolor="#000000">
<layout fav_seat="0" height="546" max="6" width="792">
<location seat="1" x="581" y="109"> </location>
<location seat="2" x="605" y="287"> </location>
<location seat="3" x="544" y="423"> </location>
<location seat="4" x="80" y="393"> </location>
<location seat="5" x="5" y="284"> </location>
<location seat="6" x="38" y="108"> </location>
</layout>
<layout fav_seat="0" height="546" max="10" width="792">
<location seat="1" x="473" y="78"> </location>
<location seat="2" x="650" y="93"> </location>
<location seat="3" x="670" y="219"> </location>
<location seat="4" x="633" y="358"> </location>
<location seat="5" x="437" y="393"> </location>
<location seat="6" x="249" y="396"> </location>
<location seat="7" x="42" y="357"> </location>
<location seat="8" x="8" y="218"> </location>
<location seat="9" x="35" y="89"> </location>
<location seat="10" x="217" y="78"> </location>
</layout>
<layout fav_seat="0" height="546" max="2" width="792">
<location seat="1" x="651" y="288"> </location>
<location seat="2" x="10" y="288"> </location>
</layout>
</site>
</supported_sites>
<supported_games>
<game cols="3" db="fpdb" game_name="holdem" rows="2">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="razz" rows="2">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="omahahi" rows="2">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="omahahilo" rows="2">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="studhi" rows="2">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
<game cols="3" db="fpdb" game_name="studhilo" rows="2">
<stat click="tog_decorate" col="0" popup="default" row="0" stat_name="vpip" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="0" stat_name="pfr" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="0" stat_name="ffreq_1" tip="tip1"> </stat>
<stat click="tog_decorate" col="0" popup="default" row="1" stat_name="n" tip="tip1"> </stat>
<stat click="tog_decorate" col="1" popup="default" row="1" stat_name="wtsd" tip="tip1"> </stat>
<stat click="tog_decorate" col="2" popup="default" row="1" stat_name="wmsd" tip="tip1"> </stat>
</game>
</supported_games>
<popup_windows>
<pu pu_name="default">
<pu_stat pu_stat_name="n"> </pu_stat>
<pu_stat pu_stat_name="vpip"> </pu_stat>
<pu_stat pu_stat_name="pfr"> </pu_stat>
<pu_stat pu_stat_name="three_B_0"> </pu_stat>
<pu_stat pu_stat_name="steal"> </pu_stat>
<pu_stat pu_stat_name="f_BB_steal"> </pu_stat>
<pu_stat pu_stat_name="f_SB_steal"> </pu_stat>
<pu_stat pu_stat_name="wmsd"> </pu_stat>
<pu_stat pu_stat_name="wtsd"> </pu_stat>
<pu_stat pu_stat_name="WMsF"> </pu_stat>
<pu_stat pu_stat_name="a_freq_1"> </pu_stat>
<pu_stat pu_stat_name="a_freq_2"> </pu_stat>
<pu_stat pu_stat_name="a_freq_3"> </pu_stat>
<pu_stat pu_stat_name="a_freq_4"> </pu_stat>
<pu_stat pu_stat_name="cb_1"> </pu_stat>
<pu_stat pu_stat_name="cb_2"> </pu_stat>
<pu_stat pu_stat_name="cb_3"> </pu_stat>
<pu_stat pu_stat_name="cb_4"> </pu_stat>
<pu_stat pu_stat_name="ffreq_1"> </pu_stat>
<pu_stat pu_stat_name="ffreq_2"> </pu_stat>
<pu_stat pu_stat_name="ffreq_3"> </pu_stat>
<pu_stat pu_stat_name="ffreq_4"> </pu_stat>
</pu>
</popup_windows>
<import callFpdbHud = "True" interval = "10" ></import>
<tv combinedStealFold = "True" combined2B3B = "True" combinedPostflop = "True"></tv>
<supported_databases>
<database db_name="fpdb" db_server="mysql" db_ip="localhost" db_user="fpdb" db_pass="YOUR MYSQL PASSWORD" db_type="fpdb"> </database>
</supported_databases>
<mucked_windows>
<mw mw_name="stud1" format="stud" rows="8" cols="11" deck="Cards01.png" card_wd="30" card_ht="42"> </mw>
</mucked_windows>
</FreePokerToolsConfig>

166
pyfpdb/HUD_main.py Executable file
View File

@ -0,0 +1,166 @@
#!/usr/bin/env python
"""Hud_main.py
Main for FreePokerTools HUD.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# to do kill window on my seat
# to do adjust for preferred seat
# to do allow window resizing
# to do hud to echo, but ignore non numbers
# to do no hud window for hero
# to do things to add to config.xml
# to do font and size
# to do opacity
# Standard Library modules
import sys
import os
import thread
import time
import string
import re
errorfile = open('HUD-error.txt', 'w', 0)
sys.stderr = errorfile
# pyGTK modules
import pygtk
import gtk
import gobject
# FreePokerTools modules
import Configuration
import Database
import Tables
import Hud
# global dict for keeping the huds
hud_dict = {}
db_connection = 0;
config = 0;
def destroy(*args): # call back for terminating the main eventloop
gtk.main_quit()
def create_HUD(new_hand_id, table, db_name, table_name, max, poker_game, db_connection, config, stat_dict):
global hud_dict
def idle_func():
global hud_dict
gtk.gdk.threads_enter()
try:
hud_dict[table_name] = Hud.Hud(table, max, poker_game, config, db_name)
hud_dict[table_name].create(new_hand_id, config)
hud_dict[table_name].update(new_hand_id, config, stat_dict)
hud_dict[table_name].reposition_windows()
return False
finally:
gtk.gdk.threads_leave()
gobject.idle_add(idle_func)
def update_HUD(new_hand_id, table_name, config, stat_dict):
global hud_dict
def idle_func():
gtk.gdk.threads_enter()
try:
hud_dict[table_name].update(new_hand_id, config, stat_dict)
return False
finally:
gtk.gdk.threads_leave()
gobject.idle_add(idle_func)
def read_stdin(): # This is the thread function
global hud_dict
db_connection = Database.Database(config, db_name, 'temp')
# tourny_finder = re.compile('(\d+) (\d+)')
while True: # wait for a new hand number on stdin
new_hand_id = sys.stdin.readline()
new_hand_id = string.rstrip(new_hand_id)
if new_hand_id == "": # blank line means quit
destroy()
# delete hud_dict entries for any HUD destroyed since last iteration
for h in hud_dict.keys():
if hud_dict[h].deleted:
del(hud_dict[h])
# get basic info about the new hand from the db
(table_name, max, poker_game) = db_connection.get_table_name(new_hand_id)
# find out if this hand is from a tournament
is_tournament = False
# (t_number, s_number) = (0, 0)
# mat_obj = tourny_finder(table_name)
# if len(mat_obj.groups) == 2:
# is_tournament = True
# (t_number, s_number) = mat_obj.group(1, 2)
stat_dict = db_connection.get_stats_from_hand(new_hand_id)
# if a hud for this CASH table exists, just update it
if hud_dict.has_key(table_name):
update_HUD(new_hand_id, table_name, config, stat_dict)
# if a hud for this TOURNAMENT table exists, just update it
# elif hud_dict.has_key(t_number):
# update_HUD(new_hand_id, t_number, config, stat_dict)
# otherwise create a new hud
else:
if is_tournament:
tablewindow = Tables.discover_tournament_table(config, t_number, s_number)
if tablewindow == None:
sys.stderr.write("table name "+table_name+" not found\n")
else:
create_HUD(new_hand_id, tablewindow, db_name, t_number, max, poker_game, db_connection, config, stat_dict)
else:
tablewindow = Tables.discover_table_by_name(config, table_name)
if tablewindow == None:
sys.stderr.write("table name "+table_name+" not found\n")
else:
create_HUD(new_hand_id, tablewindow, db_name, table_name, max, poker_game, db_connection, config, stat_dict)
if __name__== "__main__":
sys.stderr.write("HUD_main starting\n")
try:
db_name = sys.argv[1]
except:
db_name = 'fpdb'
sys.stderr.write("Using db name = %s\n" % (db_name))
config = Configuration.Config()
gobject.threads_init() # this is required
thread.start_new_thread(read_stdin, ()) # starts the thread
main_window = gtk.Window()
main_window.connect("destroy", destroy)
eb = gtk.EventBox()
label = gtk.Label('Closing this window will exit from the HUD.')
eb.add(label)
main_window.add(eb)
main_window.set_title("HUD Main Window")
main_window.show_all()
gtk.main()

194
pyfpdb/HandHistory.py Normal file
View File

@ -0,0 +1,194 @@
#!/usr/bin/env python
"""HandHistory.py
Parses HandHistory xml files and returns requested objects.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# Standard Library modules
import xml.dom.minidom
from xml.dom.minidom import Node
class HandHistory:
def __init__(self, xml_string, elements = ('ALL')):
doc = xml.dom.minidom.parseString(xml_string)
if elements == ('ALL'):
elements = ('BETTING', 'AWARDS', 'POSTS', 'PLAYERS', 'GAME')
if 'BETTING' in elements:
self.BETTING = Betting(doc.getElementsByTagName('BETTING')[0])
if 'AWARDS' in elements:
self.AWARDS = Awards (doc.getElementsByTagName('AWARDS')[0])
if 'POSTS' in elements:
self.POSTS = Posts (doc.getElementsByTagName('POSTS')[0])
if 'GAME' in elements:
self.GAME = Game (doc.getElementsByTagName('GAME')[0])
if 'PLAYERS' in elements:
self.PLAYERS = {}
p_n = doc.getElementsByTagName('PLAYERS')[0]
for p in p_n.getElementsByTagName('PLAYER'):
a_player = Player(p)
self.PLAYERS[a_player.name] = a_player
class Player:
def __init__(self, node):
self.name = node.getAttribute('NAME')
self.seat = node.getAttribute('SEAT')
self.stack = node.getAttribute('STACK')
self.showed_hand = node.getAttribute('SHOWED_HAND')
self.cards = node.getAttribute('CARDS')
self.allin = node.getAttribute('ALLIN')
self.sitting_out = node.getAttribute('SITTING_OUT')
self.hand = node.getAttribute('HAND')
self.start_cards = node.getAttribute('START_CARDS')
if self.allin == '' or \
self.allin == '0' or \
self.allin.upper() == 'FALSE': self.allin = False
else: self.allin = True
if self.sitting_out == '' or \
self.sitting_out == '0' or \
self.sitting_out.upper() == 'FALSE': self.sitting_out = False
else: self.sitting_out = True
def __str__(self):
temp = "%s\n seat = %s\n stack = %s\n cards = %s\n" % \
(self.name, self.seat, self.stack, self.cards)
temp = temp + " showed_hand = %s\n allin = %s\n" % \
(self.showed_hand, self.allin)
temp = temp + " hand = %s\n start_cards = %s\n" % \
(self.hand, self.start_cards)
return temp
class Awards:
def __init__(self, node):
self.awards = [] # just an array of award objects
for a in node.getElementsByTagName('AWARD'):
self.awards.append(Award(a))
def __str__(self):
temp = ""
for a in self.awards:
temp = temp + "%s\n" % (a)
return temp
class Award:
def __init__(self, node):
self.player = node.getAttribute('PLAYER')
self.amount = node.getAttribute('AMOUNT')
self.pot = node.getAttribute('POT')
def __str__(self):
return self.player + " won " + self.amount + " from " + self.pot
class Game:
def __init__(self, node):
print node
self.tags = {}
for tag in ( ('GAME_NAME', 'game_name'), ('MAX', 'max'), ('HIGHLOW', 'high_low'),
('STRUCTURE', 'structure'), ('MIXED', 'mixed') ):
L = node.getElementsByTagName(tag[0])
if (not L): continue
print L
for node2 in L:
title = ""
for node3 in node2.childNodes:
if (node3.nodeType == Node.TEXT_NODE):
title +=node3.data
self.tags[tag[1]] = title
def __str__(self):
return "%s %s %s, (%s max), %s" % (self.tags['structure'],
self.tags['game_name'],
self.tags['game_name'],
self.tags['max'],
self.tags['game_name'])
class Posts:
def __init__(self, node):
self.posts = [] # just an array of post objects
for p in node.getElementsByTagName('POST'):
self.posts.append(Post(p))
def __str__(self):
temp = ""
for p in self.posts:
temp = temp + "%s\n" % (p)
return temp
class Post:
def __init__(self, node):
self.player = node.getAttribute('PLAYER')
self.amount = node.getAttribute('AMOUNT')
self.posted = node.getAttribute('POSTED')
self.live = node.getAttribute('LIVE')
def __str__(self):
return ("%s posted %s %s %s") % (self.player, self.amount, self.posted, self.live)
class Betting:
def __init__(self, node):
self.rounds = [] # a Betting object is just an array of rounds
for r in node.getElementsByTagName('ROUND'):
self.rounds.append(Round(r))
def __str__(self):
temp = ""
for r in self.rounds:
temp = temp + "%s\n" % (r)
return temp
class Round:
def __init__(self, node):
self.name = node.getAttribute('ROUND_NAME')
self.action = []
for a in node.getElementsByTagName('ACTION'):
self.action.append(Action(a))
def __str__(self):
temp = self.name + "\n"
for a in self.action:
temp = temp + " %s\n" % (a)
return temp
class Action:
def __init__(self, node):
self.player = node.getAttribute('PLAYER')
self.action = node.getAttribute('ACT')
self.amount = node.getAttribute('AMOUNT')
self.allin = node.getAttribute('ALLIN')
def __str__(self):
return self.player + " " + self.action + " " + self.amount + " " + self.allin
if __name__== "__main__":
file = open('test.xml', 'r')
xml_string = file.read()
file.close()
print xml_string + "\n\n\n"
h = HandHistory(xml_string, ('ALL'))
print h.GAME
print h.POSTS
print h.BETTING
print h.AWARDS
for p in h.PLAYERS.keys():
print h.PLAYERS[p]

562
pyfpdb/Hud.py Normal file
View File

@ -0,0 +1,562 @@
#!/usr/bin/env python
"""Hud.py
Create and manage the hud overlays.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# Standard Library modules
import os
import sys
# pyGTK modules
import pygtk
import gtk
import pango
import gobject
# win32 modules -- only imported on windows systems
if os.name == 'nt':
import win32gui
import win32con
import win32api
# FreePokerTools modules
import Tables # needed for testing only
import Configuration
import Stats
import Mucked
import Database
import HUD_main
class Hud:
def __init__(self, table, max, poker_game, config, db_name):
self.table = table
self.config = config
self.poker_game = poker_game
self.max = max
self.db_name = db_name
self.deleted = False
self.stacked = True
self.colors = config.get_default_colors(self.table.site)
self.stat_windows = {}
self.popup_windows = {}
self.font = pango.FontDescription("Sans 8")
# Set up a main window for this this instance of the HUD
self.main_window = gtk.Window()
# self.window.set_decorated(0)
self.main_window.set_gravity(gtk.gdk.GRAVITY_STATIC)
self.main_window.set_title(table.name + " FPDBHUD")
self.main_window.connect("destroy", self.kill_hud)
self.main_window.set_decorated(False)
#self.main_window.set_transient_for(parent.get_toplevel())
self.ebox = gtk.EventBox()
self.label = gtk.Label("Right click to close HUD for %s\nor Save Stat Positions." % (table.name))
self.label.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudbgcolor']))
self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor']))
self.main_window.add(self.ebox)
self.ebox.add(self.label)
self.ebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudbgcolor']))
self.ebox.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor']))
self.main_window.move(self.table.x, self.table.y)
# A popup window for the main window
self.menu = gtk.Menu()
self.item1 = gtk.MenuItem('Kill this HUD')
self.menu.append(self.item1)
self.item1.connect("activate", self.kill_hud)
self.item1.show()
self.item2 = gtk.MenuItem('Save Layout')
self.menu.append(self.item2)
self.item2.connect("activate", self.save_layout)
self.item2.show()
self.item3 = gtk.MenuItem('Reposition Stats')
self.menu.append(self.item3)
self.item3.connect("activate", self.reposition_windows)
self.item3.show()
self.ebox.connect_object("button-press-event", self.on_button_press, self.menu)
self.main_window.show_all()
# set_keep_above(1) for windows
if os.name == 'nt':
self.topify_window(self.main_window)
else:
self.main_window.parentgdkhandle = gtk.gdk.window_foreign_new(self.table.number) # gets a gdk handle for poker client
self.main_window.gdkhandle = gtk.gdk.window_foreign_new(self.main_window.window.xid) # gets a gdk handle for the hud table window
self.main_window.gdkhandle.set_transient_for(self.main_window.parentgdkhandle) #
self.main_window.set_destroy_with_parent(True)
def on_button_press(self, widget, event):
if event.button == 3:
widget.popup(None, None, None, event.button, event.time)
return True
return False
def kill_hud(self, args):
for k in self.stat_windows.keys():
self.stat_windows[k].window.destroy()
self.main_window.destroy()
self.deleted = True
def reposition_windows(self, args):
for w in self.stat_windows:
self.stat_windows[w].window.move(self.stat_windows[w].x,
self.stat_windows[w].y)
def save_layout(self, *args):
new_layout = []
# todo: have the hud track the poker table's window position regularly, don't forget to update table.x and table.y.
for sw in self.stat_windows:
loc = self.stat_windows[sw].window.get_position()
new_loc = (loc[0] - self.table.x, loc[1] - self.table.y)
new_layout.append(new_loc)
# print new_layout
self.config.edit_layout(self.table.site, self.max, locations = new_layout)
self.config.save()
def adj_seats(self, hand, config):
adj = range(0, self.max + 1) # default seat adjustments = no adjustment
# does the user have a fav_seat?
try:
if int(config.supported_sites[self.table.site].layout[self.max].fav_seat) > 0:
fav_seat = config.supported_sites[self.table.site].layout[self.max].fav_seat
db_connection = Database.Database(config, self.db_name, 'temp')
actual_seat = db_connection.get_actual_seat(hand, config.supported_sites[self.table.site].screen_name)
db_connection.close_connection()
for i in range(0, self.max + 1):
j = actual_seat + i
if j > self.max: j = j - self.max
adj[j] = fav_seat + i
if adj[j] > self.max: adj[j] = adj[j] - self.max
except:
pass
return adj
def create(self, hand, config):
# update this hud, to the stats and players as of "hand"
# hand is the hand id of the most recent hand played at this table
#
# this method also manages the creating and destruction of stat
# windows via calls to the Stat_Window class
adj = self.adj_seats(hand, config)
loc = self.config.get_locations(self.table.site, self.max)
# create the stat windows
for i in range(1, self.max + 1):
(x, y) = loc[adj[i]]
if self.stat_windows.has_key(i):
self.stat_windows[i].relocate(x, y)
else:
self.stat_windows[i] = Stat_Window(game = config.supported_games[self.poker_game],
parent = self,
table = self.table,
x = x,
y = y,
seat = i,
player_id = 'fake',
font = self.font)
self.stats = []
for i in range(0, config.supported_games[self.poker_game].rows + 1):
row_list = [''] * config.supported_games[self.poker_game].cols
self.stats.append(row_list)
for stat in config.supported_games[self.poker_game].stats.keys():
self.stats[config.supported_games[self.poker_game].stats[stat].row] \
[config.supported_games[self.poker_game].stats[stat].col] = \
config.supported_games[self.poker_game].stats[stat].stat_name
# self.mucked_window = gtk.Window()
# self.m = Mucked.Mucked(self.mucked_window, self.db_connection)
# self.mucked_window.show_all()
def update(self, hand, config, stat_dict):
self.hand = hand # this is the last hand, so it is available later
for s in stat_dict.keys():
try:
self.stat_windows[stat_dict[s]['seat']].player_id = stat_dict[s]['player_id']
except: # omg, we have more seats than stat windows .. damn poker sites with incorrect max seating info .. let's force 10 here
self.max = 10
self.create(hand, config)
self.stat_windows[stat_dict[s]['seat']].player_id = stat_dict[s]['player_id']
for r in range(0, config.supported_games[self.poker_game].rows):
for c in range(0, config.supported_games[self.poker_game].cols):
this_stat = config.supported_games[self.poker_game].stats[self.stats[r][c]]
number = Stats.do_stat(stat_dict, player = stat_dict[s]['player_id'], stat = self.stats[r][c])
statstring = this_stat.hudprefix + str(number[1]) + this_stat.hudsuffix
self.stat_windows[stat_dict[s]['seat']].label[r][c].set_text(statstring)
tip = stat_dict[s]['screen_name'] + "\n" + number[5] + "\n" + \
number[3] + ", " + number[4]
Stats.do_tip(self.stat_windows[stat_dict[s]['seat']].e_box[r][c], tip)
# self.m.update(hand)
def topify_window(self, window):
"""Set the specified gtk window to stayontop in MS Windows."""
def windowEnumerationHandler(hwnd, resultList):
'''Callback for win32gui.EnumWindows() to generate list of window handles.'''
resultList.append((hwnd, win32gui.GetWindowText(hwnd)))
unique_name = 'unique name for finding this window'
real_name = window.get_title()
window.set_title(unique_name)
tl_windows = []
win32gui.EnumWindows(windowEnumerationHandler, tl_windows)
for w in tl_windows:
if w[1] == unique_name:
#win32gui.ShowWindow(w[0], win32con.SW_HIDE)
window.parentgdkhandle = gtk.gdk.window_foreign_new(long(self.table.number))
self.main_window.gdkhandle = gtk.gdk.window_foreign_new(w[0])
self.main_window.gdkhandle.set_transient_for(window.parentgdkhandle)
#win32gui.ShowWindow(w[0], win32con.SW_SHOW)
style = win32gui.GetWindowLong(self.table.number, win32con.GWL_EXSTYLE)
#style |= win32con.WS_EX_TOOLWINDOW
#style &= ~win32con.WS_EX_APPWINDOW
style |= win32con.WS_CLIPCHILDREN
win32gui.SetWindowLong(self.table.number, win32con.GWL_EXSTYLE, style)
#win32gui.SetWindowPos(w[0], win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE|win32con.SWP_NOSIZE)
# notify_id = (w[0],
# 0,
# win32gui.NIF_ICON | win32gui.NIF_MESSAGE | win32gui.NIF_TIP,
# win32con.WM_USER+20,
# 0,
# '')
# win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, notify_id)
#
window.set_title(real_name)
class Stat_Window:
def button_press_cb(self, widget, event, *args):
# This handles all callbacks from button presses on the event boxes in
# the stat windows. There is a bit of an ugly kludge to separate single-
# and double-clicks.
if event.button == 1: # left button event
if event.type == gtk.gdk.BUTTON_PRESS: # left button single click
if self.sb_click > 0: return
self.sb_click = gobject.timeout_add(250, self.single_click, widget)
elif event.type == gtk.gdk._2BUTTON_PRESS: # left button double click
if self.sb_click > 0:
gobject.source_remove(self.sb_click)
self.sb_click = 0
self.double_click(widget, event, *args)
if event.button == 2: # middle button event
pass
# print "middle button clicked"
if event.button == 3: # right button event
pass
# print "right button clicked"
def single_click(self, widget):
# Callback from the timeout in the single-click finding part of the
# button press call back. This needs to be modified to get all the
# arguments from the call.
# print "left button clicked"
self.sb_click = 0
Popup_window(widget, self)
return False
def double_click(self, widget, event, *args):
self.toggle_decorated(widget)
def toggle_decorated(self, widget):
top = widget.get_toplevel()
(x, y) = top.get_position()
if top.get_decorated():
top.set_decorated(0)
top.move(x, y)
else:
top.set_decorated(1)
top.move(x, y)
def relocate(self, x, y):
self.x = x + self.table.x
self.y = y + self.table.y
self.window.move(self.x, self.y)
def __init__(self, parent, game, table, seat, x, y, player_id, font):
self.parent = parent # Hud object that this stat window belongs to
self.game = game # Configuration object for the curren
self.table = table # Table object where this is going
self.x = x + table.x # table.x and y are the location of the table
self.y = y + table.y # x and y are the location relative to table.x & y
self.player_id = player_id # looks like this isn't used ;)
self.sb_click = 0 # used to figure out button clicks
self.window = gtk.Window()
self.window.set_decorated(0)
self.window.set_gravity(gtk.gdk.GRAVITY_STATIC)
self.window.set_title("%s" % seat)
self.window.set_property("skip-taskbar-hint", True)
self.window.set_transient_for(parent.main_window)
self.grid = gtk.Table(rows = self.game.rows, columns = self.game.cols, homogeneous = False)
self.window.add(self.grid)
self.e_box = []
self.frame = []
self.label = []
for r in range(self.game.rows):
self.e_box.append([])
self.label.append([])
for c in range(self.game.cols):
self.e_box[r].append( gtk.EventBox() )
self.e_box[r][c].modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(parent.colors['hudbgcolor']))
self.e_box[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(parent.colors['hudfgcolor']))
Stats.do_tip(self.e_box[r][c], 'farts')
self.grid.attach(self.e_box[r][c], c, c+1, r, r+1, xpadding = 0, ypadding = 0)
self.label[r].append( gtk.Label('xxx') )
self.label[r][c].modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(parent.colors['hudbgcolor']))
self.label[r][c].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(parent.colors['hudfgcolor']))
self.e_box[r][c].add(self.label[r][c])
self.e_box[r][c].connect("button_press_event", self.button_press_cb)
# font = pango.FontDescription("Sans 8")
self.label[r][c].modify_font(font)
if not os.name == 'nt': # seems to be a bug in opacity on windows
self.window.set_opacity(parent.colors['hudopacity'])
self.window.realize
self.window.move(self.x, self.y)
self.window.show_all()
# set_keep_above(1) for windows
if os.name == 'nt': self.topify_window(self.window)
def topify_window(self, window):
"""Set the specified gtk window to stayontop in MS Windows."""
def windowEnumerationHandler(hwnd, resultList):
'''Callback for win32gui.EnumWindows() to generate list of window handles.'''
resultList.append((hwnd, win32gui.GetWindowText(hwnd)))
unique_name = 'unique name for finding this window'
real_name = window.get_title()
window.set_title(unique_name)
tl_windows = []
win32gui.EnumWindows(windowEnumerationHandler, tl_windows)
for w in tl_windows:
if w[1] == unique_name:
#win32gui.SetWindowPos(w[0], win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE|win32con.SWP_NOSIZE)
# style = win32gui.GetWindowLong(w[0], win32con.GWL_EXSTYLE)
# style |= win32con.WS_EX_TOOLWINDOW
# style &= ~win32con.WS_EX_APPWINDOW
# win32gui.SetWindowLong(w[0], win32con.GWL_EXSTYLE, style)
win32gui.ShowWindow(w[0], win32con.SW_SHOW)
window.set_title(real_name)
def destroy(*args): # call back for terminating the main eventloop
gtk.main_quit()
class Popup_window:
def __init__(self, parent, stat_window):
self.sb_click = 0
# create the popup window
self.window = gtk.Window()
self.window.set_decorated(0)
self.window.set_gravity(gtk.gdk.GRAVITY_STATIC)
# self.window.set_keep_above(1)
self.window.set_title("popup")
self.window.set_property("skip-taskbar-hint", True)
self.window.set_transient_for(parent.get_toplevel())
self.window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
self.ebox = gtk.EventBox()
self.ebox.connect("button_press_event", self.button_press_cb)
self.lab = gtk.Label("stuff\nstuff\nstuff")
# need an event box so we can respond to clicks
self.window.add(self.ebox)
self.ebox.add(self.lab)
self.ebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(stat_window.parent.colors['hudbgcolor']))
self.ebox.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(stat_window.parent.colors['hudfgcolor']))
self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(stat_window.parent.colors['hudbgcolor']))
self.window.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(stat_window.parent.colors['hudfgcolor']))
self.lab.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(stat_window.parent.colors['hudbgcolor']))
self.lab.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(stat_window.parent.colors['hudfgcolor']))
self.window.realize
# figure out the row, col address of the click that activated the popup
row = 0
col = 0
for r in range(0, stat_window.game.rows):
for c in range(0, stat_window.game.cols):
if stat_window.e_box[r][c] == parent:
row = r
col = c
break
# figure out what popup format we're using
popup_format = "default"
for stat in stat_window.game.stats.keys():
if stat_window.game.stats[stat].row == row and stat_window.game.stats[stat].col == col:
popup_format = stat_window.game.stats[stat].popup
break
# get the list of stats to be presented from the config
stat_list = []
for w in stat_window.parent.config.popup_windows.keys():
if w == popup_format:
stat_list = stat_window.parent.config.popup_windows[w].pu_stats
break
# get a database connection
db_connection = Database.Database(stat_window.parent.config, stat_window.parent.db_name, 'temp')
# calculate the stat_dict and then create the text for the pu
# stat_dict = db_connection.get_stats_from_hand(stat_window.parent.hand, stat_window.player_id)
stat_dict = db_connection.get_stats_from_hand(stat_window.parent.hand)
db_connection.close_connection()
pu_text = ""
for s in stat_list:
number = Stats.do_stat(stat_dict, player = int(stat_window.player_id), stat = s)
pu_text += number[3] + "\n"
self.lab.set_text(pu_text)
self.window.show_all()
self.window.set_transient_for(stat_window.main_window)
# set_keep_above(1) for windows
if os.name == 'nt': self.topify_window(self.window)
def button_press_cb(self, widget, event, *args):
# This handles all callbacks from button presses on the event boxes in
# the popup windows. There is a bit of an ugly kludge to separate single-
# and double-clicks. This is the same code as in the Stat_window class
if event.button == 1: # left button event
if event.type == gtk.gdk.BUTTON_PRESS: # left button single click
if self.sb_click > 0: return
self.sb_click = gobject.timeout_add(250, self.single_click, widget)
elif event.type == gtk.gdk._2BUTTON_PRESS: # left button double click
if self.sb_click > 0:
gobject.source_remove(self.sb_click)
self.sb_click = 0
self.double_click(widget, event, *args)
if event.button == 2: # middle button event
pass
# print "middle button clicked"
if event.button == 3: # right button event
pass
# print "right button clicked"
def single_click(self, widget):
# Callback from the timeout in the single-click finding part of the
# button press call back. This needs to be modified to get all the
# arguments from the call.
self.sb_click = 0
self.window.destroy()
return False
def double_click(self, widget, event, *args):
self.toggle_decorated(widget)
def toggle_decorated(self, widget):
top = widget.get_toplevel()
(x, y) = top.get_position()
if top.get_decorated():
top.set_decorated(0)
top.move(x, y)
else:
top.set_decorated(1)
top.move(x, y)
def topify_window(self, window):
"""Set the specified gtk window to stayontop in MS Windows."""
def windowEnumerationHandler(hwnd, resultList):
'''Callback for win32gui.EnumWindows() to generate list of window handles.'''
resultList.append((hwnd, win32gui.GetWindowText(hwnd)))
unique_name = 'unique name for finding this window'
real_name = window.get_title()
window.set_title(unique_name)
tl_windows = []
win32gui.EnumWindows(windowEnumerationHandler, tl_windows)
for w in tl_windows:
if w[1] == unique_name:
# win32gui.ShowWindow(w[0], win32con.SW_HIDE)
# style = win32gui.GetWindowLong(w[0], win32con.GWL_EXSTYLE)
# style |= win32con.WS_EX_TOOLWINDOW
# style &= ~win32con.WS_EX_APPWINDOW
# win32gui.SetWindowLong(w[0], win32con.GWL_EXSTYLE, style)
# win32gui.ShowWindow(w[0], win32con.SW_SHOW)
win32gui.SetWindowPos(w[0], win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE|win32con.SWP_NOSIZE)
# notify_id = (w[0],
# 0,
# win32gui.NIF_ICON | win32gui.NIF_MESSAGE | win32gui.NIF_TIP,
# win32con.WM_USER+20,
# 0,
# '')
# win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, notify_id)
#
window.set_title(real_name)
if __name__== "__main__":
main_window = gtk.Window()
main_window.connect("destroy", destroy)
label = gtk.Label('Fake main window, blah blah, blah\nblah, blah')
main_window.add(label)
main_window.show_all()
c = Configuration.Config()
#tables = Tables.discover(c)
t = Tables.discover_table_by_name(c, "Chelsea")
if t is None:
print "Table not found."
db = Database.Database(c, 'fpdb', 'holdem')
# for t in tables:
win = Hud(t, 10, 'holdem', c, db)
win.create(1, c)
# t.get_details()
win.update(8300, db, c)
gtk.main()

243
pyfpdb/Mucked.py Normal file
View File

@ -0,0 +1,243 @@
#!/usr/bin/env python
"""Mucked.py
Mucked cards display for FreePokerTools HUD.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# to do
# problem with hand 30586
# Standard Library modules
import sys
import os
import string
import xml.dom.minidom
from xml.dom.minidom import Node
# pyGTK modules
import pygtk
import gtk
import gobject
# FreePokerTools modules
import Configuration
import Database
import Tables
import Hud
import Mucked
import HandHistory
class Mucked:
def __init__(self, parent, db_connection):
self.parent = parent #this is the parent of the mucked cards widget
self.db_connection = db_connection
self.vbox = gtk.VBox()
self.parent.add(self.vbox)
self.mucked_list = MuckedList (self.vbox, db_connection)
self.mucked_cards = MuckedCards(self.vbox, db_connection)
self.mucked_list.mucked_cards = self.mucked_cards
def update(self, new_hand_id):
self.mucked_list.update(new_hand_id)
class MuckedList:
def __init__(self, parent, db_connection):
self.parent = parent
self.db_connection = db_connection
# set up a scrolled window to hold the listbox
self.scrolled_window = gtk.ScrolledWindow()
self.scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.parent.add(self.scrolled_window)
# create a ListStore to use as the model
self.liststore = gtk.ListStore(str, str, str)
self.treeview = gtk.TreeView(self.liststore)
self.tvcolumn0 = gtk.TreeViewColumn('HandID')
self.tvcolumn1 = gtk.TreeViewColumn('Cards')
self.tvcolumn2 = gtk.TreeViewColumn('Net')
# add tvcolumn to treeview
self.treeview.append_column(self.tvcolumn0)
self.treeview.append_column(self.tvcolumn1)
self.treeview.append_column(self.tvcolumn2)
# create a CellRendererText to render the data
self.cell = gtk.CellRendererText()
# add the cell to the tvcolumn and allow it to expand
self.tvcolumn0.pack_start(self.cell, True)
self.tvcolumn1.pack_start(self.cell, True)
self.tvcolumn2.pack_start(self.cell, True)
self.tvcolumn0.add_attribute(self.cell, 'text', 0)
self.tvcolumn1.add_attribute(self.cell, 'text', 1)
self.tvcolumn2.add_attribute(self.cell, 'text', 2)
# resize the cols if nec
self.tvcolumn0.set_resizable(True)
self.treeview.connect("row-activated", self.activated_event)
self.scrolled_window.add_with_viewport(self.treeview)
def activated_event(self, path, column, data=None):
sel = self.treeview.get_selection()
(model, iter) = sel.get_selected()
self.mucked_cards.update(model.get_value(iter, 0))
def update(self, new_hand_id):
# info_row = self.db_connection.get_hand_info(new_hand_id)
info_row = ((new_hand_id, "xxxx", 0), )
iter = self.liststore.append(info_row[0])
sel = self.treeview.get_selection()
sel.select_iter(iter)
vadj = self.scrolled_window.get_vadjustment()
vadj.set_value(vadj.upper)
self.mucked_cards.update(new_hand_id)
class MuckedCards:
def __init__(self, parent, db_connection):
self.parent = parent #this is the parent of the mucked cards widget
self.db_connection = db_connection
self.card_images = self.get_card_images()
self.seen_cards = {}
self.grid_contents = {}
self.eb = {}
self.rows = 8
self.cols = 7
self.grid = gtk.Table(self.rows, self.cols + 4, homogeneous = False)
for r in range(0, self.rows):
for c in range(0, self.cols):
self.seen_cards[(c, r)] = gtk.image_new_from_pixbuf(self.card_images[('B', 'S')])
self.eb[(c, r)]= gtk.EventBox()
# set up the contents for the cells
for r in range(0, self.rows):
self.grid_contents[( 0, r)] = gtk.Label("%d" % (r + 1))
self.grid_contents[( 1, r)] = gtk.Label("player %d" % (r + 1))
self.grid_contents[( 4, r)] = gtk.Label("-")
self.grid_contents[( 9, r)] = gtk.Label("-")
self.grid_contents[( 2, r)] = self.eb[( 0, r)]
self.grid_contents[( 3, r)] = self.eb[( 1, r)]
self.grid_contents[( 5, r)] = self.eb[( 2, r)]
self.grid_contents[( 6, r)] = self.eb[( 3, r)]
self.grid_contents[( 7, r)] = self.eb[( 4, r)]
self.grid_contents[( 8, r)] = self.eb[( 5, r)]
self.grid_contents[(10, r)] = self.eb[( 6, r)]
for c in range(0, self.cols):
self.eb[(c, r)].add(self.seen_cards[(c, r)])
# add the cell contents to the table
for c in range(0, self.cols + 4):
for r in range(0, self.rows):
self.grid.attach(self.grid_contents[(c, r)], c, c+1, r, r+1, xpadding = 1, ypadding = 1)
self.parent.add(self.grid)
def translate_cards(self, old_cards):
pass
def update(self, new_hand_id):
cards = self.db_connection.get_cards(new_hand_id)
self.clear()
cards = self.translate_cards(cards)
for c in cards.keys():
self.grid_contents[(1, cards[c]['seat_number'] - 1)].set_text(cards[c]['screen_name'])
for i in ((0, 'hole_card_1'), (1, 'hole_card_2'), (2, 'hole_card_3'), (3, 'hole_card_4'),
(4, 'hole_card_5'), (5, 'hole_card_6'), (6, 'hole_card_7')):
if not cards[c][i[1]] == "":
self.seen_cards[(i[0], cards[c]['seat_number'] - 1)]. \
set_from_pixbuf(self.card_images[self.split_cards(cards[c][i[1]])])
xml_text = self.db_connection.get_xml(new_hand_id)
hh = HandHistory.HandHistory(xml_text, ('BETTING'))
# action in tool tips for 3rd street cards
tip = "%s" % hh.BETTING.rounds[0]
for c in (0, 1, 2):
for r in range(0, self.rows):
self.eb[(c, r)].set_tooltip_text(tip)
# action in tools tips for later streets
round_to_col = (0, 3, 4, 5, 6)
for round in range(1, len(hh.BETTING.rounds)):
tip = "%s" % hh.BETTING.rounds[round]
for r in range(0, self.rows):
self.eb[(round_to_col[round], r)].set_tooltip_text(tip)
def split_cards(self, card):
return (card[0], card[1].upper())
def clear(self):
for r in range(0, self.rows):
self.grid_contents[(1, r)].set_text(" ")
for c in range(0, 7):
self.seen_cards[(c, r)].set_from_pixbuf(self.card_images[('B', 'S')])
self.eb[(c, r)].set_tooltip_text('')
def get_card_images(self):
card_images = {}
suits = ('S', 'H', 'D', 'C')
ranks = ('A', 'K', 'Q', 'J', 'T', '9', '8', '7', '6', '5', '4', '3', '2', 'B')
pb = gtk.gdk.pixbuf_new_from_file("Cards01.png")
for j in range(0, 14):
for i in range(0, 4):
temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(), 30, 42)
pb.copy_area(30*j, 42*i, 30, 42, temp_pb, 0, 0)
card_images[(ranks[j], suits[i])] = temp_pb
return(card_images)
# cards are 30 wide x 42 high
if __name__== "__main__":
def destroy(*args): # call back for terminating the main eventloop
gtk.main_quit() # used only for testing
def process_new_hand(source, condition): #callback from stdin watch -- testing only
# there is a new hand_id to be processed
# just read it and pass it to update
new_hand_id = sys.stdin.readline()
new_hand_id = new_hand_id.rstrip() # remove trailing whitespace
m.update(new_hand_id)
return(True)
config = Configuration.Config()
db_connection = Database.Database(config, 'fpdb', '')
main_window = gtk.Window()
main_window.set_keep_above(True)
main_window.connect("destroy", destroy)
m = Mucked(main_window, db_connection)
main_window.show_all()
s_id = gobject.io_add_watch(sys.stdin, gobject.IO_IN, process_new_hand)
gtk.main()

87
pyfpdb/RegressionTest.py Normal file
View File

@ -0,0 +1,87 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
############################################################################
#
# File for Regression Testing fpdb
#
import os
import sys
import fpdb_db
import fpdb_import
import FpdbSQLQueries
import unittest
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
"""Configure MySQL settings/database and establish connection"""
self.mysql_settings={ 'db-host':"localhost",
'db-backend':2,
'db-databaseName':"fpdbtest",
'db-user':"fpdb",
'db-password':"fpdb"}
self.mysql_db = fpdb_db.fpdb_db()
self.mysql_db.connect(self.mysql_settings['db-backend'], self.mysql_settings['db-host'],
self.mysql_settings['db-databaseName'], self.mysql_settings['db-user'],
self.mysql_settings['db-password'])
self.mysqldict = FpdbSQLQueries.FpdbSQLQueries('MySQL InnoDB')
self.mysqlimporter = fpdb_import.Importer(self, self.mysql_settings)
# """Configure Postgres settings/database and establish connection"""
# self.pg_settings={ 'db-host':"localhost", 'db-backend':3, 'db-databaseName':"fpdbtest", 'db-user':"fpdb", 'db-password':"fpdb"}
# self.pg_db = fpdb_db.fpdb_db()
# self.pg_db.connect(self.pg_settings['db-backend'], self.pg_settings['db-host'],
# self.pg_settings['db-databaseName'], self.pg_settings['db-user'],
# self.pg_settings['db-password'])
# self.pgdict = FpdbSQLQueries.FpdbSQLQueries('PostgreSQL')
def testDatabaseConnection(self):
"""Test all supported DBs"""
self.result = self.mysql_db.cursor.execute(self.mysqldict.query['list_tables'])
self.failUnless(self.result==13, "Number of tables in database incorrect. Expected 13 got " + str(self.result))
# self.result = self.pg_db.cursor.execute(self.pgdict.query['list_tables'])
# self.failUnless(self.result==13, "Number of tables in database incorrect. Expected 13 got " + str(self.result))
def testMySQLRecreateTables(self):
"""Test droping then recreating fpdb table schema"""
self.mysql_db.recreate_tables()
self.result = self.mysql_db.cursor.execute("SHOW TABLES")
self.failUnless(self.result==13, "Number of tables in database incorrect. Expected 13 got " + str(self.result))
def testImportHandHistoryFiles(self):
"""Test import of single HH file"""
self.mysqlimporter.addImportFile("regression-test-files/hand-histories/ps-lhe-ring-3hands.txt")
self.mysqlimporter.runImport()
self.mysqlimporter.addImportDirectory("regression-test-files/hand-histories")
self.mysqlimporter.runImport()
# def testPostgresSQLRecreateTables(self):
# """Test droping then recreating fpdb table schema"""
# self.pg_db.recreate_tables()
# self.result = self.pg_db.cursor.execute(self.pgdict.query['list_tables'])
# self.failUnless(self.result==13, "Number of tables in database incorrect. Expected 13 got " + str(self.result))
if __name__ == '__main__':
unittest.main()

298
pyfpdb/SQL.py Normal file
View File

@ -0,0 +1,298 @@
#!/usr/bin/env python
"""SQL.py
Set up all of the SQL statements for a given game and database type.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# Standard Library modules
# pyGTK modules
# FreePokerTools modules
class Sql:
def __init__(self, game = 'holdem', type = 'PT3'):
self.query = {}
############################################################################
#
# Support for the ptracks database, a cut down PT2 stud database.
# You can safely ignore this unless you are me.
#
if game == 'razz' and type == 'ptracks':
self.query['get_table_name'] = "select table_name from game where game_id = %s"
self.query['get_last_hand'] = "select max(game_id) from game"
self.query['get_recent_hands'] = "select game_id from game where game_id > %(last_hand)d"
self.query['get_xml'] = "select xml from hand_history where game_id = %s"
self.query['get_player_id'] = """
select player_id from players
where screen_name = %(player)s
"""
self.query['get_hand_info'] = """
SELECT
game_id,
CONCAT(hole_card_1, hole_card_2, hole_card_3, hole_card_4, hole_card_5, hole_card_6, hole_card_7) AS hand,
total_won-total_bet AS net
FROM game_players
WHERE game_id = %s AND player_id = 3
"""
self.query['get_cards'] = """
select
seat_number,
screen_name,
hole_card_1,
hole_card_2,
hole_card_3,
hole_card_4,
hole_card_5,
hole_card_6,
hole_card_7
from game_players, players
where game_id = %s and game_players.player_id = players.player_id
order by seat_number
"""
self.query['get_stats_from_hand'] = """
SELECT player_id,
count(*) AS n,
sum(pre_fourth_raise_n) AS pfr,
sum(fourth_raise_n) AS raise_n_2,
sum(fourth_ck_raise_n) AS cr_n_2,
sum(fifth_bet_raise_n) AS br_n_3,
sum(fifth_bet_ck_raise_n) AS cr_n_3,
sum(sixth_bet_raise_n) AS br_n_4,
sum(sixth_bet_ck_raise_n) AS cr_n_4,
sum(river_bet_raise_n) AS br_n_5,
sum(river_bet_ck_raise_n) AS cr_n_5,
sum(went_to_showdown_n) AS sd,
sum(saw_fourth_n) AS saw_f,
sum(raised_first_pf) AS first_pfr,
sum(vol_put_money_in_pot) AS vpip,
sum(limp_with_prev_callers) AS limp_w_callers,
sum(ppossible_actions) AS poss_a_pf,
sum(pfold) AS fold_pf,
sum(pcheck) AS check_pf,
sum(praise) AS raise_pf,
sum(pcall) AS raise_pf,
sum(limp_call_reraise_pf) AS limp_call_pf,
sum(pfr_check) AS check_after_raise,
sum(pfr_call) AS call_after_raise,
sum(pfr_fold) AS fold_after_raise,
sum(pfr_bet) AS bet_after_raise,
sum(pfr_raise) AS raise_after_raise,
sum(folded_to_river_bet) AS fold_to_r_bet,
sum(fpossible_actions) AS poss_a_2,
sum(ffold) AS fold_2,
sum(fcheck) AS check_2,
sum(fbet) AS bet_2,
sum(fraise) AS raise_2,
sum(fcall) AS raise_2,
sum(fifpossible_actions) AS poss_a_3,
sum(fiffold) AS fold_3,
sum(fifcheck) AS check_3,
sum(fifbet) AS bet_3,
sum(fifraise) AS raise_3,
sum(fifcall) AS call_3,
sum(spossible_actions) AS poss_a_4,
sum(sfold) AS fold_4,
sum(scheck) AS check_4,
sum(sbet) AS bet_4,
sum(sraise) AS raise_4,
sum(scall) AS call_4,
sum(rpossible_actions) AS poss_a_5,
sum(rfold) AS fold_5,
sum(rcheck) AS check_5,
sum(rbet) AS bet_5,
sum(rraise) AS raise_5,
sum(rcall) AS call_5,
sum(cold_call_pf) AS cc_pf,
sum(saw_fifth_n) AS saw_3,
sum(saw_sixth_n) AS saw_4,
sum(saw_river_n) AS saw_5
FROM game_players
WHERE player_id in
(SELECT player_id FROM game_players
WHERE game_id = %s AND NOT player_id = %s)
GROUP BY player_id
"""
# alternate form of WHERE for above
# WHERE game_id = %(hand)d AND NOT player_id = %(hero)d)
# WHERE game_id = %s AND NOT player_id = %s)
self.query['get_players_from_hand'] = """
SELECT game_players.player_id, seat_number, screen_name
FROM game_players INNER JOIN players ON (game_players.player_id = players.player_id)
WHERE game_id = %s
"""
###############################################################################3
# Support for the Free Poker DataBase = fpdb http://fpdb.sourceforge.net/
#
if type == 'fpdb':
self.query['get_last_hand'] = "select max(id) from Hands"
self.query['get_player_id'] = """
select Players.id AS player_id from Players, Sites
where Players.name = %(player)s
and Sites.name = %(site)s
and Players.SiteId = Sites.id
"""
self.query['get_stats_from_hand'] = """
SELECT HudCache.playerId AS player_id,
sum(HDs) AS n,
sum(street0VPI) AS vpip,
sum(street0Aggr) AS pfr,
sum(street0_3B4BChance) AS TB_opp_0,
sum(street0_3B4BDone) AS TB_0,
sum(street1Seen) AS saw_f,
sum(street1Seen) AS saw_1,
sum(street2Seen) AS saw_2,
sum(street3Seen) AS saw_3,
sum(street4Seen) AS saw_4,
sum(sawShowdown) AS sd,
sum(street1Aggr) AS aggr_1,
sum(street2Aggr) AS aggr_2,
sum(street3Aggr) AS aggr_3,
sum(street4Aggr) AS aggr_4,
sum(otherRaisedStreet1) AS was_raised_1,
sum(otherRaisedStreet2) AS was_raised_2,
sum(otherRaisedStreet3) AS was_raised_3,
sum(otherRaisedStreet4) AS was_raised_4,
sum(foldToOtherRaisedStreet1) AS f_freq_1,
sum(foldToOtherRaisedStreet2) AS f_freq_2,
sum(foldToOtherRaisedStreet3) AS f_freq_3,
sum(foldToOtherRaisedStreet4) AS f_freq_4,
sum(wonWhenSeenStreet1) AS w_w_s_1,
sum(wonAtSD) AS wmsd,
sum(stealAttemptChance) AS steal_opp,
sum(stealAttempted) AS steal,
sum(foldSbToStealChance) AS SBstolen,
sum(foldedSbToSteal) AS SBnotDef,
sum(foldBbToStealChance) AS BBstolen,
sum(foldedBbToSteal) AS BBnotDef,
sum(street1CBChance) AS CB_opp_1,
sum(street1CBDone) AS CB_1,
sum(street2CBChance) AS CB_opp_2,
sum(street2CBDone) AS CB_2,
sum(street3CBChance) AS CB_opp_3,
sum(street3CBDone) AS CB_3,
sum(street4CBChance) AS CB_opp_4,
sum(street4CBDone) AS CB_4,
sum(foldToStreet1CBChance) AS f_cb_opp_1,
sum(foldToStreet1CBDone) AS f_cb_1,
sum(foldToStreet2CBChance) AS f_cb_opp_2,
sum(foldToStreet2CBDone) AS f_cb_2,
sum(foldToStreet3CBChance) AS f_cb_opp_3,
sum(foldToStreet3CBDone) AS f_cb_3,
sum(foldToStreet4CBChance) AS f_cb_opp_4,
sum(foldToStreet4CBDone) AS f_cb_4,
sum(totalProfit) AS net,
sum(street1CheckCallRaiseChance) AS ccr_opp_1,
sum(street1CheckCallRaiseDone) AS ccr_1,
sum(street2CheckCallRaiseChance) AS ccr_opp_2,
sum(street2CheckCallRaiseDone) AS ccr_2,
sum(street3CheckCallRaiseChance) AS ccr_opp_3,
sum(street3CheckCallRaiseDone) AS ccr_3,
sum(street4CheckCallRaiseChance) AS ccr_opp_4,
sum(street4CheckCallRaiseDone) AS ccr_4
FROM HudCache, Hands
WHERE HudCache.PlayerId in
(SELECT PlayerId FROM HandsPlayers
WHERE handId = %s)
AND Hands.id = %s
AND Hands.gametypeId = HudCache.gametypeId
GROUP BY HudCache.PlayerId
"""
# AND PlayerId LIKE %s
# HudCache.gametypeId AS gametypeId,
# activeSeats AS n_active,
# position AS position,
# HudCache.tourneyTypeId AS tourneyTypeId,
self.query['get_players_from_hand'] = """
SELECT HandsPlayers.playerId, seatNo, name
FROM HandsPlayers INNER JOIN Players ON (HandsPlayers.playerId = Players.id)
WHERE handId = %s
"""
# WHERE handId = %s AND Players.id LIKE %s
self.query['get_table_name'] = """
select tableName, maxSeats, category
from Hands,Gametypes
where Hands.id = %s
and Gametypes.id = Hands.gametypeId
"""
self.query['get_actual_seat'] = """
select seatNo
from HandsPlayers
where HandsPlayers.handId = %s
and HandsPlayers.playerId = (select Players.id from Players
where Players.name = %s)
"""
self.query['get_cards'] = """
select
seatNo AS seat_number,
name AS screen_name,
card1Value, card1Suit,
card2Value, card2Suit,
card3Value, card3Suit,
card4Value, card4Suit,
card5Value, card5Suit,
card6Value, card6Suit,
card7Value, card7Suit
from HandsPlayers, Players
where handID = %s and HandsPlayers.playerId = Players.id
order by seatNo
"""
# self.query['get_hand_info'] = """
# SELECT
# game_id,
# CONCAT(hole_card_1, hole_card_2, hole_card_3, hole_card_4, hole_card_5, hole_card_6, hole_card_7) AS hand,
# total_won-total_bet AS net
# FROM game_players
# WHERE game_id = %s AND player_id = 3
# """
if __name__== "__main__":
# just print the default queries and exit
s = Sql(game = 'razz', type = 'ptracks')
for key in s.query:
print "For query " + key + ", sql ="
print s.query[key]

628
pyfpdb/Stats.py Normal file
View File

@ -0,0 +1,628 @@
#!/usr/bin/env python
"""Manage collecting and formatting of stats and tooltips.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# How to write a new stat:
# 1 You can see a listing of all the raw stats (e.g., from the HudCache table)
# by running Database.py as a stand along program. You need to combine
# those raw stats to get stats to present to the HUD. If you need more
# information than is in the HudCache table, then you have to write SQL.
# 2 The raw stats seen when you run Database.py are available in the Stats.py
# in the stat_dict dict. For example the number of vpips would be
# stat_dict[player]['vpip']. So the % vpip is
# float(stat_dict[player]['vpip'])/float(stat_dict[player]['n']). You can see how the
# keys of stat_dict relate to the column names in HudCache by inspecting
# the proper section of the SQL.py module.
# 3 You have to write a small function for each stat you want to add. See
# the vpip() function for example. This function has to be protected from
# exceptions, using something like the try:/except: paragraphs in vpip.
# 4 The name of the function has to be the same as the of the stat used
# in the config file.
# 5 The stat functions have a peculiar return value, which is outlined in
# the do_stat function. This format is useful for tool tips and maybe
# other stuff.
# 6 For each stat you make add a line to the __main__ function to test it.
# Standard Library modules
#import sys
# pyGTK modules
import pygtk
import gtk
# FreePokerTools modules
import Configuration
import Database
def do_tip(widget, tip):
widget.set_tooltip_text(tip)
def do_stat(stat_dict, player = 24, stat = 'vpip'):
return eval("%(stat)s(stat_dict, %(player)d)" % {'stat': stat, 'player': player})
# OK, for reference the tuple returned by the stat is:
# 0 - The stat, raw, no formating, eg 0.33333333
# 1 - formatted stat with appropriate precision and punctuation, eg 33%
# 2 - formatted stat with appropriate precision, punctuation and a hint, eg v=33%
# 3 - same as #2 except name of stat instead of hint, eg vpip=33%
# 4 - the calculation that got the stat, eg 9/27
# 5 - the name of the stat, useful for a tooltip, eg vpip
###########################################
# functions that return individual stats
def playername(stat_dict, player):
return (stat_dict[player]['screen_name'],
stat_dict[player]['screen_name'],
stat_dict[player]['screen_name'],
stat_dict[player]['screen_name'],
stat_dict[player]['screen_name'],
stat_dict[player]['screen_name'])
def vpip(stat_dict, player):
""" Voluntarily put $ in the pot."""
stat = 0.0
try:
stat = float(stat_dict[player]['vpip'])/float(stat_dict[player]['n'])
return (stat,
'%3.1f' % (100*stat) + '%',
'v=%3.1f' % (100*stat) + '%',
'vpip=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['vpip'], stat_dict[player]['n']),
'vpip'
)
except: return (stat,
'%3.1f' % (0) + '%',
'w=%3.1f' % (0) + '%',
'wtsd=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'wtsd'
)
def pfr(stat_dict, player):
""" Preflop (3rd street) raise."""
stat = 0.0
try:
stat = float(stat_dict[player]['pfr'])/float(stat_dict[player]['n'])
return (stat,
'%3.1f' % (100*stat) + '%',
'p=%3.1f' % (100*stat) + '%',
'pfr=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['pfr'], stat_dict[player]['n']),
'pfr'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'p=%3.1f' % (0) + '%',
'pfr=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'pfr'
)
def wtsd(stat_dict, player):
""" Went to SD when saw flop/4th."""
stat = 0.0
try:
stat = float(stat_dict[player]['sd'])/float(stat_dict[player]['saw_f'])
return (stat,
'%3.1f' % (100*stat) + '%',
'w=%3.1f' % (100*stat) + '%',
'wtsd=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['sd'], stat_dict[player]['saw_f']),
'% went to showdown'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'w=%3.1f' % (0) + '%',
'wtsd=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% went to showdown'
)
def wmsd(stat_dict, player):
""" Won $ at showdown."""
stat = 0.0
try:
stat = float(stat_dict[player]['wmsd'])/float(stat_dict[player]['sd'])
return (stat,
'%3.1f' % (100*stat) + '%',
'w=%3.1f' % (100*stat) + '%',
'wmsd=%3.1f' % (100*stat) + '%',
'(%f5.0/%d)' % (stat_dict[player]['wmsd'], stat_dict[player]['sd']),
'% won money at showdown'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'w=%3.1f' % (0) + '%',
'wmsd=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% won money at showdown'
)
def saw_f(stat_dict, player):
""" Saw flop/4th."""
try:
num = float(stat_dict[player]['saw_f'])
den = float(stat_dict[player]['n'])
stat = num/den
return (stat,
'%3.1f' % (100*stat) + '%',
'sf=%3.1f' % (100*stat) + '%',
'saw_f=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['saw_f'], stat_dict[player]['n']),
'saw_f'
)
except:
stat = 0.0
num = 0
den = 0
return (stat,
'%3.1f' % (stat) + '%',
'sf=%3.1f' % (stat) + '%',
'saw_f=%3.1f' % (stat) + '%',
'(%d/%d)' % (num, den),
'saw_f'
)
def n(stat_dict, player):
""" Number of hands played."""
try:
return (stat_dict[player]['n'],
'%d' % (stat_dict[player]['n']),
'n=%d' % (stat_dict[player]['n']),
'n=%d' % (stat_dict[player]['n']),
'(%d)' % (stat_dict[player]['n']),
'number hands seen'
)
except:
return (0,
'%d' % (0),
'n=%d' % (0),
'n=%d' % (0),
'(%d)' % (0),
'number hands seen'
)
def fold_f(stat_dict, player):
""" Folded flop/4th."""
stat = 0.0
try:
stat = float(stat_dict[player]['fold_2'])/fold(stat_dict[player]['saw_f'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff=%3.1f' % (100*stat) + '%',
'fold_f=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['fold_2'], stat_dict[player]['saw_f']),
'folded flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff=%3.1f' % (0) + '%',
'fold_f=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'folded flop/4th'
)
def steal(stat_dict, player):
""" Steal %."""
stat = 0.0
try:
stat = float(stat_dict[player]['steal'])/float(stat_dict[player]['steal_opp'])
return (stat,
'%3.1f' % (100*stat) + '%',
'st=%3.1f' % (100*stat) + '%',
'steal=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['steal'], stat_dict[player]['steal_opp']),
'% steal attempted'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'st=%3.1f' % (0) + '%',
'steal=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% steal attempted'
)
def f_SB_steal(stat_dict, player):
""" Folded SB to steal."""
stat = 0.0
try:
stat = float(stat_dict[player]['SBnotDef'])/float(stat_dict[player]['SBstolen'])
return (stat,
'%3.1f' % (100*stat) + '%',
'fSB=%3.1f' % (100*stat) + '%',
'fSB_s=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['SBnotDef'], stat_dict[player]['SBstolen']),
'% folded SB to steal'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'fSB=%3.1f' % (0) + '%',
'fSB_s=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% folded SB to steal'
)
def f_BB_steal(stat_dict, player):
""" Folded BB to steal."""
stat = 0.0
try:
stat = float(stat_dict[player]['BBnotDef'])/float(stat_dict[player]['BBstolen'])
return (stat,
'%3.1f' % (100*stat) + '%',
'fBB=%3.1f' % (100*stat) + '%',
'fBB_s=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['BBnotDef'], stat_dict[player]['BBstolen']),
'% folded BB to steal'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'fBB=%3.1f' % (0) + '%',
'fBB_s=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% folded BB to steal'
)
def three_B_0(stat_dict, player):
""" Three bet preflop/3rd."""
stat = 0.0
try:
stat = float(stat_dict[player]['TB_0'])/float(stat_dict[player]['TB_opp_0'])
return (stat,
'%3.1f' % (100*stat) + '%',
'3B=%3.1f' % (100*stat) + '%',
'3B_pf=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['TB_0'], stat_dict[player]['TB_opp_0']),
'% 3/4 Bet preflop/3rd'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'3B=%3.1f' % (0) + '%',
'3B_pf=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% 3/4 Bet preflop/3rd'
)
def WMsF(stat_dict, player):
""" Won $ when saw flop/4th."""
stat = 0.0
try:
stat = float(stat_dict[player]['w_w_s_1'])/float(stat_dict[player]['saw_1'])
return (stat,
'%3.1f' % (100*stat) + '%',
'wf=%3.1f' % (100*stat) + '%',
'w_w_f=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['w_w_s_1'], stat_dict[player]['saw_f']),
'% won$/saw flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'wf=%3.1f' % (0) + '%',
'w_w_f=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% won$/saw flop/4th'
)
def a_freq_1(stat_dict, player):
""" Flop/4th aggression frequency."""
stat = 0.0
try:
stat = float(stat_dict[player]['aggr_1'])/float(stat_dict[player]['saw_f'])
return (stat,
'%3.1f' % (100*stat) + '%',
'a1=%3.1f' % (100*stat) + '%',
'a_fq_1=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_1'], stat_dict[player]['saw_f']),
'Aggression Freq flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'a1=%3.1f' % (0) + '%',
'a_fq_1=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'Aggression Freq flop/4th'
)
def a_freq_2(stat_dict, player):
""" Turn/5th aggression frequency."""
stat = 0.0
try:
stat = float(stat_dict[player]['aggr_2'])/float(stat_dict[player]['saw_2'])
return (stat,
'%3.1f' % (100*stat) + '%',
'a2=%3.1f' % (100*stat) + '%',
'a_fq_2=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_2'], stat_dict[player]['saw_2']),
'Aggression Freq turn/5th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'a2=%3.1f' % (0) + '%',
'a_fq_2=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'Aggression Freq turn/5th'
)
def a_freq_3(stat_dict, player):
""" River/6th aggression frequency."""
stat = 0.0
try:
stat = float(stat_dict[player]['aggr_3'])/float(stat_dict[player]['saw_3'])
return (stat,
'%3.1f' % (100*stat) + '%',
'a3=%3.1f' % (100*stat) + '%',
'a_fq_3=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_3'], stat_dict[player]['saw_3']),
'Aggression Freq river/6th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'a3=%3.1f' % (0) + '%',
'a_fq_3=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'Aggression Freq river/6th'
)
def a_freq_4(stat_dict, player):
""" 7th street aggression frequency."""
stat = 0.0
try:
stat = float(stat_dict[player]['aggr_4'])/float(stat_dict[player]['saw_4'])
return (stat,
'%3.1f' % (100*stat) + '%',
'a4=%3.1f' % (100*stat) + '%',
'a_fq_4=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['aggr_4'], stat_dict[player]['saw_4']),
'Aggression Freq 7th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'a4=%3.1f' % (0) + '%',
'a_fq_4=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'Aggression Freq flop/4th'
)
def cb_1(stat_dict, player):
""" Flop continuation bet."""
stat = 0.0
try:
stat = float(stat_dict[player]['CB_1'])/float(stat_dict[player]['CB_opp_1'])
return (stat,
'%3.1f' % (100*stat) + '%',
'cb1=%3.1f' % (100*stat) + '%',
'cb_1=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['CB_1'], stat_dict[player]['CB_opp_1']),
'% continuation bet flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'cb1=%3.1f' % (0) + '%',
'cb_1=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% continuation bet flop/4th'
)
def cb_2(stat_dict, player):
""" Turn continuation bet."""
stat = 0.0
try:
stat = float(stat_dict[player]['CB_2'])/float(stat_dict[player]['CB_opp_2'])
return (stat,
'%3.1f' % (100*stat) + '%',
'cb2=%3.1f' % (100*stat) + '%',
'cb_2=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['CB_2'], stat_dict[player]['CB_opp_2']),
'% continuation bet turn/5th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'cb2=%3.1f' % (0) + '%',
'cb_2=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% continuation bet turn/5th'
)
def cb_3(stat_dict, player):
""" River continuation bet."""
stat = 0.0
try:
stat = float(stat_dict[player]['CB_3'])/float(stat_dict[player]['CB_opp_3'])
return (stat,
'%3.1f' % (100*stat) + '%',
'cb3=%3.1f' % (100*stat) + '%',
'cb_3=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['CB_3'], stat_dict[player]['CB_opp_3']),
'% continuation bet river/6th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'cb3=%3.1f' % (0) + '%',
'cb_3=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% continuation bet river/6th'
)
def cb_4(stat_dict, player):
""" 7th street continuation bet."""
stat = 0.0
try:
stat = float(stat_dict[player]['CB_4'])/float(stat_dict[player]['CB_opp_4'])
return (stat,
'%3.1f' % (100*stat) + '%',
'cb4=%3.1f' % (100*stat) + '%',
'cb_4=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['CB_4'], stat_dict[player]['CB_opp_4']),
'% continuation bet 7th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'cb4=%3.1f' % (0) + '%',
'cb_4=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% continuation bet 7th'
)
def ffreq_1(stat_dict, player):
""" Flop/4th fold frequency."""
stat = 0.0
try:
stat = float(stat_dict[player]['f_freq_1'])/float(stat_dict[player]['was_raised_1'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff1=%3.1f' % (100*stat) + '%',
'ff_1=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['f_freq_1'], stat_dict[player]['was_raised_1']),
'% fold frequency flop/4th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff1=%3.1f' % (0) + '%',
'ff_1=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% fold frequency flop/4th'
)
def ffreq_2(stat_dict, player):
""" Turn/5th fold frequency."""
stat = 0.0
try:
stat = float(stat_dict[player]['f_freq_2'])/float(stat_dict[player]['was_raised_2'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff2=%3.1f' % (100*stat) + '%',
'ff_2=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['f_freq_2'], stat_dict[player]['was_raised_2']),
'% fold frequency turn/5th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff2=%3.1f' % (0) + '%',
'ff_2=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% fold frequency turn/5th'
)
def ffreq_3(stat_dict, player):
""" River/6th fold frequency."""
stat = 0.0
try:
stat = float(stat_dict[player]['f_freq_3'])/float(stat_dict[player]['was_raised_3'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff3=%3.1f' % (100*stat) + '%',
'ff_3=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['f_freq_3'], stat_dict[player]['was_raised_3']),
'% fold frequency river/6th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff3=%3.1f' % (0) + '%',
'ff_3=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% fold frequency river/6th'
)
def ffreq_4(stat_dict, player):
""" 7th fold frequency."""
stat = 0.0
try:
stat = float(stat_dict[player]['f_freq_4'])/float(stat_dict[player]['was_raised_4'])
return (stat,
'%3.1f' % (100*stat) + '%',
'ff4=%3.1f' % (100*stat) + '%',
'ff_4=%3.1f' % (100*stat) + '%',
'(%d/%d)' % (stat_dict[player]['f_freq_4'], stat_dict[player]['was_raised_4']),
'% fold frequency 7th'
)
except:
return (stat,
'%3.1f' % (0) + '%',
'ff4=%3.1f' % (0) + '%',
'ff_4=%3.1f' % (0) + '%',
'(%d/%d)' % (0, 0),
'% fold frequency 7th'
)
if __name__== "__main__":
c = Configuration.Config()
db_connection = Database.Database(c, 'fpdb', 'holdem')
h = db_connection.get_last_hand()
stat_dict = db_connection.get_stats_from_hand(h)
for player in stat_dict.keys():
print "player = ", player, do_stat(stat_dict, player = player, stat = 'vpip')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'pfr')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'wtsd')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'saw_f')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'n')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'fold_f')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'wmsd')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'steal')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_SB_steal')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'f_BB_steal')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'three_B_0')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'WMsF')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_1')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_2')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_3')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'a_freq_4')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb_1')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb_2')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb_3')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'cb_4')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_1')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_2')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_3')
print "player = ", player, do_stat(stat_dict, player = player, stat = 'ffreq_4')
print "\n\nLegal stats:"
for attr in dir():
if attr.startswith('__'): continue
if attr in ("Configuration", "Database", "GInitiallyUnowned", "gtk", "pygtk",
"player", "c", "db_connection", "do_stat", "do_tip", "stat_dict",
"h"): continue
print attr, eval("%s.__doc__" % (attr))
# print " <pu_stat pu_stat_name = \"%s\"> </pu_stat>" % (attr)
db_connection.close

313
pyfpdb/Tables.py Normal file
View File

@ -0,0 +1,313 @@
#!/usr/bin/env python
"""Discover_Tables.py
Inspects the currently open windows and finds those of interest to us--that is
poker table windows from supported sites. Returns a list
of Table_Window objects representing the windows found.
"""
# Copyright 2008, Ray E. Barker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
# Standard Library modules
import os
import sys
import re
# Win32 modules
if os.name == 'nt':
import win32gui
import win32process
import win32api
import win32con
# FreePokerTools modules
import Configuration
class Table_Window:
def __str__(self):
# __str__ method for testing
temp = 'TableWindow object\n'
temp = temp + " name = %s\n site = %s\n number = %s\n title = %s\n" % (self.name, self.site, self.number, self.title)
# temp = temp + " game = %s\n structure = %s\n max = %s\n" % (self.game, self.structure, self.max)
temp = temp + " width = %d\n height = %d\n x = %d\n y = %d\n" % (self.width, self.height, self.x, self.y)
if getattr(self, 'tournament', 0):
temp = temp + " tournament = %d\n table = %d" % (self.tournament, self.table)
return temp
def get_details(table):
table.game = 'razz'
table.max = 8
table.struture = 'limit'
table.tournament = 0
def discover(c):
if os.name == 'posix':
tables = discover_posix(c)
elif os.name == 'nt':
tables = discover_nt(c)
elif os.name == 'mac':
tables = discover_mac(c)
else:
tables = {}
return(tables)
def discover_table_by_name(c, tablename):
if os.name == 'posix':
table = discover_posix_by_name(c, tablename)
elif os.name == 'nt':
table = discover_nt_by_name(c, tablename)
elif os.name == 'mac':
table = discover_mac_by_name(c, tablename)
else:
table = None
return(table)
def discover_posix(c):
""" Poker client table window finder for posix/Linux = XWindows."""
tables = {}
for listing in os.popen('xwininfo -root -tree').readlines():
# xwininfo -root -tree -id 0xnnnnn gets the info on a single window
if re.search('Lobby', listing): continue
if re.search('Instant Hand History', listing): continue
if not re.search('Logged In as ', listing, re.IGNORECASE): continue
if re.search('\"Full Tilt Poker\"', listing): continue # FTP Lobby
for s in c.supported_sites.keys():
if re.search(c.supported_sites[s].table_finder, listing):
mo = re.match('\s+([\dxabcdef]+) (.+):.+ (\d+)x(\d+)\+\d+\+\d+ \+(\d+)\+(\d+)', listing)
if mo.group(2) == '(has no name)': continue
if re.match('[\(\)\d\s]+', mo.group(2)): continue # this is a popup
tw = Table_Window()
tw.site = c.supported_sites[s].site_name
tw.number = int(mo.group(1), 0)
tw.title = mo.group(2)
tw.width = int( mo.group(3) )
tw.height = int( mo.group(4) )
tw.x = int (mo.group(5) )
tw.y = int (mo.group(6) )
tw.title = re.sub('\"', '', tw.title)
# use this eval thingie to call the title bar decoder specified in the config file
eval("%s(tw)" % c.supported_sites[s].decoder)
tables[tw.name] = tw
return tables
def discover_posix_by_name(c, tablename):
tables = discover_posix(c)
for t in tables:
if tables[t].name.find(tablename) > -1:
return tables[t]
return None
#
# The discover_xx functions query the system and report on the poker clients
# currently displayed on the screen. The discover_posix should give you
# some idea how to support other systems.
#
# discover_xx() returns a dict of TableWindow objects--one TableWindow
# object for each poker client table on the screen.
#
# Each TableWindow object must have the following attributes correctly populated:
# tw.site = the site name, e.g. PokerStars, FullTilt. This must match the site
# name specified in the config file.
# tw.number = This is the system id number for the client table window in the
# format that the system presents it.
# tw.title = The full title from the window title bar.
# tw.width, tw.height = The width and height of the window in pixels. This is
# the internal width and height, not including the title bar and
# window borders.
# tw.x, tw.y = The x, y (horizontal, vertical) location of the window relative
# to the top left of the display screen. This also does not include the
# title bar and window borders. To put it another way, this is the
# screen location of (0, 0) in the working window.
def win_enum_handler(hwnd, titles):
titles[hwnd] = win32gui.GetWindowText(hwnd)
def child_enum_handler(hwnd, children):
print hwnd, win32.GetWindowRect(hwnd)
def discover_nt(c):
""" Poker client table window finder for Windows."""
#
# I cannot figure out how to get the inside dimensions of the poker table
# windows. So I just assume all borders are 3 thick and all title bars
# are 29 high. No doubt this will be off when used with certain themes.
#
b_width = 3
tb_height = 29
titles = {}
tables = {}
win32gui.EnumWindows(win_enum_handler, titles)
for hwnd in titles.keys():
if re.search('Logged In as', titles[hwnd], re.IGNORECASE) and not re.search('Lobby', titles[hwnd]):
if re.search('Full Tilt Poker', titles[hwnd]):
continue
tw = Table_Window()
tw.number = hwnd
(x, y, width, height) = win32gui.GetWindowRect(hwnd)
tw.title = titles[hwnd]
tw.width = int( width ) - 2*b_width
tw.height = int( height ) - b_width - tb_height
tw.x = int( x ) + b_width
tw.y = int( y ) + tb_height
if re.search('Logged In as', titles[hwnd]):
tw.site = "PokerStars"
elif re.search('Logged In As', titles[hwnd]): #wait, what??!
tw.site = "Full Tilt"
else:
tw.site = "Unknown"
sys.stderr.write("Found unknown table = %s" % tw.title)
if not tw.site == "Unknown":
eval("%s(tw)" % c.supported_sites[tw.site].decoder)
else:
tw.name = "Unknown"
tables[len(tables)] = tw
return tables
def discover_nt_by_name(c, tablename):
# this is pretty much identical to the 'search all windows for all poker sites' code, but made to dig just for a specific table name
# it could be implemented a bunch better - and we need to not assume the width/height thing that (steffen?) assumed above, we should
# be able to dig up the window's titlebar handle and get it's information, and such .. but.. for now, i guess this will work.
# - eric
b_width = 3
tb_height = 29
titles = {}
# tables = discover_nt(c)
win32gui.EnumWindows(win_enum_handler, titles)
for s in c.supported_sites.keys():
for hwnd in titles.keys():
processid = win32process.GetWindowThreadProcessId(hwnd)
pshandle = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION | win32con.PROCESS_VM_READ, False, processid[1])
exe = win32process.GetModuleFileNameEx(pshandle, 0)
if exe.find(c.supported_sites[s].table_finder) == -1:
continue
if titles[hwnd].find(tablename) > -1:
if titles[hwnd].find("History for table:") > -1 or titles[hwnd].find("FPDBHUD") > -1:
continue
tw = Table_Window()
tw.number = hwnd
(x, y, width, height) = win32gui.GetWindowRect(hwnd)
tw.title = titles[hwnd]
tw.width = int(width) - 2 * b_width
tw.height = int(height) - b_width - tb_height
tw.x = int(x) + b_width
tw.y = int(y) + tb_height
tw.site = c.supported_sites[s].site_name
if not tw.site == "Unknown" and not c.supported_sites[tw.site].decoder == "Unknown":
eval("%s(tw)" % c.supported_sites[tw.site].decoder)
else:
tw.name = tablename
return tw
# if we don't find anything by process name, let's search one more time, and call it Unknown ?
for hwnd in titles.keys():
if titles[hwnd].find(tablename) > -1:
if titles[hwnd].find("History for table:") > -1 or titles[hwnd].find("FPDBHUD") > -1:
continue
tw = Table_Window()
tw.number = hwnd
(x, y, width, height) = win32gui.GetWindowRect(hwnd)
tw.title = titles[hwnd]
tw.width = int(width) - 2 * b_width
tw.height = int(height) - b_width - tb_height
tw.x = int(x) + b_width
tw.y = int(y) + tb_height
tw.site = "Unknown"
tw.name = tablename
return tw
return None
def discover_mac(c):
""" Poker client table window finder for Macintosh."""
tables = {}
return tables
def discover_mac_by_name(c, tablename):
# again, i have no mac to test this on, sorry -eric
return discover_mac(c)
def pokerstars_decode_table(tw):
# extract the table name OR the tournament number and table name from the title
# other info in title is redundant with data in the database
title_bits = re.split(' - ', tw.title)
name = title_bits[0]
mo = re.search('Tournament (\d+) Table (\d+)', name)
if mo:
tw.tournament = int( mo.group(1) )
tw.table = int( mo.group(2) )
tw.name = name
else:
tw.tournament = None
for pattern in [' no all-in', ' fast', ',', ' 50BB min']:
name = re.sub(pattern, '', name)
name = re.sub('\s+$', '', name)
tw.name = name
mo = re.search('(Razz|Stud H/L|Stud|Omaha H/L|Omaha|Hold\'em|5-Card Draw|Triple Draw 2-7 Lowball)', tw.title)
tw.game = mo.group(1).lower()
tw.game = re.sub('\'', '', tw.game)
tw.game = re.sub('h/l', 'hi/lo', tw.game)
mo = re.search('(No Limit|Pot Limit)', tw.title)
if mo:
tw.structure = mo.group(1).lower()
else:
tw.structure = 'limit'
tw.max = None
if tw.game in ('razz', 'stud', 'stud hi/lo'):
tw.max = 8
elif tw.game in ('5-card draw', 'triple draw 2-7 lowball'):
tw.max = 6
elif tw.game == 'holdem':
pass
elif tw.game in ('omaha', 'omaha hi/lo'):
pass
def fulltilt_decode_table(tw):
# extract the table name OR the tournament number and table name from the title
# other info in title is redundant with data in the database
title_bits = re.split(' - ', tw.title)
name = title_bits[0]
tw.tournament = None
for pattern in [' (6 max)', ' (heads up)', ' (deep)',
' (deep hu)', ' (deep 6)', ' (2)',
' (edu)', ' (edu, 6 max)', ' (6)' ]:
name = re.sub(pattern, '', name)
# (tw.name, trash) = name.split(r' (', 1)
tw.name = name.rstrip()
if __name__=="__main__":
c = Configuration.Config()
print discover_table_by_name(c, "Catacaos")
tables = discover(c)
for t in tables.keys():
print "t = ", t
print tables[t]
print "press enter to continue"
sys.stdin.readline()

449
pyfpdb/fpdb.py Executable file
View File

@ -0,0 +1,449 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import os
import sys
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-x", "--errorsToConsole", action="store_true",
help="If passed error output will go to the console rather than .")
(options, sys.argv) = parser.parse_args()
if not options.errorsToConsole:
print "Note: error output is being diverted to fpdb-error-log.txt and HUD-error.txt. Any major error will be reported there _only_."
errorFile = open('fpdb-error-log.txt', 'w', 0)
sys.stderr = errorFile
import pygtk
pygtk.require('2.0')
import gtk
import fpdb_db
import fpdb_simple
import GuiBulkImport
import GuiTableViewer
import GuiAutoImport
import GuiGraphViewer
import FpdbSQLQueries
import Configuration
class fpdb:
def tab_clicked(self, widget, tab_name):
"""called when a tab button is clicked to activate that tab"""
#print "start of tab_clicked"
self.display_tab(tab_name)
#end def tab_clicked
def add_and_display_tab(self, new_tab, new_tab_name):
"""just calls the component methods"""
self.add_tab(new_tab, new_tab_name)
self.display_tab(new_tab_name)
#end def add_and_display_tab
def add_tab(self, new_tab, new_tab_name):
"""adds a tab, namely creates the button and displays it and appends all the relevant arrays"""
#print "start of add_tab"
for i in self.tab_names: #todo: check this is valid
if i==new_tab_name:
raise fpdb_simple.FpdbError("duplicate tab_name not permitted")
self.tabs.append(new_tab)
self.tab_names.append(new_tab_name)
new_tab_sel_button=gtk.ToggleButton(new_tab_name)
new_tab_sel_button.connect("clicked", self.tab_clicked, new_tab_name)
self.tab_box.add(new_tab_sel_button)
new_tab_sel_button.show()
self.tab_buttons.append(new_tab_sel_button)
#end def add_tab
def display_tab(self, new_tab_name):
"""displays the indicated tab"""
#print "start of display_tab, len(self.tab_names):",len(self.tab_names)
tab_no=-1
#if len(self.tab_names)>1:
for i in range(len(self.tab_names)):
#print "display_tab, new_tab_name:",new_tab_name," self.tab_names[i]:", self.tab_names[i]
if (new_tab_name==self.tab_names[i]):
tab_no=i
#self.tab_buttons[i].set_active(False)
#else:
# tab_no=0
#current_tab_no=-1
for i in range(len(self.tab_names)):
if self.current_tab==self.tabs[i]:
#self.tab_buttons[i].set_active(False)
pass
if tab_no==-1:
raise fpdb_simple.FpdbError("invalid tab_no")
else:
self.main_vbox.remove(self.current_tab)
#self.current_tab.destroy()
self.current_tab=self.tabs[tab_no]
self.main_vbox.add(self.current_tab)
self.tab_buttons[tab_no].set_active(True)
self.current_tab.show()
#end def display_tab
def delete_event(self, widget, event, data=None):
return False
#end def delete_event
def destroy(self, widget, data=None):
self.quit(widget, data)
#end def destroy
def dia_about(self, widget, data):
print "todo: implement dia_about"
#end def dia_about
def dia_create_del_database(self, widget, data):
print "todo: implement dia_create_del_database"
obtain_global_lock()
#end def dia_create_del_database
def dia_create_del_user(self, widget, data):
print "todo: implement dia_create_del_user"
obtain_global_lock()
#end def dia_create_del_user
def dia_database_stats(self, widget, data):
print "todo: implement dia_database_stats"
#string=fpdb_db.getDbStats(db, cursor)
#end def dia_database_stats
def dia_delete_db_parts(self, widget, data):
print "todo: implement dia_delete_db_parts"
obtain_global_lock()
#end def dia_delete_db_parts
def dia_edit_profile(self, widget=None, data=None, create_default=False, path=None):
print "todo: implement dia_edit_profile"
obtain_global_lock()
#end def dia_edit_profile
def dia_export_db(self, widget, data):
print "todo: implement dia_export_db"
obtain_global_lock()
#end def dia_export_db
def dia_get_db_root_credentials(self):
"""obtains db root credentials from user"""
print "todo: implement dia_get_db_root_credentials"
# user, pw=None, None
#
# dialog=gtk.Dialog(title="DB Credentials needed", parent=None, flags=0,
# buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,"Connect and recreate",gtk.RESPONSE_OK))
#
# label_warning1=gtk.Label("Please enter credentials for a database user for "+self.host+" that has permissions to create a database.")
#
#
# label_user=gtk.Label("Username")
# dialog.vbox.add(label_user)
# label_user.show()
#
# response=dialog.run()
# dialog.destroy()
# return (user, pw, response)
#end def dia_get_db_root_credentials
def dia_import_db(self, widget, data):
print "todo: implement dia_import_db"
obtain_global_lock()
#end def dia_import_db
def dia_licensing(self, widget, data):
print "todo: implement dia_licensing"
#end def dia_licensing
def dia_load_profile(self, widget, data):
"""Dialogue to select a file to load a profile from"""
self.obtain_global_lock()
chooser = gtk.FileChooserDialog(title="Please select a profile file to load",
action=gtk.FILE_CHOOSER_ACTION_OPEN,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
chooser.set_filename(self.profile)
response = chooser.run()
chooser.destroy()
if response == gtk.RESPONSE_OK:
self.load_profile(chooser.get_filename())
elif response == gtk.RESPONSE_CANCEL:
print 'User cancelled loading profile'
#end def dia_load_profile
def dia_recreate_tables(self, widget, data):
"""Dialogue that asks user to confirm that he wants to delete and recreate the tables"""
self.obtain_global_lock()
dia_confirm=gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING,
buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables")
diastring=("Please confirm that you want to (re-)create the tables. If there already are tables in the database "+self.db.database+" on "+self.db.host+" they will be deleted.")
dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted
response=dia_confirm.run()
dia_confirm.destroy()
if response == gtk.RESPONSE_YES:
self.db.recreate_tables()
elif response == gtk.RESPONSE_NO:
print 'User cancelled recreating tables'
#end def dia_recreate_tables
def dia_regression_test(self, widget, data):
print "todo: implement dia_regression_test"
self.obtain_global_lock()
#end def dia_regression_test
def dia_save_profile(self, widget, data):
print "todo: implement dia_save_profile"
#end def dia_save_profile
def diaSetupWizard(self, path):
print "todo: implement setup wizard"
print "setup wizard not implemented - please create the default configuration file:", path
diaSetupWizard = gtk.Dialog(title="Fatal Error - Config File Missing", parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK))
label = gtk.Label("Please copy the config file from the docs folder to:")
diaSetupWizard.vbox.add(label)
label.show()
label = gtk.Label(path)
diaSetupWizard.vbox.add(label)
label.show()
label = gtk.Label("and edit it according to the install documentation at http://fpdb.sourceforge.net")
diaSetupWizard.vbox.add(label)
label.show()
response = diaSetupWizard.run()
sys.exit(1)
#end def diaSetupWizard
def get_menu(self, window):
"""returns the menu for this program"""
accel_group = gtk.AccelGroup()
self.item_factory = gtk.ItemFactory(gtk.MenuBar, "<main>", accel_group)
self.item_factory.create_items(self.menu_items)
window.add_accel_group(accel_group)
return self.item_factory.get_widget("<main>")
#end def get_menu
def load_profile(self):
"""Loads profile from the provided path name."""
self.settings = {}
if (os.sep=="/"):
self.settings['os']="linuxmac"
else:
self.settings['os']="windows"
self.settings.update(self.config.get_db_parameters())
self.settings.update(self.config.get_tv_parameters())
self.settings.update(self.config.get_import_parameters())
self.settings.update(self.config.get_default_paths())
if self.db!=None:
self.db.disconnect()
self.db = fpdb_db.fpdb_db()
#print "end of fpdb.load_profile, databaseName:",self.settings['db-databaseName']
self.db.connect(self.settings['db-backend'], self.settings['db-host'], self.settings['db-databaseName'], self.settings['db-user'], self.settings['db-password'])
if self.db.wrongDbVersion:
diaDbVersionWarning = gtk.Dialog(title="Strong Warning - Invalid database version", parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))
label = gtk.Label("An invalid DB version or missing tables have been detected.")
diaDbVersionWarning.vbox.add(label)
label.show()
label = gtk.Label("This error is not necessarily fatal but it is strongly recommended that you recreate the tables by using the Database menu.")
diaDbVersionWarning.vbox.add(label)
label.show()
label = gtk.Label("Not doing this will likely lead to misbehaviour including fpdb crashes, corrupt data etc.")
diaDbVersionWarning.vbox.add(label)
label.show()
response = diaDbVersionWarning.run()
diaDbVersionWarning.destroy()
# Database connected to successfully, load queries to pass on to other classes
self.querydict = FpdbSQLQueries.FpdbSQLQueries(self.db.get_backend_name())
#end def load_profile
def not_implemented(self):
print "todo: called unimplemented menu entry (users: pls ignore this)"#remove this once more entries are implemented
#end def not_implemented
def obtain_global_lock(self):
print "todo: implement obtain_global_lock (users: pls ignore this)"
#end def obtain_global_lock
def quit(self, widget, data):
print "Quitting normally"
#check if current settings differ from profile, if so offer to save or abort
self.db.disconnect()
gtk.main_quit()
#end def quit_cliecked
def release_global_lock(self):
print "todo: implement release_global_lock"
#end def release_global_lock
def tab_abbreviations(self, widget, data):
print "todo: implement tab_abbreviations"
#end def tab_abbreviations
def tab_auto_import(self, widget, data):
"""opens the auto import tab"""
new_aimp_thread=GuiAutoImport.GuiAutoImport(self.settings, self.config)
self.threads.append(new_aimp_thread)
aimp_tab=new_aimp_thread.get_vbox()
self.add_and_display_tab(aimp_tab, "Auto Import")
#end def tab_auto_import
def tab_bulk_import(self, widget, data):
"""opens a tab for bulk importing"""
#print "start of tab_bulk_import"
new_import_thread=GuiBulkImport.GuiBulkImport(self.db, self.settings, self.config)
self.threads.append(new_import_thread)
bulk_tab=new_import_thread.get_vbox()
self.add_and_display_tab(bulk_tab, "Bulk Import")
#end def tab_bulk_import
def tab_main_help(self, widget, data):
"""Displays a tab with the main fpdb help screen"""
#print "start of tab_main_help"
mh_tab=gtk.Label("""Welcome to Fpdb!
For documentation please visit our website at http://fpdb.sourceforge.net/ or check the docs directory in the fpdb folder.
Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml
This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.add_and_display_tab(mh_tab, "Help")
#end def tab_main_help
def tab_table_viewer(self, widget, data):
"""opens a table viewer tab"""
#print "start of tab_table_viewer"
new_tv_thread=GuiTableViewer.GuiTableViewer(self.db, self.settings)
self.threads.append(new_tv_thread)
tv_tab=new_tv_thread.get_vbox()
self.add_and_display_tab(tv_tab, "Table Viewer")
#end def tab_table_viewer
def tabGraphViewer(self, widget, data):
"""opens a graph viewer tab"""
#print "start of tabGraphViewer"
new_gv_thread=GuiGraphViewer.GuiGraphViewer(self.db, self.settings, self.querydict, self.config)
self.threads.append(new_gv_thread)
gv_tab=new_gv_thread.get_vbox()
self.add_and_display_tab(gv_tab, "Graphs")
#end def tabGraphViewer
def __init__(self):
self.threads=[]
self.db=None
self.config = Configuration.Config()
self.load_profile()
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: alpha9+, p143 or higher")
self.window.set_border_width(1)
self.window.set_size_request(1020,400)
self.window.set_resizable(True)
self.menu_items = (
( "/_Main", None, None, 0, "<Branch>" ),
( "/Main/_Load Profile (broken)", "<control>L", self.dia_load_profile, 0, None ),
( "/Main/_Edit Profile (todo)", "<control>E", self.dia_edit_profile, 0, None ),
( "/Main/_Save Profile (todo)", None, self.dia_save_profile, 0, None ),
("/Main/sep1", None, None, 0, "<Separator>" ),
("/Main/_Quit", "<control>Q", self.quit, 0, None ),
("/_Import", None, None, 0, "<Branch>" ),
("/Import/_Bulk Import", "<control>B", self.tab_bulk_import, 0, None ),
("/Import/_Auto Import and HUD", "<control>A", self.tab_auto_import, 0, None ),
("/Import/Auto _Rating (todo)", "<control>R", self.not_implemented, 0, None ),
("/_Viewers", None, None, 0, "<Branch>" ),
("/_Viewers/_Auto Import and HUD", "<control>A", self.tab_auto_import, 0, None ),
("/Viewers/_Graphs", "<control>G", self.tabGraphViewer, 0, None ),
("/Viewers/Hand _Replayer (todo)", None, self.not_implemented, 0, None ),
("/Viewers/Player _Details (todo)", None, self.not_implemented, 0, None ),
("/Viewers/_Player Stats (tabulated view) (todo)", None, self.not_implemented, 0, None ),
("/Viewers/Starting _Hands (todo)", None, self.not_implemented, 0, None ),
("/Viewers/_Session Replayer (todo)", None, self.not_implemented, 0, None ),
("/Viewers/Poker_table Viewer (mostly obselete)", "<control>T", self.tab_table_viewer, 0, None ),
#( "/Viewers/Tourney Replayer
( "/_Database", None, None, 0, "<Branch>" ),
( "/Database/Create or Delete _Database (todo)", None, self.dia_create_del_database, 0, None ),
( "/Database/Create or Delete _User (todo)", None, self.dia_create_del_user, 0, None ),
( "/Database/Create or Recreate _Tables", None, self.dia_recreate_tables, 0, None ),
( "/Database/_Statistics (todo)", None, self.dia_database_stats, 0, None ),
( "/D_ebugging", None, None, 0, "<Branch>" ),
( "/Debugging/_Delete Parts of Database (todo)", None, self.dia_delete_db_parts, 0, None ),
( "/Debugging/_Export DB (todo)", None, self.dia_export_db, 0, None ),
( "/Debugging/_Import DB (todo)", None, self.dia_import_db, 0, None ),
( "/Debugging/_Regression test (todo)", None, self.dia_regression_test, 0, None ),
( "/_Help", None, None, 0, "<LastBranch>" ),
( "/Help/_Main Help", "<control>H", self.tab_main_help, 0, None ),
( "/Help/_Abbrevations (todo)", None, self.tab_abbreviations, 0, None ),
( "/Help/sep1", None, None, 0, "<Separator>" ),
( "/Help/A_bout (todo)", None, self.dia_about, 0, None ),
( "/Help/_License and Copying (todo)", None, self.dia_licensing, 0, None )
)
self.main_vbox = gtk.VBox(False, 1)
self.main_vbox.set_border_width(1)
self.window.add(self.main_vbox)
self.main_vbox.show()
menubar = self.get_menu(self.window)
self.main_vbox.pack_start(menubar, False, True, 0)
menubar.show()
#done menubar
self.tabs=[]
self.tab_names=[]
self.tab_buttons=[]
self.tab_box = gtk.HBox(False,1)
self.main_vbox.pack_start(self.tab_box, False, True, 0)
self.tab_box.show()
#done tab bar
self.current_tab = gtk.VBox(False,1)
self.current_tab.set_border_width(1)
self.main_vbox.add(self.current_tab)
self.current_tab.show()
self.tab_main_help(None, None)
self.status_bar = gtk.Label("Status: Connected to "+self.db.get_backend_name()+" database named "+self.db.database+" on host "+self.db.host)
self.main_vbox.pack_end(self.status_bar, False, True, 0)
self.status_bar.show()
self.window.show()
#end def __init__
def main(self):
gtk.main()
return 0
#end def main
if __name__ == "__main__":
me = fpdb()
me.main()

172
pyfpdb/fpdb_db.py Executable file
View File

@ -0,0 +1,172 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import os
import re
import fpdb_simple
import FpdbSQLQueries
class fpdb_db:
def __init__(self):
"""Simple constructor, doesnt really do anything"""
self.db=None
self.cursor=None
self.sql = {}
self.MYSQL_INNODB=2
self.PGSQL=3
self.SQLITE=4
#end def __init__
def connect(self, backend, host, database, user, password):
"""Connects a database with the given parameters"""
self.backend=backend
self.host=host
self.database=database
self.user=user
self.password=password
if backend==self.MYSQL_INNODB:
import MySQLdb
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
elif backend==self.PGSQL:
import psycopg2
self.db = psycopg2.connect(host = host, user = user, password = password, database = database)
else:
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
self.cursor=self.db.cursor()
# Set up query dictionary as early in the connection process as we can.
self.sql = FpdbSQLQueries.FpdbSQLQueries(self.get_backend_name())
self.wrongDbVersion=False
try:
self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone()
if settings[0]!=118:
print "outdated or too new database version - please recreate tables"
self.wrongDbVersion=True
except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables"
self.wrongDbVersion=True
#end def connect
def disconnect(self, due_to_error=False):
"""Disconnects the DB"""
if due_to_error:
self.db.rollback()
else:
self.db.commit()
self.cursor.close()
self.db.close()
#end def disconnect
def reconnect(self, due_to_error=False):
"""Reconnects the DB"""
#print "started fpdb_db.reconnect"
self.disconnect(due_to_error)
self.connect(self.backend, self.host, self.database, self.user, self.password)
def create_tables(self):
#todo: should detect and fail gracefully if tables already exist.
self.cursor.execute(self.sql.query['createSettingsTable'])
self.cursor.execute(self.sql.query['createSitesTable'])
self.cursor.execute(self.sql.query['createGametypesTable'])
self.cursor.execute(self.sql.query['createPlayersTable'])
self.cursor.execute(self.sql.query['createAutoratesTable'])
self.cursor.execute(self.sql.query['createHandsTable'])
self.cursor.execute(self.sql.query['createBoardCardsTable'])
self.cursor.execute(self.sql.query['createTourneyTypesTable'])
self.cursor.execute(self.sql.query['createTourneysTable'])
self.cursor.execute(self.sql.query['createTourneysPlayersTable'])
self.cursor.execute(self.sql.query['createHandsPlayersTable'])
self.cursor.execute(self.sql.query['createHandsActionsTable'])
self.cursor.execute(self.sql.query['createHudCacheTable'])
self.fillDefaultData()
self.db.commit()
#end def disconnect
def drop_tables(self):
"""Drops the fpdb tables from the current db"""
if(self.get_backend_name() == 'MySQL InnoDB'):
#Databases with FOREIGN KEY support need this switched of before you can drop tables
self.drop_referencial_integrity()
# Query the DB to see what tables exist
self.cursor.execute(self.sql.query['list_tables'])
for table in self.cursor:
self.cursor.execute(self.sql.query['drop_table'] + table[0])
elif(self.get_backend_name() == 'PostgreSQL'):
self.db.commit()# I have no idea why this makes the query work--REB 07OCT2008
self.cursor.execute(self.sql.query['list_tables'])
tables = self.cursor.fetchall()
for table in tables:
self.cursor.execute(self.sql.query['drop_table'] + table[0] + ' cascade')
elif(self.get_backend_name() == 'SQLite'):
#todo: sqlite version here
print "Empty function here"
self.db.commit()
#end def drop_tables
def drop_referencial_integrity(self):
"""Update all tables to remove foreign keys"""
self.cursor.execute(self.sql.query['list_tables'])
result = self.cursor.fetchall()
for i in range(len(result)):
self.cursor.execute("SHOW CREATE TABLE " + result[i][0])
inner = self.cursor.fetchall()
for j in range(len(inner)):
# result[i][0] - Table name
# result[i][1] - CREATE TABLE parameters
#Searching for CONSTRAINT `tablename_ibfk_1`
for m in re.finditer('(ibfk_[0-9]+)', inner[j][1]):
key = "`" + inner[j][0] + "_" + m.group() + "`"
self.cursor.execute("ALTER TABLE " + inner[j][0] + " DROP FOREIGN KEY " + key)
self.db.commit()
#end drop_referencial_inegrity
def get_backend_name(self):
"""Returns the name of the currently used backend"""
if self.backend==2:
return "MySQL InnoDB"
elif self.backend==3:
return "PostgreSQL"
else:
raise fpdb_simple.FpdbError("invalid backend")
#end def get_backend_name
def get_db_info(self):
return (self.host, self.database, self.user, self.password)
#end def get_db_info
def fillDefaultData(self):
self.cursor.execute("INSERT INTO Settings VALUES (118);")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, 'Full Tilt Poker', 'USD');")
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, 'PokerStars', 'USD');")
self.cursor.execute("INSERT INTO TourneyTypes VALUES (DEFAULT, 1, 0, 0, 0, False);")
#end def fillDefaultData
def recreate_tables(self):
"""(Re-)creates the tables of the current DB"""
self.drop_tables()
self.create_tables()
self.db.commit()
print "Finished recreating tables"
#end def recreate_tables
#end class fpdb_db

298
pyfpdb/fpdb_import.py Executable file
View File

@ -0,0 +1,298 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
#see status.txt for site/games support info
import sys
try:
import MySQLdb
mysqlLibFound=True
except:
pass
try:
import psycopg2
pgsqlLibFound=True
except:
pass
import math
import os
import datetime
import re
import fpdb_simple
import fpdb_parse_logic
from time import time
class Importer:
def __init__(self, caller, settings):
"""Constructor"""
self.settings=settings
self.caller=caller
self.db = None
self.cursor = None
self.filelist = {}
self.dirlist = {}
self.monitor = False
self.updated = {} #Time last import was run {file:mtime}
self.callHud = False
self.lines = None
self.faobs = None #File as one big string
self.pos_in_file = {} # dict to remember how far we have read in the file
#Set defaults
if not self.settings.has_key('imp-callFpdbHud'):
self.settings['imp-callFpdbHud'] = False
if not self.settings.has_key('minPrint'):
self.settings['minPrint'] = 30
self.dbConnect()
def dbConnect(self):
#connect to DB
if self.settings['db-backend'] == 2:
if not mysqlLibFound:
raise fpdb_simple.FpdbError("interface library MySQLdb not found but MySQL selected as backend - please install the library or change the config file")
self.db = MySQLdb.connect(self.settings['db-host'], self.settings['db-user'],
self.settings['db-password'], self.settings['db-databaseName'])
elif self.settings['db-backend'] == 3:
if not pgsqlLibFound:
raise fpdb_simple.FpdbError("interface library psycopg2 not found but PostgreSQL selected as backend - please install the library or change the config file")
print self.settings
self.db = psycopg2.connect(host = self.settings['db-host'],
user = self.settings['db-user'],
password = self.settings['db-password'],
database = self.settings['db-databaseName'])
elif self.settings['db-backend'] == 4:
pass
else:
pass
self.cursor = self.db.cursor()
#Set functions
def setCallHud(self, value):
self.callHud = value
def setMinPrint(self, value):
self.settings['minPrint'] = int(value)
def setHandCount(self, value):
self.settings['handCount'] = int(value)
def setQuiet(self, value):
self.settings['quiet'] = value
def setFailOnError(self, value):
self.settings['failOnError'] = value
# def setWatchTime(self):
# self.updated = time()
def clearFileList(self):
self.filelist = {}
#Add an individual file to filelist
def addImportFile(self, filename, site = "default", filter = "passthrough"):
#TODO: test it is a valid file
self.filelist[filename] = [site] + [filter]
#Add a directory of files to filelist
#Only one import directory per site supported.
#dirlist is a hash of lists:
#dirlist{ 'PokerStars' => ["/path/to/import/", "filtername"] }
def addImportDirectory(self,dir,monitor = False, site = "default", filter = "passthrough"):
if os.path.isdir(dir):
if monitor == True:
self.monitor = True
self.dirlist[site] = [dir] + [filter]
for file in os.listdir(dir):
self.addImportFile(os.path.join(dir, file), site, filter)
else:
print "Warning: Attempted to add: '" + str(dir) + "' as an import directory"
#Run full import on filelist
def runImport(self):
for file in self.filelist:
self.import_file_dict(file)
#Run import on updated files, then store latest update time.
def runUpdated(self):
#Check for new files in directory
#todo: make efficient - always checks for new file, should be able to use mtime of directory
# ^^ May not work on windows
for site in self.dirlist:
self.addImportDirectory(self.dirlist[site][0], False, site, self.dirlist[site][1])
for file in self.filelist:
stat_info = os.stat(file)
try:
lastupdate = self.updated[file]
if stat_info.st_mtime > lastupdate:
self.import_file_dict(file)
self.updated[file] = time()
except:
self.updated[file] = time()
# This codepath only runs first time the file is found, if modified in the last
# minute run an immediate import.
if (time() - stat_info.st_mtime) < 60:
self.import_file_dict(file)
# This is now an internal function that should not be called directly.
def import_file_dict(self, file):
starttime = time()
last_read_hand=0
loc = 0
if (file=="stdin"):
inputFile=sys.stdin
else:
inputFile=open(file, "rU")
try: loc = self.pos_in_file[file]
except: pass
# Read input file into class and close file
inputFile.seek(loc)
self.lines=fpdb_simple.removeTrailingEOL(inputFile.readlines())
self.pos_in_file[file] = inputFile.tell()
inputFile.close()
firstline = self.lines[0]
if firstline.find("Tournament Summary")!=-1:
print "TODO: implement importing tournament summaries"
#self.faobs = readfile(inputFile)
#self.parseTourneyHistory()
return 0
site=fpdb_simple.recogniseSite(firstline)
category=fpdb_simple.recogniseCategory(firstline)
startpos=0
stored=0 #counter
duplicates=0 #counter
partial=0 #counter
errors=0 #counter
for i in range (len(self.lines)): #main loop, iterates through the lines of a file and calls the appropriate parser method
if (len(self.lines[i])<2):
endpos=i
hand=self.lines[startpos:endpos]
if (len(hand[0])<2):
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
seat1=hand[i].find("Seat ") #todo: make this recover by skipping this line
if (seat1!=-1):
if (hand[i].find("Seat ", seat1+3)!=-1):
damaged=True
if (len(hand)<3):
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.
elif (hand[0].endswith(" (partial)")): #partial hand - do nothing
partial+=1
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
else: #normal processing
isTourney=fpdb_simple.isTourney(hand[0])
if not isTourney:
fpdb_simple.filterAnteBlindFold(site,hand)
hand=fpdb_simple.filterCrap(site, hand, isTourney)
self.hand=hand
try:
handsId=fpdb_parse_logic.mainParser(self.db, self.cursor, site, category, hand)
self.db.commit()
stored+=1
self.db.commit()
# if settings['imp-callFpdbHud'] and self.callHud and os.sep=='/':
if self.settings['imp-callFpdbHud'] and self.callHud:
#print "call to HUD here. handsId:",handsId
#pipe the Hands.id out to the HUD
self.caller.pipe_to_hud.stdin.write("%s" % (handsId) + os.linesep)
except fpdb_simple.DuplicateError:
duplicates+=1
except (ValueError), fe:
errors+=1
self.printEmailErrorMessage(errors, file, hand[0])
if (self.settings['failOnError']):
self.db.commit() #dont remove this, in case hand processing was cancelled.
raise
except (fpdb_simple.FpdbError), fe:
errors+=1
self.printEmailErrorMessage(errors, file, hand[0])
#fe.printStackTrace() #todo: get stacktrace
self.db.rollback()
if (self.settings['failOnError']):
self.db.commit() #dont remove this, in case hand processing was cancelled.
raise
if (self.settings['minPrint']!=0):
if ((stored+duplicates+partial+errors)%self.settings['minPrint']==0):
print "stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
if (self.settings['handCount']!=0):
if ((stored+duplicates+partial+errors)>=self.settings['handCount']):
if (not self.settings['quiet']):
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)
sys.exit(0)
startpos=endpos
print "Total stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors, " time:", (time() - starttime)
if stored==0:
if duplicates>0:
for line_no in range(len(self.lines)):
if self.lines[line_no].find("Game #")!=-1:
final_game_line=self.lines[line_no]
handsId=fpdb_simple.parseSiteHandNo(final_game_line)
else:
print "failed to read a single hand from file:", inputFile
handsId=0
#todo: this will cause return of an unstored hand number if the last hand was error or partial
self.db.commit()
self.handsId=handsId
return handsId
#end def import_file_dict
def parseTourneyHistory(self):
print "Tourney history parser stub"
#Find tournament boundaries.
#print self.foabs
def printEmailErrorMessage(self, errors, filename, line):
print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it."
print "Filename:", filename
print "Here is the first line so you can identify it. Please mention that the error was a ValueError:"
print self.hand[0]
if __name__ == "__main__":
print "CLI for fpdb_import is now available as CliFpdb.py"

164
pyfpdb/fpdb_parse_logic.py Normal file
View File

@ -0,0 +1,164 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
#methods that are specific to holdem but not trivial
import fpdb_simple
import fpdb_save_to_db
#parses a holdem hand
def mainParser(db, cursor, site, category, hand):
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
base="hold"
else:
base="stud"
#part 0: create the empty arrays
lineTypes=[] #char, valid values: header, name, cards, action, win, rake, ignore
lineStreets=[] #char, valid values: (predeal, preflop, flop, turn, river)
cardValues, cardSuits, boardValues, boardSuits, antes, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo, seatLines, winnings, rakes=[],[],[],[],[],[],[],[],[],[],[],[],[]
#part 1: read hand no and check for duplicate
siteHandNo=fpdb_simple.parseSiteHandNo(hand[0])
handStartTime=fpdb_simple.parseHandStartTime(hand[0], site)
siteID=fpdb_simple.recogniseSiteID(cursor, site)
#print "parse logic, siteID:",siteID,"site:",site
isTourney=fpdb_simple.isTourney(hand[0])
smallBlindLine=0
for i in range(len(hand)):
if hand[i].find("posts small blind")!=-1 or hand[i].find("posts the small blind")!=-1:
smallBlindLine=i
#print "found small blind line:",smallBlindLine
break
#print "small blind line:",smallBlindLine
gametypeID=fpdb_simple.recogniseGametypeID(cursor, hand[0], hand[smallBlindLine], siteID, category, isTourney)
if isTourney:
if site!="ps":
raise fpdb_simple.FpdbError("tourneys are only supported on PS right now")
siteTourneyNo=fpdb_simple.parseTourneyNo(hand[0])
buyin=fpdb_simple.parseBuyin(hand[0])
fee=fpdb_simple.parseFee(hand[0])
entries=-1 #todo: parse this
prizepool=-1 #todo: parse this
knockout=0
tourneyStartTime=handStartTime #todo: read tourney start time
rebuyOrAddon=fpdb_simple.isRebuyOrAddon(hand[0])
tourneyTypeId=fpdb_simple.recogniseTourneyTypeId(cursor, siteID, buyin, fee, knockout, rebuyOrAddon)
fpdb_simple.isAlreadyInDB(cursor, gametypeID, siteHandNo)
#part 2: classify lines by type (e.g. cards, action, win, sectionchange) and street
fpdb_simple.classifyLines(hand, category, lineTypes, lineStreets)
#part 3: read basic player info
#3a read player names, startcashes
for i in range (len(hand)): #todo: use maxseats+1 here.
if (lineTypes[i]=="name"):
seatLines.append(hand[i])
names=fpdb_simple.parseNames(seatLines)
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
tmp=fpdb_simple.parseCashesAndSeatNos(seatLines, site)
startCashes=tmp['startCashes']
seatNos=tmp['seatNos']
fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo)
#3b read positions
if base=="hold":
positions = fpdb_simple.parsePositions (hand, names)
#part 4: take appropriate action for each line based on linetype
for i in range(len(hand)):
if (lineTypes[i]=="cards"):
fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits)
#if category=="studhilo":
# print "hand[i]:", hand[i]
# print "cardValues:", cardValues
# print "cardSuits:", cardSuits
elif (lineTypes[i]=="action"):
fpdb_simple.parseActionLine (site, base, isTourney, hand[i], lineStreets[i], playerIDs, names, actionTypes, allIns, actionAmounts, actionNos, actionTypeByNo)
elif (lineTypes[i]=="win"):
fpdb_simple.parseWinLine (hand[i], site, names, winnings, isTourney)
elif (lineTypes[i]=="rake"):
if isTourney:
totalRake=0
else:
totalRake=fpdb_simple.parseRake(hand[i])
fpdb_simple.splitRake(winnings, rakes, totalRake)
elif (lineTypes[i]=="header" or lineTypes[i]=="rake" or lineTypes[i]=="name" or lineTypes[i]=="ignore"):
pass
elif (lineTypes[i]=="ante"):
fpdb_simple.parseAnteLine(hand[i], site, isTourney, names, antes)
elif (lineTypes[i]=="table"):
tableResult=fpdb_simple.parseTableLine(site, base, hand[i])
else:
raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
if site=="ftp":
tableResult=fpdb_simple.parseTableLine(site, base, hand[0])
maxSeats=tableResult['maxSeats']
tableName=tableResult['tableName']
#print "before part5, antes:", antes
#part 5: final preparations, then call fpdb_save_to_db.* with
# the arrays as they are - that file will fill them.
fpdb_simple.convertCardValues(cardValues)
if base=="hold":
fpdb_simple.convertCardValuesBoard(boardValues)
fpdb_simple.convertBlindBet(actionTypes, actionAmounts)
fpdb_simple.checkPositions(positions)
cursor.execute("SELECT limitType FROM Gametypes WHERE id=%s",(gametypeID, ))
limit_type=cursor.fetchone()[0]
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
totalWinnings=0
for i in range(len(winnings)):
totalWinnings+=winnings[i]
if base=="hold":
hudImportData=fpdb_simple.generateHudCacheData(playerIDs, base, category, actionTypes, allIns, actionTypeByNo, winnings, totalWinnings, positions)
else:
hudImportData=fpdb_simple.generateHudCacheData(playerIDs, base, category, actionTypes, allIns, actionTypeByNo, winnings, totalWinnings, None)
if isTourney:
ranks=[]
for i in range (len(names)):
ranks.append(0)
payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
if base=="hold":
result = fpdb_save_to_db.tourney_holdem_omaha(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID,
siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
elif base=="stud":
result = fpdb_save_to_db.tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteID,
siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, antes, cardValues, cardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
else:
raise fpdb_simple.FpdbError ("unrecognised category")
else:
if base=="hold":
result = fpdb_save_to_db.ring_holdem_omaha(cursor, base, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
elif base=="stud":
result = fpdb_save_to_db.ring_stud(cursor, base, category, siteHandNo, gametypeID,
handStartTime, names, playerIDs, startCashes, antes, cardValues,
cardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos)
else:
raise fpdb_simple.FpdbError ("unrecognised category")
db.commit()
return result
#end def mainParser

94
pyfpdb/fpdb_save_to_db.py Normal file
View File

@ -0,0 +1,94 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
#This file contains methods to store hands into the db. decides to move this
#into a seperate file since its ugly, fairly long and just generally in the way.
import fpdb_simple
#stores a stud/razz hand into the database
def ring_stud(cursor, base, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, antes, card_values, card_suits, winnings, rakes, action_types, allIns, action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName, maxSeats)
#print "before calling store_hands_players_stud, antes:", antes
hands_players_ids=fpdb_simple.store_hands_players_stud(cursor, hands_id, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes, seatNos)
fpdb_simple.storeHudCache(cursor, base, category, gametype_id, player_ids, hudImportData)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, allIns, action_amounts, actionNos)
return hands_id
#end def ring_stud
def ring_holdem_omaha(cursor, base, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, allIns, action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
"""stores a holdem/omaha hand into the database"""
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
fpdb_simple.fill_board_cards(board_values, board_suits)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName, maxSeats)
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids, start_cashes, positions, card_values, card_suits, winnings, rakes, seatNos)
fpdb_simple.storeHudCache(cursor, base, category, gametype_id, player_ids, hudImportData)
fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, allIns, action_amounts, actionNos)
return hands_id
#end def ring_holdem_omaha
def tourney_holdem_omaha(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourney_start, payin_amounts, ranks, tourneyTypeId, siteId, #end of tourney specific params
site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, allIns, action_amounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
"""stores a tourney holdem/omaha hand into the database"""
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
fpdb_simple.fill_board_cards(board_values, board_suits)
tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourney_start)
tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks, winnings)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName, maxSeats)
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha_tourney(cursor, category, hands_id, player_ids, start_cashes, positions, card_values, card_suits, winnings, rakes, seatNos, tourneys_players_ids)
fpdb_simple.storeHudCache(cursor, base, category, gametype_id, player_ids, hudImportData)
fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, allIns, action_amounts, actionNos)
return hands_id
#end def tourney_holdem_omaha
def tourney_stud(cursor, base, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks, tourneyTypeId, siteId,
siteHandNo, gametypeId, handStartTime, names, playerIds, startCashes, antes, cardValues, cardSuits, winnings, rakes, actionTypes, allIns, actionAmounts, actionNos, hudImportData, maxSeats, tableName, seatNos):
#stores a tourney stud/razz hand into the database
fpdb_simple.fillCardArrays(len(names), base, category, cardValues, cardSuits)
tourney_id=fpdb_simple.store_tourneys(cursor, tourneyTypeId, siteTourneyNo, entries, prizepool, tourneyStartTime)
tourneys_players_ids=fpdb_simple.store_tourneys_players(cursor, tourney_id, playerIds, payin_amounts, ranks, winnings)
hands_id=fpdb_simple.storeHands(cursor, siteHandNo, gametypeId, handStartTime, names, tableName, maxSeats)
hands_players_ids=fpdb_simple.store_hands_players_stud_tourney(cursor, hands_id, playerIds, startCashes, antes, cardValues, cardSuits, winnings, rakes, seatNos, tourneys_players_ids)
fpdb_simple.storeHudCache(cursor, base, category, gametypeId, playerIds, hudImportData)
fpdb_simple.storeActions(cursor, hands_players_ids, actionTypes, allIns, actionAmounts, actionNos)
return hands_id
#end def tourney_stud

2141
pyfpdb/fpdb_simple.py Normal file

File diff suppressed because it is too large Load Diff

175
regression-test/PrintHand.py Executable file
View File

@ -0,0 +1,175 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
#This is intended mostly for regression testing
import sys
import MySQLdb
from optparse import OptionParser
import fpdb_util_lib as ful
parser = OptionParser()
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",
help="Name of the site (as written in the history files)")
(options, sys.argv) = parser.parse_args()
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,))
siteId=cursor.fetchone()[0]
print "options.site:",options.site,"siteId:",siteId
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 "===================="
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
gtString=""
doBets=False
if base=="hold":
cursor.execute("SELECT smallBlind FROM Gametypes WHERE id=%s", (gametypeId, ))
sb=cursor.fetchone()[0]
cursor.execute("SELECT bigBlind FROM Gametypes WHERE id=%s", (gametypeId, ))
bb=cursor.fetchone()[0]
gtString=("sb: "+str(sb)+" bb: "+str(bb))
if (limitType=="fl"):
doBets=True
elif base=="stud":
doBets=True
if doBets:
cursor.execute("SELECT smallBet FROM Gametypes WHERE id=%s", (gametypeId, ))
sbet=cursor.fetchone()[0]
cursor.execute("SELECT bigBet FROM Gametypes WHERE id=%s", (gametypeId, ))
bbet=cursor.fetchone()[0]
gtString+=(" sbet: "+str(sbet)+" bbet: "+str(bbet))
print gtString
if type=="ring":
pass
elif type=="tour":
#cursor.execute("SELECT tourneys_players_id FROM hands
cursor.execute("""SELECT DISTINCT TourneysPlayers.id
FROM Hands JOIN HandsPlayers ON HandsPlayers.handId=Hands.id
JOIN TourneysPlayers ON HandsPlayers.tourneysPlayersId=TourneysPlayers.id
WHERE Hands.id=%s""", (hand_id,))
handsPlayersIds=cursor.fetchall()
print "dbg hands_players_ids:",handsPlayersIds
print ""
print "From Table Tourneys"
print "==================="
print "TODO"
print ""
print "From Table TourneysPlayers"
print "=========================="
print "TODO"
else:
print "invalid type:",type
sys.exit(1)
print ""
print "From Table BoardCards"
print "====================="
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
cursor.execute("""SELECT * FROM BoardCards WHERE handId=%s""",(handId, ))
bc=cursor.fetchone()
print "Board cards:", ful.cards2String(bc[2:])
print ""
print "From Table HandsPlayers"
print "======================="
cursor.execute("""SELECT * FROM HandsPlayers WHERE handId=%s""",(handId, ))
handsPlayers=cursor.fetchall()
playerNames=[]
for i in range (len(handsPlayers)):
line=handsPlayers[i][2:]
playerNames.append(ful.id_to_player_name(cursor, line[0]))
printstr="playerName:"+playerNames[i]+" playerStartcash:"+str(line[1])
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
printstr+=" position:"+ful.position2String(line[2])+" cards:"
if (category=="holdem"):
printstr+=ful.cards2String(line[5:9])
else:
printstr+=ful.cards2String(line[5:13])
elif (category=="razz" or category=="studhi" or category=="studhilo"):
printstr+=" ante:"+str(line[4])+" cards:"
printstr+=ful.cards2String(line[5:19])
else:
print "TODO: raise error, print_hand.py"
sys.exit(1)
printstr+=" winnings:"+str(line[19])+" rake:"+str(line[20])
print printstr
print ""
print "From Table HandsActions"
print "======================="
for i in range (len(handsPlayers)):
cursor.execute("""SELECT * FROM HandsActions WHERE handPlayerId=%s""",(handsPlayers[i][0], ))
handsActions=cursor.fetchall()
for j in range (len(handsActions)):
line=handsActions[j][2:]
printstr="playerName:"+playerNames[i]
printstr+=" street:"+ful.street_int2String(category, line[0])+" streetActionNo:"+str(line[1])+" action:"+line[2]
printstr+=" amount:"+str(line[4])
print printstr
cursor.close()
db.close()
sys.exit(0)

View File

@ -0,0 +1,158 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
#This is intended mostly for regression testing
import sys
import MySQLdb
from optparse import OptionParser
import fpdb_util_lib as ful
parser = OptionParser()
parser.add_option("-b", "--bigBet", default="4", type="int", help="big bet in cent")
parser.add_option("-c", "--cat", "--category", default="holdem", help="Category, e.g. holdem or studhilo")
parser.add_option("-e", "--seats", default="7", type="int", help="number of active seats")
parser.add_option("-g", "--gameType", default="ring", help="Whether its a ringgame (ring) or a tournament (tour)")
parser.add_option("-l", "--limit", "--limitType", default="fl", help="Limit Type, one of: nl, pl, fl, cn, cp")
parser.add_option("-n", "--name", "--playername", default="Player_1", help="Name of the player to print")
parser.add_option("-o", "--position", default="B", help="Position, can be B, S, D, C, M or E (see tabledesign.html)")
parser.add_option("-p", "--password", help="The password for the MySQL user")
parser.add_option("-s", "--site", default="PokerStars", help="Name of the site (as written in the history files)")
(options, sys.argv) = parser.parse_args()
db = MySQLdb.connect("localhost", "fpdb", options.password, "fpdb")
cursor = db.cursor()
print "Connected to MySQL on localhost. Print Player Flags Utility"
print ""
print "Basic Data"
print "=========="
print "bigBet:",options.bigBet, "category:",options.cat, "limitType:", options.limit, "name:", options.name, "gameType:", options.gameType, "site:", options.site
cursor.execute("SELECT id FROM Sites WHERE name=%s", (options.site,))
siteId=cursor.fetchone()[0]
cursor.execute("SELECT id FROM Gametypes WHERE bigBet=%s AND category=%s AND siteId=%s AND limitType=%s AND type=%s", (options.bigBet, options.cat, siteId, options.limit, options.gameType))
gametypeId=cursor.fetchone()[0]
cursor.execute("SELECT id FROM Players WHERE name=%s", (options.name,))
playerId=cursor.fetchone()[0]
#print "debug: gametypeId:", gametypeId, "playerId:", playerId, "options.seats:", options.seats, "options.position:", options.position
cursor.execute("SELECT id FROM HudCache WHERE gametypeId=%s AND playerId=%s AND activeSeats=%s AND position=%s",(gametypeId, playerId, options.seats, options.position))
hudDataId=cursor.fetchone()[0]
print "siteId:", siteId, "gametypeId:", gametypeId, "playerId:", playerId, "hudDataId:", hudDataId
print ""
print "HUD Raw Hand Counts"
print "==================="
cursor.execute ("SELECT HDs, street0VPI, street0Aggr, street0_3B4BChance, street0_3B4BDone FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "HDs:",fields[0]
print "street0VPI:",fields[1]
print "street0Aggr:",fields[2]
print "street0_3B4BChance:",fields[3]
print "street0_3B4BDone:",fields[4]
print ""
cursor.execute ("SELECT street1Seen, street2Seen, street3Seen, street4Seen, sawShowdown FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "street1Seen:",fields[0]
print "street2Seen:",fields[1]
print "street3Seen:",fields[2]
print "street4Seen:",fields[3]
print "sawShowdown:",fields[4]
print ""
cursor.execute ("SELECT street1Aggr, street2Aggr, street3Aggr, street4Aggr FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "street1Aggr:",fields[0]
print "street2Aggr:",fields[1]
print "street3Aggr:",fields[2]
print "street4Aggr:",fields[3]
print ""
cursor.execute ("SELECT otherRaisedStreet1, otherRaisedStreet2, otherRaisedStreet3, otherRaisedStreet4, foldToOtherRaisedStreet1, foldToOtherRaisedStreet2, foldToOtherRaisedStreet3, foldToOtherRaisedStreet4 FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "otherRaisedStreet1:",fields[0]
print "otherRaisedStreet2:",fields[1]
print "otherRaisedStreet3:",fields[2]
print "otherRaisedStreet4:",fields[3]
print "foldToOtherRaisedStreet1:",fields[4]
print "foldToOtherRaisedStreet2:",fields[5]
print "foldToOtherRaisedStreet3:",fields[6]
print "foldToOtherRaisedStreet4:",fields[7]
print ""
cursor.execute ("SELECT wonWhenSeenStreet1, wonAtSD FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "wonWhenSeenStreet1:",fields[0]
print "wonAtSD:",fields[1]
cursor.execute ("SELECT stealAttemptChance, stealAttempted, foldBbToStealChance, foldedBbToSteal, foldSbToStealChance, foldedSbToSteal FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "stealAttemptChance:",fields[0]
print "stealAttempted:",fields[1]
print "foldBbToStealChance:",fields[2]
print "foldedBbToSteal:",fields[3]
print "foldSbToStealChance:",fields[4]
print "foldedSbToSteal:",fields[5]
cursor.execute ("SELECT street1CBChance, street1CBDone, street2CBChance, street2CBDone, street3CBChance, street3CBDone, street4CBChance, street4CBDone FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "street1CBChance:",fields[0]
print "street1CBDone:",fields[1]
print "street2CBChance:",fields[2]
print "street2CBDone:",fields[3]
print "street3CBChance:",fields[4]
print "street3CBDone:",fields[5]
print "street4CBChance:",fields[6]
print "street4CBDone:",fields[7]
cursor.execute ("SELECT foldToStreet1CBChance, foldToStreet1CBDone, foldToStreet2CBChance, foldToStreet2CBDone, foldToStreet3CBChance, foldToStreet3CBDone, foldToStreet4CBChance, foldToStreet4CBDone FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "foldToStreet1CBChance:",fields[0]
print "foldToStreet1CBDone:",fields[1]
print "foldToStreet2CBChance:",fields[2]
print "foldToStreet2CBDone:",fields[3]
print "foldToStreet3CBChance:",fields[4]
print "foldToStreet3CBDone:",fields[5]
print "foldToStreet4CBChance:",fields[6]
print "foldToStreet4CBDone:",fields[7]
cursor.execute ("SELECT totalProfit FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "totalProfit:",fields[0]
cursor.execute ("SELECT street1CheckCallRaiseChance, street1CheckCallRaiseDone, street2CheckCallRaiseChance, street2CheckCallRaiseDone, street3CheckCallRaiseChance, street3CheckCallRaiseDone, street4CheckCallRaiseChance, street4CheckCallRaiseDone FROM HudCache WHERE id=%s", (hudDataId,))
fields=cursor.fetchone()
print "street1CheckCallRaiseChance:",fields[0]
print "street1CheckCallRaiseDone:",fields[1]
print "street2CheckCallRaiseChance:",fields[2]
print "street2CheckCallRaiseDone:",fields[3]
print "street3CheckCallRaiseChance:",fields[4]
print "street3CheckCallRaiseDone:",fields[5]
print "street4CheckCallRaiseChance:",fields[6]
print "street4CheckCallRaiseDone:",fields[7]
cursor.close()
db.close()
sys.exit(0)

View File

@ -0,0 +1,80 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import sys
def cards2String(arr):
if (len(arr)%2!=0):
print "TODO: raise error, cards2String failed, uneven length of arr"
sys.exit(1)
result = ""
for i in range (len(arr)/2):
if arr[i*2]==0:
result+="??"
else:
if arr[i*2]==14:
result+="A"
elif arr[i*2]==13:
result+="K"
elif arr[i*2]==12:
result+="Q"
elif arr[i*2]==11:
result+="J"
elif arr[i*2]==10:
result+="T"
elif (arr[i*2]>=2 and arr[i*2]<=9):
result+=str(arr[i*2])
else:
print "TODO: raise error, cards2String failed, arr[i*2]:", arr[i*2], "len(arr):", len(arr)
print "arr:",arr
sys.exit(1)
result+=arr[i*2+1]
result+=" "
return result[:-1]
def id_to_player_name(cursor, id):
cursor.execute("SELECT name FROM Players WHERE id=%s", (id, ))
return cursor.fetchone()[0]
def position2String(pos):
if pos=="B":
return "BB"
elif pos=="S":
return "SB"
elif pos=="0":
return "Btn"
else:
return (pos+" off Btn")
def street_int2String(category, street):
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
if street==0:
return "Preflop"
elif street==1:
return "Flop "
elif street==2:
return "Turn "
elif street==3:
return "River "
else:
print "TODO: raise error, fpdb_util_lib.py street_int2String invalid street no"
sys.exit(1)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
return str(street)
else:
print "TODO: raise error, fpdb_util_lib.py street_int2String invalid category"
sys.exit(1)

View File

@ -0,0 +1,271 @@
Full Tilt Poker Game #6929537410: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:15:44 ET - 2008/06/22
Seat 1: player16 ($94.90)
Seat 2: player25 ($147)
Seat 3: player18 ($62.80)
Seat 4: player19 ($136.55)
Seat 5: play-er26 ($56.05)
Seat 6: player21 ($252.95)
Seat 7: player22 ($200)
Seat 8: player23 ($162.50)
Seat 9: player24 ($270.70)
player24 posts the small blind of $0.50
player16 posts the big blind of $1
player22 posts $1
The button is in seat #8
*** HOLE CARDS ***
player25 folds
player25 stands up
player18 folds
player19 folds
play-er26 folds
player21 folds
player22 checks
player23 calls $1
player17 adds $100
player24 calls $0.50
player16 checks
*** FLOP *** [4s Kc 8s]
player24 has 15 seconds left to act
player24 checks
player16 checks
player22 checks
player23 checks
*** TURN *** [4s Kc 8s] [6s]
player24 checks
player16 checks
player22 checks
player23 bets $4
player24 calls $4
player16 folds
player22 folds
*** RIVER *** [4s Kc 8s 6s] [Qc]
player24 checks
player23 checks
*** SHOW DOWN ***
player23 shows [Td 5s 3d Js] a flush, Jack high
player24 mucks
player23 wins the pot ($11.40) with a flush, Jack high
*** SUMMARY ***
Total pot $12 | Rake $0.60
Board: [4s Kc 8s 6s Qc]
Seat 1: player16 (big blind) folded on the Turn
Seat 2: player25 didn't bet (folded)
Seat 3: player18 didn't bet (folded)
Seat 4: player19 didn't bet (folded)
Seat 5: play-er26 didn't bet (folded)
Seat 6: player21 didn't bet (folded)
Seat 7: player22 folded on the Turn
Seat 8: player23 (button) collected ($11.40)
Seat 9: player24 (small blind) mucked
Full Tilt Poker Game #6929553738: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:17:06 ET - 2008/06/22
Seat 1: player16 ($93.90)
Seat 2: player17 ($100)
Seat 3: player18 ($62.80)
Seat 4: player19 ($136.55)
Seat 5: play-er26 ($56.05)
Seat 6: player21 ($252.95)
Seat 7: player22 ($199)
Seat 8: player23 ($168.90)
Seat 9: player24 ($265.70)
player16 posts the small blind of $0.50
player17 posts the big blind of $1
The button is in seat #9
*** HOLE CARDS ***
player18 folds
play-er26 stands up
player19 raises to $2
play-er26 folds
player21 calls $2
player22 has 15 seconds left to act
player22 folds
player23 folds
player24 folds
player16 calls $1.50
player17 calls $1
*** FLOP *** [Jc 4c Kc]
player16 checks
player17 checks
player19 checks
player21 checks
*** TURN *** [Jc 4c Kc] [7h]
player16 checks
player17 checks
player19 bets $3.50
player21 folds
player16 folds
player17 calls $3.50
*** RIVER *** [Jc 4c Kc 7h] [8s]
player17 checks
player19 has 15 seconds left to act
player19 bets $10
player17 calls $10
*** SHOW DOWN ***
player19 shows [4s Tc As Ac] a flush, Ace high
player17 mucks
player19 wins the pot ($33.25) with a flush, Ace high
*** SUMMARY ***
Total pot $35 | Rake $1.75
Board: [Jc 4c Kc 7h 8s]
Seat 1: player16 (small blind) folded on the Turn
Seat 2: player17 (big blind) mucked
Seat 3: player18 didn't bet (folded)
Seat 4: player19 collected ($33.25)
Seat 5: play-er26 didn't bet (folded)
Seat 6: player21 folded on the Turn
Seat 7: player22 didn't bet (folded)
Seat 8: player23 didn't bet (folded)
Seat 9: player24 (button) didn't bet (folded)
Full Tilt Poker Game #6929572212: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:18:40 ET - 2008/06/22
Seat 1: player16 ($91.90)
Seat 2: player17 ($84.50)
Seat 3: player18 ($62.80)
Seat 4: player19 ($154.30)
Seat 6: player21 ($250.95)
Seat 7: player22 ($199)
Seat 8: player23 ($168.90)
Seat 9: player24 ($265.70)
player17 posts the small blind of $0.50
player18 posts the big blind of $1
The button is in seat #1
*** HOLE CARDS ***
player19 folds
player21 folds
player20 adds $50
player22 folds
player23 folds
player24 folds
player20 is sitting out
player16 raises to $2
player17 folds
player18 folds
Uncalled bet of $1 returned to player16
player16 mucks
player16 wins the pot ($2.50)
*** SUMMARY ***
Total pot $2.50 | Rake $0
Seat 1: player16 (button) collected ($2.50), mucked
Seat 2: player17 (small blind) folded before the Flop
Seat 3: player18 (big blind) folded before the Flop
Seat 4: player19 didn't bet (folded)
Seat 6: player21 didn't bet (folded)
Seat 7: player22 didn't bet (folded)
Seat 8: player23 didn't bet (folded)
Seat 9: player24 didn't bet (folded)
Full Tilt Poker Game #6929576743: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:19:03 ET - 2008/06/22
Seat 1: player16 ($93.40)
Seat 2: player17 ($84)
Seat 3: player18 ($61.80)
Seat 4: player19 ($154.30)
Seat 5: player20 ($50), is sitting out
Seat 6: player21 ($250.95)
Seat 7: player22 ($199)
Seat 8: player23 ($168.90)
Seat 9: player24 ($265.70)
player18 posts the small blind of $0.50
player19 posts the big blind of $1
The button is in seat #2
*** HOLE CARDS ***
player20 has returned
player21 calls $1
player22 folds
player23 calls $1
player24 calls $1
player16 raises to $4
player17 folds
player18 folds
player19 folds
player21 folds
player23 folds
player17 is sitting out
player24 has 15 seconds left to act
player24 calls $3
*** FLOP *** [Tc 9s 7h]
player24 checks
player16 has 15 seconds left to act
player16 bets $8
player24 folds
Uncalled bet of $8 returned to player16
player16 mucks
player16 wins the pot ($10.95)
*** SUMMARY ***
Total pot $11.50 | Rake $0.55
Board: [Tc 9s 7h]
Seat 1: player16 collected ($10.95), mucked
Seat 2: player17 (button) didn't bet (folded)
Seat 3: player18 (small blind) folded before the Flop
Seat 4: player19 (big blind) folded before the Flop
Seat 5: player20 is sitting out
Seat 6: player21 folded before the Flop
Seat 7: player22 didn't bet (folded)
Seat 8: player23 folded before the Flop
Seat 9: player24 folded on the Flop
Full Tilt Poker Game #6929587483: Table Green (deep) - $0.50/$1 - Pot Limit Omaha Hi - 17:19:57 ET - 2008/06/22
Seat 1: player16 ($100.35)
Seat 2: player17 ($84), is sitting out
Seat 3: player18 ($61.30)
Seat 4: player19 ($153.30)
Seat 5: player20 ($50)
Seat 6: player21 ($249.95)
Seat 7: player22 ($199)
Seat 8: player23 ($167.90)
Seat 9: player24 ($261.70)
player19 posts the small blind of $0.50
player20 posts the big blind of $1
The button is in seat #3
*** HOLE CARDS ***
player21 folds
player22 folds
player21 stands up
player23 calls $1
player24 calls $1
player16 folds
player18 folds
player19 calls $0.50
player20 checks
*** FLOP *** [Jd Td 2c]
roguern adds $100
player19 bets $3
player20 folds
player23 folds
player24 has 15 seconds left to act
player24 raises to $11
player19 raises to $37
player24 raises to $115
player19 raises to $152.30, and is all in
player24 calls $37.30
player19 shows [Jc Jh 7s 5h]
player24 shows [Kh Ad 6h Qd]
*** TURN *** [Jd Td 2c] [As]
*** RIVER *** [Jd Td 2c As] [8s]
player19 shows three of a kind, Jacks
player24 shows a straight, Ace high
player24 wins the pot ($305.60) with a straight, Ace high
player19 is sitting out
*** SUMMARY ***
Total pot $308.60 | Rake $3
Board: [Jd Td 2c As 8s]
Seat 1: player16 didn't bet (folded)
Seat 2: player17 is sitting out
Seat 3: player18 (button) didn't bet (folded)
Seat 4: player19 (small blind) showed [Jc Jh 7s 5h] and lost with three of a kind, Jacks
Seat 5: player20 (big blind) folded on the Flop
Seat 6: player21 didn't bet (folded)
Seat 7: player22 didn't bet (folded)
Seat 8: player23 folded on the Flop
Seat 9: player24 showed [Kh Ad 6h Qd] and won ($305.60) with a straight, Ace high

View File

@ -0,0 +1,61 @@
Full Tilt Poker Game #6367428246: Table Mountain Mesa - $15/$30 Ante $3 - Limit Stud H/L - 23:47:38 ET - 2008/05/10
Seat 1: Player_8 ($446), is sitting out
Seat 2: Play er9 ($303.50)
Seat 3: P layer10 ($613), is sitting out
Seat 4: Player_11 ($164)
Seat 5: Player1 2 ($543.50), is sitting out
Seat 6: Player13 ($912.50)
Seat 7: Player14 ($430), is sitting out
Seat 8: Player15 ($531.50)
Player15 antes $3
Player_11 antes $3
Player13 antes $3
Play er9 antes $3
*** 3RD STREET ***
Dealt to Play er9 [2s]
Dealt to Player_11 [3c]
Dealt to Player13 [8c]
Dealt to Player15 [Jc]
Play er9 is low with [2s]
Play er9 brings in for $5
Player_11 folds
Player13 completes it to $15
Player15 folds
Play er9 calls $10
*** 4TH STREET ***
Dealt to Play er9 [2s] [6c]
Dealt to Player13 [8c] [5h]
Player13 bets $15
Play er9 calls $15
*** 5TH STREET ***
Dealt to Play er9 [2s 6c] [Ac]
Dealt to Player13 [8c 5h] [Ah]
Player13 bets $30
Play er9 calls $30
*** 6TH STREET ***
Dealt to Play er9 [2s 6c Ac] [2c]
Dealt to Player13 [8c 5h Ah] [Jd]
Play er9 bets $30
Player13 calls $30
*** 7TH STREET ***
Play er9 bets $30
Player13 calls $30
*** SHOW DOWN ***
Play er9 shows [5c 4h 2s 6c Ac 2c 2h] three of a kind, Twos, for high and 6,5,4,2,A, for low
Player13 mucks
Play er9 wins the high pot ($125) with three of a kind, Twos
Play er9 wins the low pot ($125) with 6,5,4,2,A
*** SUMMARY ***
Total pot $252 | Rake $2
Seat 1: Player_8 is sitting out
Seat 2: Play er9 collected ($250)
Seat 3: P layer10 is sitting out
Seat 4: Player_11 folded on 3rd St.
Seat 5: Player1 2 is sitting out
Seat 6: Player13 mucked
Seat 7: Player14 is sitting out
Seat 8: Player15 folded on 3rd St.

View File

@ -0,0 +1,40 @@
This file is outdated!
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1
From Table sites
====================
site_name: Full Tilt Poker
From Table gametypes
====================
type: category: studhilo limit_type:
sb: bb: sbet: bbet:
From Table hands
================
site_hand_no: 6367428246 hand_start: 2008-05-11 04:47:38 seat_count: 4
From Table hands_players
========================
player_name:Play er9 player_startcash:30350 ante:300 cards:5c 4h 2s 6c Ac 2c 2h winnings:25000 rake:200
player_name:Player_11 player_startcash:16400 ante:300 cards:?? ?? 3c ?? ?? ?? ?? winnings:0 rake:0
player_name:Player13 player_startcash:91250 ante:300 cards:?? ?? 8c 5h Ah Jd ?? winnings:0 rake:0
player_name:Player15 player_startcash:53150 ante:300 cards:?? ?? Jc ?? ?? ?? ?? winnings:0 rake:0
From Table hands_actions
========================
player_name:Play er9 actionCount:0 street:3 streetActionNo:0 action:blind amount:500
player_name:Play er9 actionCount:1 street:3 streetActionNo:1 action:call amount:1000
player_name:Play er9 actionCount:2 street:4 streetActionNo:0 action:call amount:1500
player_name:Play er9 actionCount:3 street:5 streetActionNo:0 action:call amount:3000
player_name:Play er9 actionCount:4 street:6 streetActionNo:0 action:bet amount:3000
player_name:Play er9 actionCount:5 street:7 streetActionNo:0 action:bet amount:3000
player_name:Player_11 actionCount:0 street:3 streetActionNo:0 action:fold amount:0
player_name:Player13 actionCount:0 street:3 streetActionNo:0 action:bet amount:1500
player_name:Player13 actionCount:1 street:4 streetActionNo:0 action:bet amount:1500
player_name:Player13 actionCount:2 street:5 streetActionNo:0 action:bet amount:3000
player_name:Player13 actionCount:3 street:6 streetActionNo:0 action:call amount:3000
player_name:Player13 actionCount:4 street:7 streetActionNo:0 action:call amount:3000
player_name:Player15 actionCount:0 street:3 streetActionNo:0 action:fold amount:0

View File

@ -0,0 +1,48 @@
This file is outdated!
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1
From Table hands
================
site_hand_no: 6929537410 hand_start: 2008-06-22 22:15:44 seat_count: 9 category: omahahi
Board cards: 4s Kc 8s 6s Qc
From Table hands_players
========================
player_name:player16 player_startcash:9490 position:BB cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player25 player_startcash:14700 position:6 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player18 player_startcash:6280 position:5 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player19 player_startcash:13655 position:4 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:play-er26 player_startcash:5605 position:3 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player21 player_startcash:25295 position:2 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player22 player_startcash:20000 position:1 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player23 player_startcash:16250 position:Btn cards:Td 5s 3d Js winnings:1140 rake:60
player_name:player24 player_startcash:27070 position:SB cards:?? ?? ?? ?? winnings:0 rake:0
From Table hands_actions
========================
player_name:player16 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:100
player_name:player16 actionCount:1 street:Preflop streetActionNo:1 action:check amount:0
player_name:player16 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:player16 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
player_name:player16 actionCount:4 street:Turn streetActionNo:1 action:fold amount:0
player_name:player25 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:player18 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:player19 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:play-er26 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:player21 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:player22 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:100
player_name:player22 actionCount:1 street:Preflop streetActionNo:1 action:check amount:0
player_name:player22 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:player22 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
player_name:player22 actionCount:4 street:Turn streetActionNo:1 action:fold amount:0
player_name:player23 actionCount:0 street:Preflop streetActionNo:0 action:call amount:100
player_name:player23 actionCount:1 street:Flop streetActionNo:0 action:check amount:0
player_name:player23 actionCount:2 street:Turn streetActionNo:0 action:bet amount:400
player_name:player23 actionCount:3 street:River streetActionNo:0 action:check amount:0
player_name:player24 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:50
player_name:player24 actionCount:1 street:Preflop streetActionNo:1 action:call amount:50
player_name:player24 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:player24 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
player_name:player24 actionCount:4 street:Turn streetActionNo:1 action:call amount:400
player_name:player24 actionCount:5 street:River streetActionNo:0 action:check amount:0

View File

@ -0,0 +1,47 @@
This file is outdated!
Connected to MySQL on localhost. Print Hand Utility
options.site: Full Tilt Poker site_id: 1
From Table hands
================
site_hand_no: 6929553738 hand_start: 2008-06-22 22:17:06 seat_count: 9 category: omahahi
Board cards: Jc 4c Kc 7h 8s
From Table hands_players
========================
player_name:player16 player_startcash:9390 position:SB cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player17 player_startcash:10000 position:BB cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player18 player_startcash:6280 position:6 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player19 player_startcash:13655 position:5 off Btn cards:4s Tc As Ac winnings:3325 rake:175
player_name:play-er26 player_startcash:5605 position:4 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player21 player_startcash:25295 position:3 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player22 player_startcash:19900 position:2 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player23 player_startcash:16890 position:1 off Btn cards:?? ?? ?? ?? winnings:0 rake:0
player_name:player24 player_startcash:26570 position:Btn cards:?? ?? ?? ?? winnings:0 rake:0
From Table hands_actions
========================
player_name:player16 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:50
player_name:player16 actionCount:1 street:Preflop streetActionNo:1 action:call amount:150
player_name:player16 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:player16 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
player_name:player16 actionCount:4 street:Turn streetActionNo:1 action:fold amount:0
player_name:player17 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:100
player_name:player17 actionCount:1 street:Preflop streetActionNo:1 action:call amount:100
player_name:player17 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:player17 actionCount:3 street:Turn streetActionNo:0 action:check amount:0
player_name:player17 actionCount:4 street:Turn streetActionNo:1 action:call amount:350
player_name:player17 actionCount:5 street:River streetActionNo:0 action:check amount:0
player_name:player17 actionCount:6 street:River streetActionNo:1 action:call amount:1000
player_name:player18 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:player19 actionCount:0 street:Preflop streetActionNo:0 action:bet amount:200
player_name:player19 actionCount:1 street:Flop streetActionNo:0 action:check amount:0
player_name:player19 actionCount:2 street:Turn streetActionNo:0 action:bet amount:350
player_name:player19 actionCount:3 street:River streetActionNo:0 action:bet amount:1000
player_name:play-er26 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:player21 actionCount:0 street:Preflop streetActionNo:0 action:call amount:200
player_name:player21 actionCount:1 street:Flop streetActionNo:0 action:check amount:0
player_name:player21 actionCount:2 street:Turn streetActionNo:0 action:fold amount:0
player_name:player22 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:player23 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:player24 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,68 @@
Connected to MySQL on localhost. Print Player Flags Utility
Basic Data
==========
bigBet: 4 category: holdem limitType: fl name: Player_5 gameType: ring site: PokerStars
siteId: 2 gametypeId: 1 playerId: 5 hudDataId: 12
HUD Raw Hand Counts
===================
HDs: 1
street0VPI: 0
street0Aggr: 0
street0_3B4BChance: 0
street0_3B4BDone: 0
street1Seen: 1
street2Seen: 1
street3Seen: 1
street4Seen: 0
sawShowdown: 1
street1Aggr: 1
street2Aggr: 1
street3Aggr: 0
street4Aggr: 0
otherRaisedStreet1: 0
otherRaisedStreet2: 1
otherRaisedStreet3: 1
otherRaisedStreet4: 0
foldToOtherRaisedStreet1: 0
foldToOtherRaisedStreet2: 0
foldToOtherRaisedStreet3: 0
foldToOtherRaisedStreet4: 0
wonWhenSeenStreet1: 0.0
wonAtSD: 0.0
stealAttemptChance: 0
stealAttempted: 0
foldBbToStealChance: 0
foldedBbToSteal: 0
foldSbToStealChance: 0
foldedSbToSteal: 0
street1CBChance: 0
street1CBDone: 0
street2CBChance: 0
street2CBDone: 0
street3CBChance: 0
street3CBDone: 0
street4CBChance: 0
street4CBDone: 0
foldToStreet1CBChance: 0
foldToStreet1CBDone: 0
foldToStreet2CBChance: 0
foldToStreet2CBDone: 0
foldToStreet3CBChance: 0
foldToStreet3CBDone: 0
foldToStreet4CBChance: 0
foldToStreet4CBDone: 0
totalProfit:
street1CheckCallRaiseChance:
street1CheckCallRaiseDone:
street2CheckCallRaiseChance:
street2CheckCallRaiseDone:
street3CheckCallRaiseChance:
street3CheckCallRaiseDone:
street4CheckCallRaiseChance: 0
street4CheckCallRaiseDone: 0

View File

@ -0,0 +1,68 @@
Connected to MySQL on localhost. Print Player Flags Utility
Basic Data
==========
bigBet: 50 category: holdem limitType: fl name: player3 gameType: ring site: PokerStars
siteId: 2 gametypeId: 2 playerId: 11 hudDataId: 22
HUD Raw Hand Counts
===================
HDs: 1
street0VPI: 1
street0Aggr: 1
street0_3B4BChance: 1
street0_3B4BDone: 1
street1Seen: 1
street2Seen: 1
street3Seen: 1
street4Seen: 0
sawShowdown: 1
street1Aggr: 1
street2Aggr: 0
street3Aggr: 0
street4Aggr: 0
otherRaisedStreet1: 0
otherRaisedStreet2:
otherRaisedStreet3:
otherRaisedStreet4: 0
foldToOtherRaisedStreet1: 0
foldToOtherRaisedStreet2: 0
foldToOtherRaisedStreet3: 0
foldToOtherRaisedStreet4: 0
wonWhenSeenStreet1: 0.0
wonAtSD: 0.0
stealAttemptChance: 0
stealAttempted: 0
foldBbToStealChance: 0
foldedBbToSteal: 0
foldSbToStealChance: 0
foldedSbToSteal: 0
street1CBChance: 1
street1CBDone: 1
street2CBChance: 0
street2CBDone: 0
street3CBChance: 0
street3CBDone: 0
street4CBChance: 0
street4CBDone: 0
foldToStreet1CBChance: 0
foldToStreet1CBDone: 0
foldToStreet2CBChance: 0
foldToStreet2CBDone: 0
foldToStreet3CBChance: 0
foldToStreet3CBDone: 0
foldToStreet4CBChance: 0
foldToStreet4CBDone: 0
totalProfit:
street1CheckCallRaiseChance: 0
street1CheckCallRaiseDone: 0
street2CheckCallRaiseChance: 0
street2CheckCallRaiseDone: 0
street3CheckCallRaiseChance: 0
street3CheckCallRaiseDone: 0
street4CheckCallRaiseChance: 0
street4CheckCallRaiseDone: 0

View File

@ -0,0 +1,68 @@
Connected to MySQL on localhost. Print Player Flags Utility
Basic Data
==========
bigBet: 4 category: holdem limitType: fl name: Player_1 gameType: ring site: PokerStars
siteId: 2 gametypeId: 1 playerId: 1 hudDataId: 8
HUD Raw Hand Counts
===================
HDs: 2
street0VPI: 0
street0Aggr: 0
street0_3B4BChance: 0
street0_3B4BDone: 0
street1Seen: 0
street2Seen: 0
street3Seen: 0
street4Seen: 0
sawShowdown: 0
street1Aggr: 0
street2Aggr: 0
street3Aggr: 0
street4Aggr: 0
otherRaisedStreet1: 0
otherRaisedStreet2: 0
otherRaisedStreet3: 0
otherRaisedStreet4: 0
foldToOtherRaisedStreet1: 0
foldToOtherRaisedStreet2: 0
foldToOtherRaisedStreet3: 0
foldToOtherRaisedStreet4: 0
wonWhenSeenStreet1: 0.0
wonAtSD: 0.0
stealAttemptChance: 0
stealAttempted: 0
foldBbToStealChance: 0
foldedBbToSteal: 0
foldSbToStealChance: 0
foldedSbToSteal: 0
street1CBChance: 0
street1CBDone: 0
street2CBChance: 0
street2CBDone: 0
street3CBChance: 0
street3CBDone: 0
street4CBChance: 0
street4CBDone: 0
foldToStreet1CBChance: 0
foldToStreet1CBDone: 0
foldToStreet2CBChance: 0
foldToStreet2CBDone: 0
foldToStreet3CBChance: 0
foldToStreet3CBDone: 0
foldToStreet4CBChance: 0
foldToStreet4CBDone: 0
totalProfit: 0
street1CheckCallRaiseChance: 0
street1CheckCallRaiseDone: 0
street2CheckCallRaiseChance: 0
street2CheckCallRaiseDone: 0
street3CheckCallRaiseChance: 0
street3CheckCallRaiseDone: 0
street4CheckCallRaiseChance: 0
street4CheckCallRaiseDone: 0

View File

@ -0,0 +1,68 @@
Connected to MySQL on localhost. Print Player Flags Utility
Basic Data
==========
bigBet: 20 category: studhilo limitType: fl name: br1an gameType: ring site: PokerStars
siteId: 2 gametypeId: 3 playerId: 21 hudDataId: 32
HUD Raw Hand Counts
===================
HDs: 1
street0VPI: 0
street0Aggr: 0
street0_3B4BChance: 0
street0_3B4BDone: 0
street1Seen: 1
street2Seen: 1
street3Seen: 1
street4Seen: 1
sawShowdown: 1
street1Aggr: 0
street2Aggr: 0
street3Aggr: 0
street4Aggr: 0
otherRaisedStreet1: 0
otherRaisedStreet2: 1
otherRaisedStreet3: 0
otherRaisedStreet4: 1
foldToOtherRaisedStreet1: 0
foldToOtherRaisedStreet2: 0
foldToOtherRaisedStreet3: 0
foldToOtherRaisedStreet4: 0
wonWhenSeenStreet1: 0.0
wonAtSD: 0.0
stealAttemptChance: 0
stealAttempted: 0
foldBbToStealChance: 0
foldedBbToSteal: 0
foldSbToStealChance: 0
foldedSbToSteal: 0
street1CBChance: 0
street1CBDone: 0
street2CBChance: 0
street2CBDone: 0
street3CBChance: 0
street3CBDone: 0
street4CBChance: 0
street4CBDone: 0
foldToStreet1CBChance: 0
foldToStreet1CBDone: 0
foldToStreet2CBChance: 0
foldToStreet2CBDone: 0
foldToStreet3CBChance: 0
foldToStreet3CBDone: 0
foldToStreet4CBChance: 0
foldToStreet4CBDone: 0
totalProfit: -0.47
street1CheckCallRaiseChance: 0
street1CheckCallRaiseDone: 0
street2CheckCallRaiseChance: 0
street2CheckCallRaiseDone: 0
street3CheckCallRaiseChance: 0
street3CheckCallRaiseDone: 0
street4CheckCallRaiseChance: 1
street4CheckCallRaiseDone: 0

View File

@ -0,0 +1,169 @@
PokerStars Game #14519394979: Hold'em Limit ($0.02/$0.04) - 2008/01/13 - 00:22:15 (ET)
Table 'Merope' 10-max Seat #1 is the button
Seat 1: Player_1 ($0.75 in chips)
Seat 3: Player_2 ($0.59 in chips)
Seat 4: Player_3 ($1.47 in chips)
Seat 6: Player_4 ($1.98 in chips)
Seat 7: Player_5 ($1.22 in chips)
Seat 8: Player_6 ($0.48 in chips)
Seat 9: Player_7 ($1.39 in chips)
Player_2: posts small blind $0.01
Player_3: posts big blind $0.02
*** HOLE CARDS ***
Dealt to Player_7 [Ts Jh]
Player_4: raises $0.02 to $0.04
Player_5: folds
Player_6: folds
Player_7: folds
Player_1: calls $0.04
Player_2: calls $0.03
Player_3: folds
*** FLOP *** [Qd Th Js]
Player_2: checks
Player_4: bets $0.02
Player_1: calls $0.02
Player_2: calls $0.02
*** TURN *** [Qd Th Js] [2s]
Player_2: checks
Player_4: bets $0.04
Player_1: calls $0.04
Player_2: calls $0.04
*** RIVER *** [Qd Th Js 2s] [7s]
Player_2: checks
Player_4: bets $0.04
Player_1: folds
Player_2: folds
Player_4 collected $0.31 from pot
*** SUMMARY ***
Total pot $0.32 | Rake $0.01
Board [Qd Th Js 2s 7s]
Seat 1: Player_1 (button) folded on the River
Seat 3: Player_2 (small blind) folded on the River
Seat 4: Player_3 (big blind) folded before Flop
Seat 6: Player_4 collected ($0.31)
Seat 7: Player_5 folded before Flop (didn't bet)
Seat 8: Player_6 folded before Flop (didn't bet)
Seat 9: Player_7 folded before Flop (didn't bet)
PokerStars Game #14519420999: Hold'em Limit ($0.02/$0.04) - 2008/01/13 - 00:23:43 (ET)
Table 'Merope' 10-max Seat #4 is the button
Seat 1: Player_1 ($0.65 in chips)
Seat 3: Player_2 ($0.49 in chips)
Seat 4: Player_3 ($1.79 in chips)
Seat 6: Player_4 ($2.05 in chips)
Seat 7: Player_5 ($1.18 in chips)
Seat 8: Player_6 ($0.34 in chips)
Seat 9: Player_7 ($1.35 in chips)
wakked13 will be allowed to play after the button
Player_4: posts small blind $0.01
Player_5: posts big blind $0.02
*** HOLE CARDS ***
Dealt to Player_7 [8d 5d]
Player_6 said, "vn"
Player_6: folds
Player_7: folds
Player_1: folds
Player_2: calls $0.02
Player_3: folds
Player_4: calls $0.01
Player_5: checks
*** FLOP *** [Th Jd 3c]
Player_3 said, "ty"
Player_4: checks
Player_5: bets $0.02
Player_2: calls $0.02
Player_4: calls $0.02
*** TURN *** [Th Jd 3c] [7c]
Player_4: checks
Player_5: bets $0.04
Player_2: raises $0.04 to $0.08
Player_4: folds
Player_5: calls $0.04
*** RIVER *** [Th Jd 3c 7c] [4s]
Player_5: checks
Player_2: bets $0.04
Player_5: calls $0.04
*** SHOW DOWN ***
Player_2: shows [8s 9s] (a straight, Seven to Jack)
Player_5: mucks hand
Player_2 collected $0.35 from pot
*** SUMMARY ***
Total pot $0.36 | Rake $0.01
Board [Th Jd 3c 7c 4s]
Seat 1: Player_1 folded before Flop (didn't bet)
Seat 3: Player_2 showed [8s 9s] and won ($0.35) with a straight, Seven to Jack
Seat 4: Player_3 (button) folded before Flop (didn't bet)
Seat 6: Player_4 (small blind) folded on the Turn
Seat 7: Player_5 (big blind) mucked [Qh Js]
Seat 8: Player_6 folded before Flop (didn't bet)
Seat 9: Player_7 folded before Flop (didn't bet)
PokerStars Game #14519433154: Hold'em Limit ($0.02/$0.04) - 2008/01/13 - 00:24:25 (ET)
Table 'Merope' 10-max Seat #6 is the button
Seat 1: Player_1 ($0.65 in chips)
Seat 3: Player_2 ($0.68 in chips)
Seat 4: Player_3 ($1.79 in chips)
Seat 6: Player_4 ($2.01 in chips)
Seat 7: Player_5 ($1.02 in chips)
Seat 8: Player_6 ($0.34 in chips)
Seat 9: Player_7 ($1.35 in chips)
Player_5: posts small blind $0.01
Player_6: posts big blind $0.02
wakked13: sits out
*** HOLE CARDS ***
Dealt to Player_7 [7c Jh]
Player_7: folds
Player_1: folds
Player_2: folds
Player_3: calls $0.02
Player_4: calls $0.02
Player_5: raises $0.02 to $0.04
Player_6: calls $0.02
Player_3: calls $0.02
Player_4: calls $0.02
*** FLOP *** [4h 9s Ad]
Player_5: checks
Player_6: checks
Player_3: bets $0.02
Player_4: raises $0.02 to $0.04
Player_5: folds
Player_6: folds
Player_3: raises $0.02 to $0.06
Player_4: raises $0.02 to $0.08
Betting is capped
Player_3: calls $0.02
*** TURN *** [4h 9s Ad] [Qc]
Player_3: bets $0.04
Player_4: raises $0.04 to $0.08
Player_3: raises $0.04 to $0.12
Player_4: raises $0.04 to $0.16
Betting is capped
Player_3: calls $0.04
*** RIVER *** [4h 9s Ad Qc] [Ks]
Player_3: bets $0.04
Player_4: raises $0.04 to $0.08
Player_3: raises $0.04 to $0.12
Player_4: raises $0.04 to $0.16
Betting is capped
Player_3: calls $0.04
*** SHOW DOWN ***
Player_4: shows [Ac Td] (a pair of Aces)
Player_3: shows [Ah 9d] (two pair, Aces and Nines)
Player_3 collected $0.92 from pot
*** SUMMARY ***
Total pot $0.96 | Rake $0.04
Board [4h 9s Ad Qc Ks]
Seat 1: Player_1 folded before Flop (didn't bet)
Seat 3: Player_2 folded before Flop (didn't bet)
Seat 4: Player_3 showed [Ah 9d] and won ($0.92) with two pair, Aces and Nines
Seat 6: Player_4 (button) showed [Ac Td] and lost with a pair of Aces
Seat 7: Player_5 (small blind) folded on the Flop
Seat 8: Player_6 (big blind) folded on the Flop
Seat 9: Player_7 folded before Flop (didn't bet)

View File

@ -0,0 +1,62 @@
PokerStars Game #19546605871: Hold'em Limit ($0.25/$0.50) - 2008/08/11 - 20:15:41 (ET)
Table 'Pyxis' 10-max Seat #1 is the button
Seat 1: player10 ($7.75 in chips)
Seat 2: player1 ($11.55 in chips)
Seat 3: player2 ($8.25 in chips)
Seat 4: player3 ($0.90 in chips)
Seat 5: player4 ($10003.50 in chips)
Seat 6: player5 ($13.50 in chips)
Seat 7: player6 ($8 in chips)
Seat 8: player7 ($11.80 in chips)
Seat 9: player8 ($11.05 in chips)
Seat 10: player9 ($11.85 in chips)
player1: posts small blind $0.10
player1 said, "little holy water on the river lol"
player2: posts big blind $0.25
*** HOLE CARDS ***
Dealt to player6 [Ad Ts]
player3: calls $0.25
player4: folds
player5: raises $0.25 to $0.50
player6: calls $0.50
player7: folds
player8: folds
player9: folds
player10: folds
player1: folds
player2: folds
player3: raises $0.25 to $0.75
player5: calls $0.25
player6: calls $0.25
*** FLOP *** [Js 5d 4c]
player3: bets $0.15 and is all-in
player5: calls $0.15
player6: calls $0.15
*** TURN *** [Js 5d 4c] [4s]
player5: bets $0.50
player6: calls $0.50
*** RIVER *** [Js 5d 4c 4s] [6d]
player5: bets $0.50
player6: calls $0.50
*** SHOW DOWN ***
player5: shows [Qc Ac] (a pair of Fours)
player6: mucks hand
player5 collected $1.90 from side pot
player3: shows [9c 7c] (a pair of Fours - lower kicker)
player5 collected $2.95 from main pot
*** SUMMARY ***
Total pot $5.05 Main pot $2.95. Side pot $1.90. | Rake $0.20
Board [Js 5d 4c 4s 6d]
Seat 1: player10 (button) folded before Flop (didn't bet)
Seat 2: player1 (small blind) folded before Flop
Seat 3: player2 (big blind) folded before Flop
Seat 4: player3 showed [9c 7c] and lost with a pair of Fours
Seat 5: player4 folded before Flop (didn't bet)
Seat 6: player5 showed [Qc Ac] and won ($4.85) with a pair of Fours
Seat 7: player6 mucked [Ad Ts]
Seat 8: player7 folded before Flop (didn't bet)
Seat 9: player8 folded before Flop (didn't bet)
Seat 10: player9 folded before Flop (didn't bet)

View File

@ -0,0 +1,42 @@
PokerStars Game #19546637866: Hold'em Limit ($0.25/$0.50) - 2008/08/11 - 20:17:04 (ET)
Table 'Pyxis' 10-max Seat #2 is the button
Seat 1: player1 ($7.75 in chips)
Seat 2: player2 ($11.45 in chips)
Seat 5: player3 ($10003.50 in chips)
Seat 6: player4 ($16.45 in chips)
Seat 7: player5 ($6.10 in chips)
Seat 8: player6 ($11.80 in chips)
Seat 9: player7 ($11.05 in chips)
Seat 10: player8 ($11.85 in chips)
player9 leaves the table
player10: is sitting out
player10 leaves the table
player3: posts small blind $0.10
player4: posts big blind $0.25
*** HOLE CARDS ***
Dealt to player5 [Jh 5d]
Mac Fun K joins the table at seat #4
player5: folds
player6: folds
player7: folds
player8: folds
player1: raises $0.25 to $0.50
player2: folds
player3: folds
player4: folds
Uncalled bet ($0.25) returned to player1
player1 collected $0.60 from pot
player1: doesn't show hand
*** SUMMARY ***
Total pot $0.60 | Rake $0
Seat 1: player1 collected ($0.60)
Seat 2: player2 (button) folded before Flop (didn't bet)
Seat 5: player3 (small blind) folded before Flop
Seat 6: player4 (big blind) folded before Flop
Seat 7: player5 folded before Flop (didn't bet)
Seat 8: player6 folded before Flop (didn't bet)
Seat 9: player7 folded before Flop (didn't bet)
Seat 10: player8 folded before Flop (didn't bet)

View File

@ -0,0 +1,130 @@
PokerStars Game #15043388146: 7 Card Stud Hi/Lo Limit ($0.10/$0.20) - 2008/02/03 - 22:04:15 (ET)
Table 'Lydia' 8-max
Seat 2: olimpicon99 ($5.31 in chips)
Seat 4: PokerPig55 ($1.58 in chips)
Seat 5: VISTA GIRL ($0.83 in chips)
Seat 6: br1an ($5.10 in chips)
Seat 7: steffen780 ($4 in chips)
Seat 8: willowdale ($3.92 in chips)
olimpicon99: posts the ante $0.02
PokerPig55: posts the ante $0.02
VISTA GIRL: posts the ante $0.02
br1an: posts the ante $0.02
steffen780: posts the ante $0.02
willowdale: posts the ante $0.02
*** 3rd STREET ***
Dealt to olimpicon99 [8c]
Dealt to PokerPig55 [Kh]
Dealt to VISTA GIRL [8h]
Dealt to br1an [2d]
Dealt to steffen780 [Kc 9h 9c]
Dealt to willowdale [5s]
br1an: brings in for $0.05
steffen780: calls $0.05
willowdale: calls $0.05
olimpicon99: folds
olimpicon99 leaves the table
PokerPig55: folds
VISTA GIRL: folds
*** 4th STREET ***
Dealt to br1an [2d] [Qh]
Dealt to steffen780 [Kc 9h 9c] [5c]
Dealt to willowdale [5s] [4s]
br1an: checks
steffen780: checks
willowdale: checks
*** 5th STREET ***
Dealt to br1an [2d Qh] [6d]
Dealt to steffen780 [Kc 9h 9c 5c] [8s]
Dealt to willowdale [5s 4s] [Ad]
willowdale: bets $0.20
br1an: calls $0.20
steffen780: folds
*** 6th STREET ***
Dealt to br1an [2d Qh 6d] [6h]
Dealt to willowdale [5s 4s Ad] [5h]
br1an: checks
willowdale: checks
*** RIVER ***
br1an: checks
willowdale: bets $0.20
br1an: calls $0.20
*** SHOW DOWN ***
willowdale: shows [3s 4d 5s 4s Ad 5h 2c] (HI: a straight, Ace to Five; LO: 5,4,3,2,A)
br1an: shows [4c 7d 2d Qh 6d 6h 2h] (HI: two pair, Sixes and Deuces)
willowdale collected $0.51 from pot
willowdale collected $0.51 from pot
*** SUMMARY ***
Total pot $1.07 | Rake $0.05
Seat 2: olimpicon99 folded on the 3rd Street (didn't bet)
Seat 4: PokerPig55 folded on the 3rd Street (didn't bet)
Seat 5: VISTA GIRL folded on the 3rd Street (didn't bet)
Seat 6: br1an showed [4c 7d 2d Qh 6d 6h 2h] and lost with HI: two pair, Sixes and Deuces
Seat 7: steffen780 folded on the 5th Street
Seat 8: willowdale showed [3s 4d 5s 4s Ad 5h 2c] and won ($1.02) with HI: a straight, Ace to Five; LO: 5,4,3,2,A
PokerStars Game #20711747191: Razz Limit ($1/$2) - 2008/09/26 14:36:50 ET
Table 'Siwa III' 8-max
Seat 2: dainmat ($63.15 in chips)
Seat 3: fnJ's ($30.75 in chips)
Seat 4: ambythegreat ($24.90 in chips)
Seat 5: jt studd ($39.90 in chips)
Seat 6: KyleHruby ($11.55 in chips)
Seat 7: nutOmatic ($71.30 in chips)
dainmat: posts the ante $0.10
fnJ's: posts the ante $0.10
ambythegreat: posts the ante $0.10
jt studd: posts the ante $0.10
KyleHruby: posts the ante $0.10
nutOmatic: posts the ante $0.10
*** 3rd STREET ***
Dealt to dainmat [Ts]
Dealt to fnJ's [3s]
Dealt to ambythegreat [5h]
Dealt to jt studd [Ad]
Dealt to KyleHruby [As]
Dealt to nutOmatic [6d Kd Th]
dainmat: brings in for $0.50
fnJ's: calls $0.50
ambythegreat: raises $0.50 to $1
garnishgut joins the table at seat #1
jt studd: folds
KyleHruby: folds
nutOmatic: folds
dainmat: folds
fnJ's: calls $0.50
*** 4th STREET ***
Dealt to fnJ's [3s] [6h]
Dealt to ambythegreat [5h] [4c]
ambythegreat: bets $1
fnJ's: calls $1
*** 5th STREET ***
Dealt to fnJ's [3s 6h] [2h]
Dealt to ambythegreat [5h 4c] [Kh]
fnJ's: bets $2
ambythegreat: calls $2
*** 6th STREET ***
Dealt to fnJ's [3s 6h 2h] [2c]
Dealt to ambythegreat [5h 4c Kh] [5s]
fnJ's: bets $2
ambythegreat: calls $2
*** RIVER ***
fnJ's: bets $2
ambythegreat: calls $2
*** SHOW DOWN ***
fnJ's: shows [9d 5c 3s 6h 2h 2c 4h] (Lo: 6,5,4,3,2)
ambythegreat: mucks hand
fnJ's collected $16.35 from pot
*** SUMMARY ***
Total pot $17.10 | Rake $0.75
Seat 2: dainmat folded on the 3rd Street
Seat 3: fnJ's showed [9d 5c 3s 6h 2h 2c 4h] and won ($16.35) with Lo: 6,5,4,3,2
Seat 4: ambythegreat mucked [6s 7h 5h 4c Kh 5s Jc]
Seat 5: jt studd folded on the 3rd Street (didn't bet)
Seat 6: KyleHruby folded on the 3rd Street (didn't bet)
Seat 7: nutOmatic folded on the 3rd Street (didn't bet)

View File

@ -0,0 +1,49 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars siteId: 2
From Table Hands
================
handId: 1 tableName: Merope siteHandNo: 14519394979 gametypeId: 1 handStart: 2008-01-13 05:22:15 seats: 7 maxSeats: 10
From Table Gametypes
====================
type: ring base: hold category: holdem limitType: fl hiLo: h
sb: 1 bb: 2 sbet: 2 bbet: 4
From Table BoardCards
=====================
Board cards: Qd Th Js 2s 7s
From Table HandsPlayers
=======================
playerName:Player_1 playerStartcash:75 position:Btn cards:?? ?? winnings:0 rake:0
playerName:Player_2 playerStartcash:59 position:SB cards:?? ?? winnings:0 rake:0
playerName:Player_3 playerStartcash:147 position:BB cards:?? ?? winnings:0 rake:0
playerName:Player_4 playerStartcash:198 position:4 off Btn cards:?? ?? winnings:31 rake:1
playerName:Player_5 playerStartcash:122 position:3 off Btn cards:?? ?? winnings:0 rake:0
playerName:Player_6 playerStartcash:48 position:2 off Btn cards:?? ?? winnings:0 rake:0
playerName:Player_7 playerStartcash:139 position:1 off Btn cards:Ts Jh winnings:0 rake:0
From Table HandsActions
=======================
playerName:Player_1 street:Preflop streetActionNo:6 action:call amount:4
playerName:Player_1 street:Flop streetActionNo:2 action:call amount:2
playerName:Player_1 street:Turn streetActionNo:2 action:call amount:4
playerName:Player_1 street:River streetActionNo:2 action:fold amount:0
playerName:Player_2 street:Preflop streetActionNo:0 action:blind amount:1
playerName:Player_2 street:Preflop streetActionNo:7 action:call amount:3
playerName:Player_2 street:Flop streetActionNo:0 action:check amount:0
playerName:Player_2 street:Flop streetActionNo:3 action:call amount:2
playerName:Player_2 street:Turn streetActionNo:0 action:check amount:0
playerName:Player_2 street:Turn streetActionNo:3 action:call amount:4
playerName:Player_2 street:River streetActionNo:0 action:check amount:0
playerName:Player_2 street:River streetActionNo:3 action:fold amount:0
playerName:Player_3 street:Preflop streetActionNo:1 action:blind amount:2
playerName:Player_3 street:Preflop streetActionNo:8 action:fold amount:0
playerName:Player_4 street:Preflop streetActionNo:2 action:bet amount:4
playerName:Player_4 street:Flop streetActionNo:1 action:bet amount:2
playerName:Player_4 street:Turn streetActionNo:1 action:bet amount:4
playerName:Player_4 street:River streetActionNo:1 action:bet amount:4
playerName:Player_5 street:Preflop streetActionNo:3 action:fold amount:0
playerName:Player_6 street:Preflop streetActionNo:4 action:fold amount:0
playerName:Player_7 street:Preflop streetActionNo:5 action:fold amount:0

View File

@ -0,0 +1,49 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars siteId: 2
From Table Hands
================
handId: 2 tableName: Merope siteHandNo: 14519420999 gametypeId: 1 handStart: 2008-01-13 05:23:43 seats: 7 maxSeats: 10
From Table Gametypes
====================
type: ring base: hold category: holdem limitType: fl hiLo: h
sb: 1 bb: 2 sbet: 2 bbet: 4
From Table BoardCards
=====================
Board cards: Th Jd 3c 7c 4s
From Table HandsPlayers
=======================
playerName:Player_1 playerStartcash:65 position:2 off Btn cards:?? ?? winnings:0 rake:0
playerName:Player_2 playerStartcash:49 position:1 off Btn cards:8s 9s winnings:35 rake:1
playerName:Player_3 playerStartcash:179 position:Btn cards:?? ?? winnings:0 rake:0
playerName:Player_4 playerStartcash:205 position:SB cards:?? ?? winnings:0 rake:0
playerName:Player_5 playerStartcash:118 position:BB cards:Qh Js winnings:0 rake:0
playerName:Player_6 playerStartcash:34 position:4 off Btn cards:?? ?? winnings:0 rake:0
playerName:Player_7 playerStartcash:135 position:3 off Btn cards:8d 5d winnings:0 rake:0
From Table HandsActions
=======================
playerName:Player_1 street:Preflop streetActionNo:4 action:fold amount:0
playerName:Player_2 street:Preflop streetActionNo:5 action:call amount:2
playerName:Player_2 street:Flop streetActionNo:2 action:call amount:2
playerName:Player_2 street:Turn streetActionNo:2 action:bet amount:8
playerName:Player_2 street:River streetActionNo:1 action:bet amount:4
playerName:Player_3 street:Preflop streetActionNo:6 action:fold amount:0
playerName:Player_4 street:Preflop streetActionNo:0 action:blind amount:1
playerName:Player_4 street:Preflop streetActionNo:7 action:call amount:1
playerName:Player_4 street:Flop streetActionNo:0 action:check amount:0
playerName:Player_4 street:Flop streetActionNo:3 action:call amount:2
playerName:Player_4 street:Turn streetActionNo:0 action:check amount:0
playerName:Player_4 street:Turn streetActionNo:3 action:fold amount:0
playerName:Player_5 street:Preflop streetActionNo:1 action:blind amount:2
playerName:Player_5 street:Preflop streetActionNo:8 action:check amount:0
playerName:Player_5 street:Flop streetActionNo:1 action:bet amount:2
playerName:Player_5 street:Turn streetActionNo:1 action:bet amount:4
playerName:Player_5 street:Turn streetActionNo:4 action:call amount:4
playerName:Player_5 street:River streetActionNo:0 action:check amount:0
playerName:Player_5 street:River streetActionNo:2 action:call amount:4
playerName:Player_6 street:Preflop streetActionNo:2 action:fold amount:0
playerName:Player_7 street:Preflop streetActionNo:3 action:fold amount:0

View File

@ -0,0 +1,58 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars siteId: 2
From Table Hands
================
handId: 3 tableName: Merope siteHandNo: 14519433154 gametypeId: 1 handStart: 2008-01-13 05:24:25 seats: 7 maxSeats: 10
From Table Gametypes
====================
type: ring base: hold category: holdem limitType: fl hiLo: h
sb: 1 bb: 2 sbet: 2 bbet: 4
From Table BoardCards
=====================
Board cards: 4h 9s Ad Qc Ks
From Table HandsPlayers
=======================
playerName:Player_1 playerStartcash:65 position:3 off Btn cards:?? ?? winnings:0 rake:0
playerName:Player_2 playerStartcash:68 position:2 off Btn cards:?? ?? winnings:0 rake:0
playerName:Player_3 playerStartcash:179 position:1 off Btn cards:Ah 9d winnings:92 rake:4
playerName:Player_4 playerStartcash:201 position:Btn cards:Ac Td winnings:0 rake:0
playerName:Player_5 playerStartcash:102 position:SB cards:?? ?? winnings:0 rake:0
playerName:Player_6 playerStartcash:34 position:BB cards:?? ?? winnings:0 rake:0
playerName:Player_7 playerStartcash:135 position:4 off Btn cards:7c Jh winnings:0 rake:0
From Table HandsActions
=======================
playerName:Player_1 street:Preflop streetActionNo:3 action:fold amount:0
playerName:Player_2 street:Preflop streetActionNo:4 action:fold amount:0
playerName:Player_3 street:Preflop streetActionNo:5 action:call amount:2
playerName:Player_3 street:Preflop streetActionNo:9 action:call amount:2
playerName:Player_3 street:Flop streetActionNo:2 action:bet amount:2
playerName:Player_3 street:Flop streetActionNo:6 action:bet amount:4
playerName:Player_3 street:Flop streetActionNo:8 action:call amount:2
playerName:Player_3 street:Turn streetActionNo:0 action:bet amount:4
playerName:Player_3 street:Turn streetActionNo:2 action:bet amount:8
playerName:Player_3 street:Turn streetActionNo:4 action:call amount:4
playerName:Player_3 street:River streetActionNo:0 action:bet amount:4
playerName:Player_3 street:River streetActionNo:2 action:bet amount:8
playerName:Player_3 street:River streetActionNo:4 action:call amount:4
playerName:Player_4 street:Preflop streetActionNo:6 action:call amount:2
playerName:Player_4 street:Preflop streetActionNo:10 action:call amount:2
playerName:Player_4 street:Flop streetActionNo:3 action:bet amount:4
playerName:Player_4 street:Flop streetActionNo:7 action:bet amount:4
playerName:Player_4 street:Turn streetActionNo:1 action:bet amount:8
playerName:Player_4 street:Turn streetActionNo:3 action:bet amount:8
playerName:Player_4 street:River streetActionNo:1 action:bet amount:8
playerName:Player_4 street:River streetActionNo:3 action:bet amount:8
playerName:Player_5 street:Preflop streetActionNo:0 action:blind amount:1
playerName:Player_5 street:Preflop streetActionNo:7 action:bet amount:3
playerName:Player_5 street:Flop streetActionNo:0 action:check amount:0
playerName:Player_5 street:Flop streetActionNo:4 action:fold amount:0
playerName:Player_6 street:Preflop streetActionNo:1 action:blind amount:2
playerName:Player_6 street:Preflop streetActionNo:8 action:call amount:2
playerName:Player_6 street:Flop streetActionNo:1 action:check amount:0
playerName:Player_6 street:Flop streetActionNo:5 action:fold amount:0
playerName:Player_7 street:Preflop streetActionNo:2 action:fold amount:0

View File

@ -0,0 +1,43 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars siteId: 2
From Table Hands
================
handId: 5 tableName: Lydia siteHandNo: 15043388146 gametypeId: 3 handStart: 2008-02-04 03:04:15 seats: 6 maxSeats: 8
From Table Gametypes
====================
type: ring base: stud category: studhilo limitType: fl hiLo: s
sbet: 10 bbet: 20
From Table BoardCards
=====================
From Table HandsPlayers
=======================
playerName:olimpicon99 playerStartcash:531 ante:2 cards:?? ?? 8c ?? ?? ?? ?? winnings:0 rake:0
playerName:PokerPig55 playerStartcash:158 ante:2 cards:?? ?? Kh ?? ?? ?? ?? winnings:0 rake:0
playerName:VISTA GIRL playerStartcash:83 ante:2 cards:?? ?? 8h ?? ?? ?? ?? winnings:0 rake:0
playerName:br1an playerStartcash:510 ante:2 cards:4c 7d 2d Qh 6d 6h 2h winnings:0 rake:0
playerName:steffen780 playerStartcash:400 ante:2 cards:Kc 9h 9c 5c 8s ?? ?? winnings:0 rake:0
playerName:willowdale playerStartcash:392 ante:2 cards:3s 4d 5s 4s Ad 5h 2c winnings:102 rake:5
From Table HandsActions
=======================
playerName:olimpicon99 street:0 streetActionNo:3 action:fold amount:0
playerName:PokerPig55 street:0 streetActionNo:4 action:fold amount:0
playerName:VISTA GIRL street:0 streetActionNo:5 action:fold amount:0
playerName:br1an street:0 streetActionNo:0 action:blind amount:5
playerName:br1an street:1 streetActionNo:0 action:check amount:0
playerName:br1an street:2 streetActionNo:1 action:call amount:20
playerName:br1an street:3 streetActionNo:0 action:check amount:0
playerName:br1an street:4 streetActionNo:0 action:check amount:0
playerName:br1an street:4 streetActionNo:2 action:call amount:20
playerName:steffen780 street:0 streetActionNo:1 action:call amount:5
playerName:steffen780 street:1 streetActionNo:1 action:check amount:0
playerName:steffen780 street:2 streetActionNo:2 action:fold amount:0
playerName:willowdale street:0 streetActionNo:2 action:call amount:5
playerName:willowdale street:1 streetActionNo:2 action:check amount:0
playerName:willowdale street:2 streetActionNo:0 action:bet amount:20
playerName:willowdale street:3 streetActionNo:1 action:check amount:0
playerName:willowdale street:4 streetActionNo:1 action:bet amount:20

View File

@ -0,0 +1,45 @@
#!/bin/sh
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
echo "Please note for this to work you need to work on an empty database, otherwise some info (the id fields) will be off"
rm *.found.txt
../pyfpdb/CliFpdb.py -p$1 --file=ps-lhe-ring-3hands.txt -x
../pyfpdb/CliFpdb.py -p$1 --file=ps-lhe-ring-3hands.txt -x
echo "it should've reported first that it stored 3, then that it had 3 duplicates"
./PrintHand.py -p$1 --hand=14519394979 > ps.14519394979.found.txt && colordiff ps.14519394979.found.txt ps.14519394979.expected.txt
./PrintHand.py -p$1 --hand=14519420999 > ps.14519420999.found.txt && colordiff ps.14519420999.found.txt ps.14519420999.expected.txt
./PrintHand.py -p$1 --hand=14519433154 > ps.14519433154.found.txt && colordiff ps.14519433154.found.txt ps.14519433154.expected.txt
./PrintPlayerHudData.py -p$1 -oM > ps-flags-M-2hands.found.txt && colordiff ps-flags-M-2hands.found.txt ps-flags-M-2hands.expected.txt
./PrintPlayerHudData.py -p$1 -nPlayer_5 -oB > ps-flags-B-1hands.found.txt && colordiff ps-flags-B-1hands.found.txt ps-flags-B-1hands.expected.txt
../pyfpdb/CliFpdb.py -p$1 --file=ps-lhe-ring-call-3B-preflop-cb-no2b.txt -x
echo "it should've now reported another successful store of 1 hand"
./PrintPlayerHudData.py -p$1 -nplayer3 -oE -e10 -b50 > ps-flags-CBflop.found.txt && colordiff ps-flags-CBflop.found.txt ps-flags-CBflop.expected.txt
../pyfpdb/CliFpdb.py -p$1 --file=ps-studhilo-ring-showdown.txt -x
echo "it should've now reported another successful store of 1 hand"
./PrintHand.py -p$1 --hand=15043388146 > ps.15043388146.found.txt && colordiff ps.15043388146.found.txt ps.15043388146.expected.txt
./PrintPlayerHudData.py -p$1 -nbr1an -o0 -e6 -b20 -cstudhilo> ps-flags-studhilo.found.txt && colordiff ps-flags-studhilo.found.txt ps-flags-studhilo.expected.txt
echo "if everything was printed as expected this worked"

38
utils/dump_db_basedata.py Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import sys
import MySQLdb
db = MySQLdb.connect("localhost", "fpdb", sys.argv[1], "fpdb")
cursor = db.cursor()
print "Connected to MySQL on localhost. Printing dev-supplied base data:"
cursor.execute("SELECT * FROM sites")
print "Sites"
print "====="
print cursor.fetchall()
cursor.execute("SELECT * FROM gametypes")
print "Gametypes"
print "========="
result=cursor.fetchall()
for i in range (len(result)):
print result[i]
cursor.close()
db.close()

83
utils/get_db_stats.py Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/python
#Copyright 2008 Steffen Jobbagy-Felso
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU Affero General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in
#agpl-3.0.txt in the docs folder of the package.
import sys
import MySQLdb
db = MySQLdb.connect("localhost", "fpdb", sys.argv[1], "fpdb")
cursor = db.cursor()
print "Connected to MySQL on localhost. Printing summary stats:"
cursor.execute("SELECT id FROM Players")
print "Players:",cursor.rowcount
cursor.execute("SELECT id FROM Autorates")
print "Autorates:",cursor.rowcount
cursor.execute("SELECT id FROM Sites")
print "Sites:",cursor.rowcount
cursor.execute("SELECT id FROM Gametypes")
print "Gametypes:",cursor.rowcount
cursor.execute("SELECT id FROM Hands")
print "Total Hands:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='ring'")
print "Hands, Ring:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='stt'")
print "Hands, STT:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='mtt'")
print "Hands, MTT:",cursor.rowcount
print ""
print "Hands per category and type"
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.limitType='cn'")
print "Hands, Cap No Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.limitType='cp'")
print "Hands, Cap Pot Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='nl'")
print "Hands, Holdem No Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='pl'")
print "Hands, Holdem Pot Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='fl'")
print "Hands, Holdem Fixed Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='nl'")
print "Hands, Omaha Hi No Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='pl'")
print "Hands, Omaha Hi Pot Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='fl'")
print "Hands, Omaha Hi Fixed Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='nl'")
print "Hands, Omaha Hi/Lo No Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='pl'")
print "Hands, Omaha Hi/Lo Pot Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='fl'")
print "Hands, Omaha Hi/Lo Fixed Limit:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='razz'")
print "Hands, Razz:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='studhi'")
print "Hands, Stud Hi:",cursor.rowcount
cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='studhilo'")
print "Hands, Stud Hi/Lo:",cursor.rowcount
print ""
cursor.execute("SELECT id FROM BoardCards")
print "Board_cards:",cursor.rowcount
cursor.execute("SELECT id FROM HandsPlayers")
print "Hands_players:",cursor.rowcount
cursor.execute("SELECT id FROM HandsActions")
print "Hands_actions:",cursor.rowcount
cursor.close()
db.close()

29
website/contact.php Executable file
View File

@ -0,0 +1,29 @@
<?php
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Contact</h1>
<p>The best means of contact are on the <a href="http://sourceforge.net/projects/fpdb/">sourceforge page</a>: Use the bug, feature request or patch functions or just post in the forum. The forum requires a sourceforge account, but bug, feature request and patches don't seem to.</p>
<p>We also have a mailing list, to subscribe please <a href="https://lists.sourceforge.net/lists/listinfo/fpdb-main">click here</a>. This is used for development purposes and you can also ask for help using the mailing list.</p>
<p>To be informed of fpdb updates please visit <a href="https://sourceforge.net/project/showfiles.php?group_id=226872">the sf download page</a> and click on the little envelope with a plus sign in the line of the package that you want be informed off. For Windows user that will be both, Linux users should only subscribe to fpdb itself. This requires a sourceforge account, sorry.</p>
<p>Alternatively feel free to contact me directly:</p>
<p>mail: steffen(at)sycamoretest.info<br>
jabber/xmpp/Google Talk: steffen-laptop-temp(at)sycamoretest.info (don't email that)<br>
ICQ: 7806355<br>
MSN: steffen(at)sycamoretest.info</p>
</div>
<?php
require 'footer.php';
?>

8
website/default.conf Normal file
View File

@ -0,0 +1,8 @@
db-backend=2
db-host=localhost
db-databaseName=fpdb
db-user=fpdb
db-password=enterYourPwHere
tv-combinedPostflop=True
bulkImport-defaultPath=default
tv-defaultPath=default

65
website/docs-abreviations.php Executable file
View File

@ -0,0 +1,65 @@
<?php
$PAGE_TITLE = 'Abreviations';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Abreviations</h1>
<p>HUD/table viewer<br>
================<br>
A3-7=3rd-7th street Complete/Raise percentage<br>
AF=Flop Bet/Raise percentage<br>
AT=River Bet/Raise percentage<br>
AR=Turn Bet/Raise percentage<br>
F3-7=3rd-7th street Fold percentage<br>
FF=Flop Fold percentage<br>
FR=River Fold percentage<br>
FT=Turn Fold percentage<br>
HD=Hands<br>
PF3B4B=Pre Flop 3Bet or 4Bet<br>
PFR=Pre Flop Raise<br>
Postf A=Postflop (ie. flop+turn+river) Aggression%<br>
Postf F=Postflop Fold %<br>
SD/F=Showdown/Flop=WtSD=How often player went to showdown when he saw the flop<br>
W$wsF=Won $ when he saw flop<br>
W$@SD=Won $ at showdown<br>
VPI3=Voluntary Put In on 3rd Street (ie. call+complete+raise)<br>
VPIP=Voluntary Put In Preflop (ie. call+raise)<br>
<br>
Other<br>
=====<br>
CLI=Command Line Interface (Shell, Terminal, "DOS-window")<br>
FTP=Full Tilt Poker<br>
GUI=Graphical User Interface (normal interface with buttons and menus)<br>
HUD=Heads-Up Display (shows stats directly in the poker software)<br>
PS=PokerStars<br>
MTT=Multi Table Tournament<br>
SnG=Sit and Go<br>
<br>
License<br>
=======<br>
Trademarks of third parties have been used under Fair Use or similar laws.<br>
<br>
Copyright 2008 Steffen Jobbagy-Felso<br>
Permission is granted to copy, distribute and/or modify this<br>
document under the terms of the GNU Free Documentation License,<br>
Version 1.2 as published by the Free Software Foundation; with<br>
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover<br>
Texts. A copy of the license can be found in fdl-1.2.txt<br>
<br>
The program itself is licensed under AGPLv3, see agpl-3.0.txt<br>
</p>
</div>
<?php
require 'footer.php';
?>

23
website/docs-benchmarks.php Executable file
View File

@ -0,0 +1,23 @@
<?php
$PAGE_TITLE = 'Abreviations';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Benchmarks</h1>
<p>Check this page from time to time and they will come.</p>
</div>
<?php
require 'footer.php';
?>

View File

@ -0,0 +1,61 @@
<?php
$PAGE_TITLE = 'Git Instructions';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Git Instructions</h1>
<p>Hi, welcome to my minimal git guide for fpdb devs!<br>
You can use a git version just as user as well of course, but as there are generally hardly tested it is not advised.<br>
I'll expand this on request, if you have any questions just send me a mail at steffen(at)sycamoretest.info. There's also a bunch of instructions at http://www.assembla.com/spaces/fpdb/trac_git_tool</p>
<h2>0. Getting it</h2>
<p>To get git for gentoo just do emerge git -av<br>
To get it for Windows go to http://code.google.com/p/msysgit/downloads/list and install it.
<h2>1. Cloning the fpdb git tree</h2>
<p>Just create a new directory (lets say ~/fpdb/ ), go into it and type:<br>
git clone git://git.assembla.com/fpdb.git</p>
<h2>2. Making your changes</h2>
<p>You can use whatever you want to do edit the files. I personally use nedit and occassionally Eclipse.</p>
<h2>3. Making a (local) commit</h2>
<p>Unlike in svn you don't need to be online to make your commits. First we need to tell git what to commit, so go to the root of your fpdb directory and type:<br>
git-add--interactive<br>
Now press u and enter. It will display a list of all changed files. If you want to commit all files just press * and enter twice to return to the main menu. If you want to commit only certain ones press the number of the file and enter and repeat until you have all the files. Then press enter again to return to the main menu.<br>
If you added any new files press a and Enter, then type the number of your new file and press Enter twice. Press q to leave git-add--interactive.<br>
Now create a file for your commit message (I call it since_last_commit.txt) but don't add this to the repository. In the first line of this file put a summary of your changes. Then give some details of your changes, try to mention anything non-trivial and definitely any user-visible bug fixes.<br>
Then run this:<br>
git-commit -F since_last_commit.txt <br>
<h2>4a. Pushing the changes to your own public git tree</h2>
<p>Do this OR 4b, not both.<br>
todo</p>
<h2>4b. Preparing changeset for emailing/uploading</h2>
<p>Do this OR 4a, not both.<br>
todo</p>
<h2>5. Pulling updates from the main tree</h2>
<p>todo</p>
<h2>License</h2>
<p>Trademarks of third parties have been used under Fair Use or similar laws.<br>
<br>
Copyright 2008 Steffen Jobbagy-Felso<br>
Permission is granted to copy, distribute and/or modify this<br>
document under the terms of the GNU Free Documentation License,<br>
Version 1.2 as published by the Free Software Foundation; with<br>
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover<br>
Texts. A copy of the license can be found in fdl-1.2.txt<br>
<br>
The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
</div>
<?php
require 'footer.php';
?>

169
website/docs-hudHowTo.php Executable file
View File

@ -0,0 +1,169 @@
<?php
$PAGE_TITLE = 'Installing in Windows';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h2> How To Use the HUD</h2>
<h4>3 September, 2008</h4>
<h4>fpdb version alpha 3</h4>
<h3>Initial Configuration</h3>
<p>Install and configure the import/tracker program as detailed elsewhere. You should have this line in your default.conf file.</p>
<code>imp-callFpdbHud=True</code>
<p>When you downloaded fpdb you got an example HUD configuration file named HUD_config.xml.</p>
<p>1. Open the subdirectory where you installed fpdb.</p>
<p>2. Make a backup copy of HUD_config.xml.</p>
<p>3. Check that the db_user and db_pass parameters are the ones you specified during database setup. This line is near the bottom of your config file and specifies the database parameters to be used.</p>
<code>&lt;database db_name="fpdb" db_server="mysql" db_ip="localhost" db_user="fpdb" db_pass="fpdb" db_type="fpdb"&gt;&lt;/database&gt;</code>
<p>This should allow you to use the HUD with the stats and layout in the example configuration file.</p>
<h3>Running the HUD</h3>
<p>1. Open fpdb and select Auto Import from the menu. The fpdb main screen will change to show the autoimport dialog.</p>
<img src="img/docs.HudHowTo1.png" alt="Image of HUD" />
<p>Check that the path is pointing to your hand history subdirectory, if it is not, then click the browse button and select it. ?You can also adjust the interval between imports. Smaller intervals will get your updated HUD data more often, but might cause lag. If you experience lag, increase the interval.</p>
<p>2. Click "Start Autoimport" to start the import. fpdb will automatically start the HUD. When the HUD starts it will open a HUD main window.</p>
<img src="img/docs.HudHowTo2.png" alt="Image of HUD" />
<p>2. This window currently has no purpose other than providing a close button that will cause the HUD to exit.</p>
<p>3. Play a hand of poker (good luck). A few seconds after the completion of the hand the stat windows should overlay the poker client window.</p>
<img src="img/docs.HudHowTo3.png" alt="Image of HUD" />
<p>You will also see a small main window for each table that has a HUD. Clicking the close button on that window will kill the HUD stat windows for that table. The stat windows will not go away automatically when you close the table.</p>
<img src="img/docs.HudHowTo4.png" />
<p>4. Adjust the positions of the stat windows. By default, the stat windows are created without decorations (title bar, border, etc.). Double clicking on a stat will add the decorations to that stat window. You can then use the title bar to move the window and double click again to make the decorations disappear.</p>
<img src="img/docs.HudHowTo5.png" />
<img src="img/docs.HudHowTo6.png" />
<p>5. So play some poker: raise, bet, float, get all-in. You can find out what each stat is by hovering the mouse over the stat and looking at the tool tip. The tool tip also has the name of the player that the stat corresponds to, so it is useful in figuring out which stat window goes where if your windows are not in the right place. You can also get a pop up window with additional stats by single clicking on a stat.</p>
<img src="img/docs.HudHowTo7.png" />
<p>These windows do not automatically update when a new hand is imported, but they can be moved around the same way the stat window are moved. Single clicking anywhere on the popup will make it disappear.</p>
<h3>Configuring Stat Layouts</h3>
<p>OK, back to the HUD_config.xml file--saving a backup would be a good idea. Before you ask, yes, there will be a neat configuration function in the HUD, to make this quicker and easier. We thought you would prefer to have the HUD now rather than wait for us to write the configuration code.</p>
<p>1. Open your HUD_config.xml file in you text editor and scroll down to site entry for the layout you want to configure. For example, if you want to change a layout for Pokerstars, find the line that starts like this.</p>
<code>&lt;site site_name="PokerStars" ...</code>
<p>Below that line you will find several blocks of lines defining the stat layouts for tables with the various numbers of seats. For example the layout for 6-seated tables looks like this:</p>
<code>&lt;layout max="6" width="792" height="546" fav_seat="0&gt;<br>
&lt;location seat="1" x="681" y="119"&gt; &lt;/location&gt;<br>
&lt;location seat="2" x="681" y="301"&gt; &lt;/location&gt;<br>
&lt;location seat="3" x="487" y="369"&gt; &lt;/location&gt;<br>
&lt;location seat="4" x="226" y="369"&gt; &lt;/location&gt;<br>
&lt;location seat="5" x="0" y="301"&gt; &lt;/location&gt;<br>
&lt;location seat="6" x="0" y="119"&gt; &lt;/location&gt;<br>
&lt;/layout&gt;</code>
<p>The first line of this layout specifies that it is for a 6-max (max="6") table that has been sized to 792 x 546 (width="792" height="546"). The fav_seat parameter is not used at this time.</p>
<p>The next 6 lines specify where the stat windows are placed on the poker client window. The x and y positions are measured from the inside upper left of the poker client window. That is x = 0, y = 0 would be the first usable pixel to the right of the window border and below the title bar.</p>
<p>So if you are using the layout in the example above and decide that the stat window for seat 3 is being place 9 pixels too high, you would change the line for seat="3" to be:</p>
<code>&lt;location seat="3" x="487" y="378"&gt; &lt;/location&gt;</code>
<p>If you use smaller or larger client windows you should correct the width and height parameters so that they are up-to-date when automatic resizing is implemented.</p>
<h3>Configuring the Stats Shown in the stat windows</h3>
<p>The definition of the stat window stats is in the "supported games" paragraph of the HUD_config.xml file. For example:</p>
<code>&lt;game game_name="studhilo" db="fpdb" rows="2" cols="3"&gt;<br>
&lt;stat row="0" col="0" stat_name="vpip" tip="tip1" click="tog_decorate" popup="default"&gt; &lt;/stat&gt;<br>
&lt;stat row="0" col="1" stat_name="pfr" tip="tip1" click="tog_decorate" popup="default"&gt; &lt;/stat&gt;<br>
&lt;stat row="0" col="2" stat_name="ffreq_1" tip="tip1" click="tog_decorate" popup="default"&gt; &lt;/stat&gt;<br>
&lt;stat row="1" col="0" stat_name="n" tip="tip1" click="tog_decorate" popup="default"&gt; &lt;/stat&gt;<br>
&lt;stat row="1" col="1" stat_name="wtsd" tip="tip1" click="tog_decorate" popup="default"&gt; &lt;/stat&gt;<br>
&lt;stat row="1" col="2" stat_name="wmsd" tip="tip1" click="tog_decorate" popup="default"&gt; &lt;/stat&gt;<br>
&lt;/game&gt;</code>
<p>The first line specifies the game that this stat paragraph is used for (game = "studhilo") and the number of rows and columns in the stat window. In this case we have specified 2 rows and 3 columns so we can have 2x3 = 6 stats. Rows and columns are numbered from 0, so the 3 columns are numbered 0, 1, and 2.</p>
<p>The subsequent lines in the stat paragraph specify which stats are displayed in the various parts of the window. In this example, vpip is displayed in col 0, row 0.</p>
<p>So to create stat windows with 4 columns of 2 rows you would change the cols parameter in the first line to cols = "4" and add 2 additional rows to specify the stats for row 2, col 3 and row 1, col 3.</p>
<p>The click and tip parameters in this paragraph are not currently used. The popup parameter is explained in the next section.</p>
<h3>Configuring Popup Windows</h3>
<p>Each stat location can display a different popup window when clicked. In the example just above, each of the stats has the "default" popup specified. You can see the definition of the default popup by scrolling farther down in your config file. It should look like this.</p>
<code>&lt;popup_windows&gt;<br>
&lt;pu pu_name="default"&gt;<br>
&lt;pu_stat pu_stat_name = "n"&gt; &lt;/pu_stat&gt;<br>
&lt;pu_stat pu_stat_name = "vpip"&gt; &lt;/pu_stat&gt;<br>
&lt;pu_stat pu_stat_name = "pfr"&gt; &lt;/pu_stat&gt;<br>
...<br>
&lt;pu_stat pu_stat_name = "ffreq_4"&gt; &lt;/pu_stat&gt;<br>
&lt;/pu&gt;<br>
&lt;/popup_windows&gt;</code>
<p>You can create a new popup by making a new pu elelment, with a new name and a new list of stats. You then specify that popup name in the popup parameter in one or more of your stats.</p>
<h3>Currently Supported Stats</h3>
<dl>
<dt>a_freq_1</dt> <dd>Flop/4th aggression frequency.</dd>
<dt>a_freq_2</dt> <dd>Turn/5th aggression frequency.</dd>
<dt>a_freq_3</dt> <dd>River/6th aggression frequency.</dd>
<dt>a_freq_4</dt> <dd>7th street aggression frequency.</dd>
<dt>cb_1</dt> <dd>Flop continuation bet.</dd>
<dt>cb_2</dt> <dd>Turn continuation bet.</dd>
<dt>cb_3</dt> <dd>River continuation bet.</dd>
<dt>cb_4</dt> <dd>7th street continuation bet.</dd>
<dt>f_BB_steal</dt> <dd>Folded BB to steal.</dd>
<dt>f_SB_steal</dt> <dd>Folded SB to steal.</dd>
<dt>ffreq_1</dt> <dd>Flop/4th fold frequency.</dd>
<dt>ffreq_2</dt> <dd>Turn/5th fold frequency.</dd>
<dt>ffreq_3</dt> <dd>River/6th fold frequency.</dd>
<dt>ffreq_4</dt> <dd>7th fold frequency.</dd>
<dt>n</dt> <dd>Number of hands played.</dd>
<dt>pfr</dt> <dd>Preflop (3rd street) raise.</dd>
<dt>saw_f</dt> <dd>Saw flop/4th.</dd>
<dt>steal</dt> <dd>Steal %.</dd>
<dt>three_B_0</dt> <dd>Three bet preflop/3rd.</dd>
<dt>vpip</dt> <dd>Voluntarily put $ in the pot.</dd>
<dt>wmsd</dt> <dd>Won $ at showdown.</dd>
<dt>wtsd</dt> <dd>Went to SD when saw flop/4th.</dd>
<dt>WMsF</dt> <dd>Won $ when saw flop/4th.</dd>
</dl>
<?php
require 'footer.php';
?>

85
website/docs-install-gentoo.php Executable file
View File

@ -0,0 +1,85 @@
<?php
$PAGE_TITLE = 'Installing in Gentoo';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Installing in Gentoo Linux</h1>
<p>Last checked: 3 Aug 2008, git99<br><br>
These instructions are for Gentoo GNU/Linux, but if you adapt the steps installing and starting stuff it should work on any other OS as well.<br><br>
1. Install everything. Check if anything is already installed and if it is remove it from the command.<br><br>
For mysql:<br>
emerge mysql mysql-python pygtk -av<br>
/etc/init.d/mysql start<br>
rc-update add mysql default<br><br>
For postgresql:<br>
emerge postgresql pygresql pygtk <br>
/etc/init.d/postgresql start<br>
rc-update add postgresql default<br>
<br><br>
2. Manual configuration steps<br>
<br>
emerge --config mysql<br>
The --config step will ask you for the mysql root user - set this securely, we will create a seperate account for fpdb<br>
<br><br>
3. Create a mysql user and a database<br>
Now open a shell (aka command prompt aka DOS window):<br>
Click Start, then Run. In the opening window type "cmd" (without the inverted commas) and then click OK. A windows with a black background should open.<br><br>
Type (replacing yourPassword with the root password for MySQL you specified during installation):<br>
mysql --user=root --password=yourPassword<br><br>
It should say something like this:<br>
Welcome to the MySQL monitor. Commands end with ; or \g.<br>
Your MySQL connection id is 4<br>
Server version: 5.0.60-log Gentoo Linux mysql-5.0.60-r1<br>
<br>
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br>
<br>
mysql&gt;<br>
<br>
Now create the actual database. The default name is fpdb, I recommend you keep it. Type this:<br>
CREATE DATABASE fpdb;<br>
Next you need to create a user. I recommend you use the default fpdb. Type this (replacing newPassword with the password you want the fpdb user to have - this can, but for security shouldn't, be the same as the root mysql password):<br>
GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;<br><br>
Copy the .conf file from this directory to ~/.fpdb/profiles/default.conf and edit it according to what you configured just now, in particular you will definitely have to put in the password you configured. I know this is insecure, will fix it before stable release.<br>
<br>
4. Guided installation steps<br>
Run the GUI as described in readme-user and click the menu database -&gt; recreate tables<br>
<br>
That's it! Now see readme-user.txt for usage instructions.<br>
<br>
License<br>
=======<br>
Trademarks of third parties have been used under Fair Use or similar laws.<br>
<br>
Copyright 2008 Steffen Jobbagy-Felso<br>
Permission is granted to copy, distribute and/or modify this<br>
document under the terms of the GNU Free Documentation License,<br>
Version 1.2 as published by the Free Software Foundation; with<br>
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover<br>
Texts. A copy of the license can be found in fdl-1.2.txt<br>
<br>
The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
</div>
<?php
require 'footer.php';
?>

208
website/docs-install-windows.php Executable file
View File

@ -0,0 +1,208 @@
<?php
$PAGE_TITLE = 'Installing in Windows';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Before You Begin</h1>
<p>Most people should install using the <a href="http://sourceforge.net/project/showfiles.php?group_id=226872">Installer</a>. These instructions have not been updated recently, but can serve as a guide to someone who knows what he is doing. Unless you have a special reason for installing manually, you really should be using the installer.</p>
<h1>Vista Users</h1>
<p>The installer does not install mysql properly on Microsoft Vista installations, due to the UAC. You should first install mysql using this <a href="http://port25.technet.com/videos/research/MySQL_Windows.pdf">how to (pdf)</a>. Then run the installer. The installer will detect the mysql installation and not reintstall.</p>
<h1>Installing in Windows</h1>
<div class="winInst">
<p>These instructions were made with Windows XP. They should also work with Windows NT / 2000 / 2003 and 2008. Please report any differences to gmic at users.sourceforge.net.
<p>If you're still using Win3/95/98/ME then you should switch to GNU/Linux, *BSD or WinXP.</p>
<div class="screenshot">
<img src="img/00.mySqlWebsite1.jpg" alt="windows install guide screenshot" />
<p><strong>1.</strong> Click <a href="http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.67-win32.zip/from/pick#mirrors">here</a> to open the <a href="http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.67-win32.zip/from/pick#mirrors">MySQL Download Page</a>. Click on the "No, thanks..." link to see the download links for the MySQL installer.</p>
</div>
<div class="screenshot">
<img src="img/01.mySqlWebsite2.jpg" alt="windows install guide screenshot" />
<p><strong>2.</strong> Click on one of the HTTP or FTP download links to download the zip file (mysql-5.0.67-win32.zip).</p>
</div>
<div class="screenshot">
<img src="img/02.mySqlSetup1.jpg" alt="windows install guide screenshot" />
<p><strong>3.</strong> Unzip the setup file to a folder of your choice and double-click on it. On the welcome screen click "Next".</p>
</div>
<div class="screenshot">
<img src="img/03.mySqlSetup3.jpg" alt="windows install guide screenshot" />
<p><strong>4.</strong> As the setup type "Typical" should be selected. Then click "Next". On the following screen click "Install" and installation will begin.</p>
</div>
<div class="screenshot">
<img src="img/04.mySqlSetup5.jpg" alt="windows install guide screenshot" />
<p><strong>5.</strong> Before the installation ends an ad for MySQL Enterprise edition will appear. Just click "Next" two times.</p>
</div>
<div class="screenshot">
<img src="img/05.mySqlSetup7.jpg" alt="windows install guide screenshot" />
<p><strong>6.</strong> Now make sure that "Configure the MySQL Server now" is checked and click "Finish".</p>
</div>
<div class="screenshot">
<img src="img/06.mySqlConfig1.jpg" alt="windows install guide screenshot" />
<p><strong>7.</strong> You are now looking at the MySQL Configuration Wizard. Click "Next".</p>
</div>
<div class="screenshot">
<img src="img/07.mySqlConfig2.jpg" alt="windows install guide screenshot" />
<p><strong>8.</strong> Make sure "Detailed Configuration" is selected. Then click "Next. Now "Developer machine" should be selected. Click "Next".</p>
</div>
<div class="screenshot">
<img src="img/08.mySqlConfig4.jpg" alt="windows install guide screenshot" />
<p><strong>9.</strong> On this screen "Multifunctional Database should be selected. Click "Next". On the next screen (InnoDB Tablespace) just click "Next".</p>
</div>
<div class="screenshot">
<img src="img/09.mySqlConfig7.jpg" alt="windows install guide screenshot" />
<p><strong>10.</strong> Now "Decision Support" should be selected. Click "Next". Now make sure "Enable TCP/IP Networking" <strong>IS</strong> selected. Then click "Next".</p>
</div>
<div class="screenshot">
<img src="img/10.mySqlConfig8.jpg" alt="windows install guide screenshot" />
<p><strong>11.</strong> Here "Standard Character Set" should be selected. Click "Next". Now make sure <strong>"Install As Windows Service"</strong> is selected.</p>
</div>
<div class="screenshot">
<img src="img/11.mySqlConfig10.jpg" alt="windows install guide screenshot" />
<p><strong>12.</strong> Now choose a root password. This will <strong>NOT</strong> be the password for your poker database. Click "Next".</p>
</div>
<div class="screenshot">
<img src="img/12.mySqlConfig11.jpg" alt="windows install guide screenshot" />
<p><strong>13.</strong> On this last screen of the Configuration Wizard just click "Execute." A few success messages will appear. Click "Finish".</p>
</div>
<div class="screenshot">
<img src="img/13.run.jpg" alt="windows install guide screenshot" />
<p><strong>14.</strong> Now click the Windows Start Button and then click "Run". Click into the white space of the new window, type <code>cmd</code> and hit ENTER.</p>
</div>
<div class="screenshot">
<img src="img/14.shellCdToMySql.jpg" alt="windows install guide screenshot" />
<p><strong>15.</strong> In the newly appeared console window type <code>cd "%PROGRAMFILES%\MySQL\MySQL Server 5.0\bin"</code> and hit ENTER.</p>
</div>
<div class="screenshot">
<img src="img/15.shellMySqlRootLogin.jpg" alt="windows install guide screenshot" />
<p><strong>16.</strong> Type <code>mysql --user=root --password=yourPassword</code> and hit ENTER (replace <code>yourPassword</code> with your chosen root password).</p>
</div>
<div class="screenshot">
<img src="img/16.shellMySqlPrompt.jpg" alt="windows install guide screenshot" />
<p><strong>17.</strong> A few lines followed by <code>mysql&gt;</code> will appear. This is the MySQL command prompt.</p>
</div>
<div class="screenshot">
<img src="img/17.shellMySqlCreateDB.jpg" alt="windows install guide screenshot" />
<p><strong>18.</strong> We will now create your poker database. Type <code>CREATE DATABASE fpdb;</code> and hit ENTER. "Query OK" says we were successful.</p>
</div>
<div class="screenshot">
<img src="img/18.shellMySqlCreateUser.jpg" alt="windows install guide screenshot" />
<p><strong>19.</strong> Type the following, <strong>replace</strong> <code>newPassword</code> with a password of your choice and hit ENTER:</p>
<p><code>GRANT ALL PRIVILEGES ON fpdb.* TO 'fpdb'@'localhost' IDENTIFIED BY 'newPassword' WITH GRANT OPTION;</code></p>
</div>
<div class="screenshot">
<img src="img/19.shellMySqlUserCreated.jpg" alt="windows install guide screenshot" />
<p><strong>20.</strong> Again it says "Query OK". Type <code>exit</code> and hit ENTER to exit the MySQL prompt. <strong>Leave this window open.</strong> We will need it later.</p>
</div>
<div class="screenshot">
<img src="img/20.pythonInst.jpg" alt="windows install guide screenshot" />
<p><strong>21.</strong> Click <a href="http://www.python.org/ftp/python/2.5.2/python-2.5.2.msi">here</a>, save the file python-2.5.2.msi where you want and double-click on it. In case of a warning window click "Execute".</p>
</div>
<div class="screenshot">
<img src="img/21.pythonInst4.jpg" alt="windows install guide screenshot" />
<p><strong>22.</strong>Click "Next" three times. Python will install. Then click finish.</p>
</div>
<div class="screenshot">
<img src="img/22.mySqlPythonInst1.jpg" alt="windows install guide screenshot" />
<p><strong>23.</strong> Click <a href="http://downloads.sourceforge.net/mysql-python/MySQL-python-1.2.2.win32-py2.5.exe?modtime=1173863337&big_mirror=0">here</a>, save MySQL-python-1.2.2.win32-py2.5.exe to a folder of your choice and double click it. In case of a warning window click "Execute". Click "Next" three times. The Python API for MySQL will install. Click "Finish".</p>
</div>
<div class="screenshot">
<img src="img/23.shellMkDirGtk.jpg" alt="windows install guide screenshot" />
<p><strong>24.</strong> In the console window (which we left open) now type: <code>mkdir c:\gtk</code> and hit ENTER. Leave the window open again, we'll need it.</p>
<p>Now click <a href="http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.12/gtk+-bundle-2.12.11.zip">here</a> and save the gtk zip file gtk+-bundle-2.12.11.zip to a folder of your choice. Unzip its contents to C:\gtk</p>
</div>
<div class="screenshot">
<img src="img/24.setGtkPath1.jpg" alt="windows install guide screenshot" />
<p><strong>25.</strong> Now <strong>right-click</strong> "My Computer" (on your Desktop) and click on "Properties". Now click on the tab "Advanced".</p>
</div>
<div class="screenshot">
<img src="img/25.setGtkPath2.jpg" alt="windows install guide screenshot" />
<p><strong>26.</strong> Click the button "Environ Variables". In the lower list of the new window click on "Path" (possibly you need to scroll).</p>
</div>
<div class="screenshot">
<img src="img/26.setGtkPath3.jpg" alt="windows install guide screenshot" />
<p><strong>27.</strong>Now click on the"Edit" button and a new window will pop up. To the value of the variable append <code>;C:\gtk\bin</code> Click Ok three times.</p>
</div>
<div class="screenshot">
<img src="img/27.pycairoInst.jpg" alt="windows install guide screenshot" />
<p><strong>28.</strong> Click <a href="http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/1.4/pycairo-1.4.12-1.win32-py2.5.exe">here</a>, save the file pycairo-1.4.12-1.win32-py2.5.exe to a folder of your choice and double click on it. In case of a warning window click "Execute". Now click "Next" three times. The pycairo graphics library API for Python will install. Click "Finish".</p>
</div>
<div class="screenshot">
<img src="img/28.pygobjectInst.jpg" alt="windows install guide screenshot" />
<p><strong>29.</strong> Click <a href="http://ftp.gnome.org/pub/GNOME/binaries/win32/pygobject/2.14/pygobject-2.14.1-1.win32-py2.5.exe">here</a>, save the file pygobject-2.14.1-1.win32-py2.5.exe to a folder of your choice and double click on it. In case of a warning click "Execute". Now click "Next" three times. The Python Gobject API will install. Click "Finish".</p>
</div>
<div class="screenshot">
<img src="img/29.pyGtkInst.jpg" alt="windows install guide screenshot" />
<p><strong>30.</strong> Click <a href="http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.12/pygtk-2.12.1-2.win32-py2.5.exe">here</a>, save the file pygtk-2.12.1-2.win32-py2.5.exe to a folder of your choice and double click on it. In case of a warning click "Execute". Now click "Next" three times. The Python API for Gtk+ will install. Click "Finish".</p>
</div>
<div class="screenshot"> <img src="img/30.shellMkDirProfiles.jpg" alt="windows install guide screenshot" />
<p><strong>31.</strong> In the console window now type: <code>mkdir "%homepath%\Application Data\fpdb"</code> and hit ENTER. Copy the file "default.conf" from the docs folder of your fpdb git to the directory C:\%homepath%\Application Data\fpdb\.</p>
</div>
<div class="screenshot">
<img src="img/31.editDbProfile.jpg" alt="windows install guide screenshot" />
<p><strong>32.</strong> Now open the file "default.conf" in WordPad (Start &gt; Programs &gt; Accessoirs &gt; WordPad) and replace the password in the <code>dbpassword</code> line with your chosen password for the fpdb user. </p>
</div>
<div class="screenshot">
<img src="img/32.startFpdb.jpg" alt="windows install guide screenshot" />
<p><strong>33.</strong> Now start FPDB by double-clicking on the file fpdb.py in the folder fpdb. A console window should open up and shortly thereafter the fpdb application window should be visible. Click on the menu "Database" and select "Create or Recreate Tables".</p>
</div
<div class="screenshot">
<p><strong>Congratulations! Your fpdb installation is complete! Now you can use the bulk importer to import your hands into fpdb.</strong>
</div>
</div>
<p>A word on privelege separation: fpdb should not require root/Administrator rights to run. If it does it is a bug or serious misconfiguration, please let us know.</p>
<h4>License</h4>
<p>Trademarks of third parties have been used under Fair Use or similar laws.</p>
<p>Copyright 2008 Steffen Jobbagy-Felso</p>
<p>Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 as published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found in fdl-1.2.txt. The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<?php
require 'footer.php';
?>

84
website/docs-overview.php Executable file
View File

@ -0,0 +1,84 @@
<?php
$PAGE_TITLE = 'Overview';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Overview</h1>
<p>
Summary<br>
=======<br>
A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Supports Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future. Some of this is not yet working though, please see status.txt and known-bugs-and-planned-features.txt<br>
<br>
But you could send all my hand histories to yourself!<br>
=====================================================<br>
At the end of the day this comes down to a question of trust, but unlike Windows and the poker client software you don't have to trust fpdb blindly. You can:<br>
- Verify the source code yourself.<br>
- Convince or pay someone to verify the source code for you.<br>
- Use a personal firewall to completely block fpdb from the Internet<br>
- (for the uber-paranoid) Get yourself the free virtualisation software VirtualBox, set up a VM (virtual machine) to run fpdb but run the poker software on your real PC. Then cut the VM off the Internet, fpdb doesn't need it. If you have a PC made in the last few years this should run fast enough as well. Note that most Windows licenses do NOT permit you to use two Windows installations at once, even if they are on the same PC.<br>
<br>
Requirements<br>
============<br>
Software requirements are listed in requirements.txt<br>
As for hardware, my main test machine is a Pentium 3-M 800 with 256 RAM and Gentoo GNU/Linux<br>
(running the poker client through what most people will call emulation). So this<br>
program will have to work on that. If you run an even more ancient machine and<br>
its too slow let me know and I'll see what I can do :)<br>
<br>
Why Free Software?<br>
==================<br>
This program is released under the terms of the free/libre software license AGPL3 as released by the FSF. The AGPL3 protects your rights and those of the wider community. As Richard Stallman, one of the founders of the free software movement, put it: "Free software is a matter of liberty, not price. To understand the concept, you should think of free as in free speech, not as in free beer." (well, it is both really, like the right to vote used to be free)<br>
<br>
For example, a "pirated" copy of proprietary software X is free of charge, but you don't actually have a legal right to use it, you don't have any possibility to fix its bugs and you certainly don't have any legal right to share it with your friends. You also won't be able to get support, often not even security fixes. Actually, even if you pay hundreds of pounds for your program they deny your right to fix their errors for them. Imagine buying a car where you're not permitted (under threat of jail) to replace broken parts..<br>
<br>
With free/libre software (also known as open source software, or short FOSS or FLOSS) on the other hand you get all these freedoms:<br>
(note: the legally binding terms are in the license text, this is merely an amateur summary so normal people don't have to read pages of legalese)<br>
<br>
Freedom 0: The freedom to use: To run the program, for any purpose. Free of Charge.<br>
Freedom 1: The freedom to study and help yourself. This freedom guarantees your right to study and learn from the source code of the program, and to fix it if it is broken. If you're not a programmer yourself the developers will generally be happy to fix it for you, often even for free. Failing that you can always pay someone from the money you saved on not having to pay for it.<br>
Freedom 2: The freedom to be a decent human being and help your neighbour: I don't threaten you with lawsuits or jail time if you share with your friends and neighbours, subject to the very modest restrictions of the AGPL3.<br>
Freedom 3: The freedom to improve the program and release your improvements to the public (or parts thereof) so that the whole community benefits. Note that you are PERMITTED, but not REQUIRED to distribute your changes. If you do distribute your changes you must do so under the terms of the AGPL3 however.<br>
<br>
Note that this is the license - I retain full copyright over my code, including the right to change the license for future versions. I do not intend to do this however. In any case, any version I released under AGPL3 remains available under that license forever, or more accurately until my copyright expires at which point it goes into the public domain.<br>
<br>
I reject the concept of software patents as a crime and under the European Patent Agreement software patents - even if you mislabel them as "computer-implemented inventions" or whatever - are explicitly prohibited.<br>
<br>
Can I get/use this under a different license?<br>
=============================================<br>
The short answer: Maybe.<br>
The long one: As detailed, I fully support what the FSF does and aims to achieve with the GPL. However, I realise that many free software developers don't object to closed source, some don't even object to closed source profiteering of their charity, and I don't think I have any right to go and tell them they're wrong.<br>
So if anyone wishes to use all or part of my code in another free software/open source project with an AGPL3-incompatible license such as BSD then let me know and we'll figure out a solution that makes everyone happy.<br>
If you wish to use all or part of this in closed source let me know how much if anything that is worth to you and I'm sure we'll be able to reach an agreement. Note that you are NOT permitted to just use fpdb code in closed source development whether in-house or by an independent software developer, you will NEED an additionally agreement with me to get fpdb under different licensing conditions.<br>
<br>
<br>
License of this Document<br>
========================<br>
The views expressed in this document are those of Steffen Jobbagy-Felso, other members of the fpdb team and external contributors may or may not agree.<br>
<br>
Trademarks of third parties have been used under Fair Use or similar laws.<br>
<br>
Copyright 2008 Steffen Jobbagy-Felso<br>
Permission is granted to copy, distribute and/or modify this<br>
document under the terms of the GNU Free Documentation License,<br>
Version 1.2 as published by the Free Software Foundation; with<br>
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover<br>
Texts. A copy of the license can be found in fdl-1.2.txt<br>
<br>
The program itself is licensed under AGPLv3, see agpl-3.0.txt<br>
</p>
</div>
<?php
require 'footer.php';
?>

170
website/docs-requirements.php Executable file
View File

@ -0,0 +1,170 @@
<?php
$PAGE_TITLE = 'Requirements';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Requirements</h1>
<p>
I recommend using a free/libre operating system, meaning a GNU/Linux distribution or a BSD variant (e.g. Gentoo GNU/Linux or OpenBSD) for ethical and practical reasons. Would you buy a car where you're prohibited from opening the bonnet under threat of jail? If the answer is no you should by the same logic not use closed source software for real money Poker :)<br>
<br>
Unfortunately you will always need one piece of unfree software: The poker client itself. Although not a direct dependency of fpdb you obviously will have a hard time putting this to productive use without running some poker client. As far as I know, only unfree clients are available. If you know better please let me know!<br>
<br>
If you can be bothered please do contact your poker site(s) and ask them to release free/libre clients, even if it is only for Windows. But lets be realistic, the chance of a positive answer is very low. Also, even unfree Linux client would of course be a great step forward<br>
<br>
In Windows use of the environment installer is recommended, pls see our sf download page. For Gentoo Linux we have an ebuild and for Ubuntu Linux we have (partial) instructions. If you use a different Linux or a BSD and have trouble please IM, email or post in the forums. Fpdb has been reported to work on MacOSX, but installation of the requirements is relatively painful. Any instructions for people to use would be much appreciated.<br>
<br>
Make new entries in this format:<br>
<b>Program Name</b><br>
a. Optional?<br>
b. Required Version and Why<br>
c. Project Webpage<br>
d. License</p>
<h2>Database backend - MySQL</h2>
<p>These two are required if you want to use MySQL as backend, which is the recommended choice due to lack of testing and polish of PostgreSQL support.</p>
<p><b>MySQL</b><br>
a. Optional?<br>
Choose MySQL or PostgreSQL<br>
b. Required Version and Why<br>
At least 3.23 required due to mysql-python.<br>
I use 5.0.54 and 5.0.60-r1 (GNU/Linux) and 5.0.51b (Windows).<br>
c. Project Webpage<br>
http://www.mysql.com<br>
d. License<br>
GPL2<br>
<br>
<b>mysql-python</b><br>
a. Optional?<br>
Required if you want to use MySQL backend<br>
b. Required Version and Why<br>
I use 1.2.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.<br>
c. Project Webpage<br>
http://sourceforge.net/projects/mysql-python/<br>
d. License<br>
SF lists GNU General Public License (GPL), Python License (CNRI Python License), Zope Public License.<br>
Project states GPL without version in Pkg-info.</p>
<h2>Database backend - PostgreSQL</h2>
<p>These two are required if you want to use PostgreSQL as backend</p>
<p><b>PostgreSQL</b><br>
a. Optional?<br>
Choose MySQL or PostgreSQL<br>
b. Required Version and Why<br>
I use 8.0.15 (GNU/Linux) and 8.3.3 (Windows) but I am not aware of any incompatibilities<br>
with older or newer versions, pls report success/failure.<br>
c. Project Webpage<br>
http://www.postgresql.org<br>
d. License<br>
BSD License<br>
<br>
<b>psycopg</b><br>
a. Optional?<br>
Required if you want to use PostgreSQL backend<br>
b. Required Version and Why<br>
I use 2.0.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.<br>
c. Project Webpage<br>
http://initd.org/projects/psycopg2<br>
d. License<br>
GPL2 according to Gentoo's ebuilds<br>
<br>
<h2>Required for everyone</h2>
<p><b>Python</b><br>
a. Optional?<br>
Required.<br>
b. Required Version and Why<br>
I use 2.4.4 and 2.5.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.<br>
c. Project Webpage<br>
http://www.python.org<br>
d. License<br>
Python License<br>
<br>
<p><b>GTK+ and dependencies</b><br>
a. Optional?<br>
Required.<br>
b. Required Version and Why<br>
I use 2.12.9 but it should run with 2.10 or higher. That is needed as I used MessageDialog updates<br>
c. Project Webpage<br>
Main: http://www.gtk.org/<br>
API spec: http://library.gnome.org/devel/gtk/2.12/<br>
Windows DLs (get the bundle unless you know what you're doing): http://www.gtk.org/download-windows.html<br>
d. License<br>
LGPL2<br>
<br>
<b>PyCairo</b><br>
a. Optional?<br>
Required.<br>
b. Required Version and Why<br>
?<br>
c. Project Webpage<br>
main: http://www.pygtk.org<br>
d. License<br>
LGPL2.1<br>
<br>
<b>PyGObject</b><br>
a. Optional?<br>
Required.<br>
b. Required Version and Why<br>
?<br>
c. Project Webpage<br>
main: http://www.pygtk.org<br>
d. License<br>
LGPL2.1<br>
<br>
<b>PyGTK</b><br>
a. Optional?<br>
Required.<br>
b. Required Version and Why<br>
?<br>
c. Project Webpage<br>
main: http://www.pygtk.org<br>
d. License<br>
LGPL2.1</p>
<h2>Requirements for the graphing function</h2>
<p>These are only required if you wish to use the graphing function, and fpdb will otherwise function without them</p>
<p><b>Numpy</b><br>
a. Optional?<br>
Optional.<br>
b. Required Version and Why<br>
I use 1.0.4 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.<br>
c. Project Webpage<br>
http://numeric.scipy.org/<br>
d. License<br>
BSD according to Gentoo's ebuild<br>
<br>
<b>matplotlib</b><br>
a. Optional?<br>
Optional.<br>
b. Required Version and Why<br>
I use 0.91.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.<br>
c. Project Webpage<br>
http://matplotlib.sourceforge.net/<br>
d. License<br>
BSD according to Gentoo's ebuild</p>
License (of this file)<br>
=======<br>
Trademarks of third parties have been used under Fair Use or similar laws.<br>
<br>
Copyright 2008 Steffen Jobbagy-Felso<br>
Permission is granted to copy, distribute and/or modify this<br>
document under the terms of the GNU Free Documentation License,<br>
Version 1.2 as published by the Free Software Foundation; with<br>
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover<br>
Texts. A copy of the license can be found in fdl-1.2.txt<br>
<br>
The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
</div>
<?php
require 'footer.php';
?>

64
website/docs-usage.php Executable file
View File

@ -0,0 +1,64 @@
<?php
$PAGE_TITLE = 'Usage instructions';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Usage instructions</h1>
<p>Before you do this make sure you setup the dependencies, the database, user, tables and config file.<br>
<br>
Running it<br>
==========<br>
If you have python setup properly you can execute it by double clicking pyfpdb/fpdb.py.<br>
<br>
Note however that all error messages are currently only printed if you call it from a shell. It'll be much easier to diagnose possible problems (which are likely in alpha stage) if you run it from a shell. In Windows XP it seems to automatically open a shell window with the fpdb window where you can see the command line output.<br>
<br>
In Linux/MacOS/*BSD, e.g. if its in /home/sycamore/fpdb/, do this:<br>
cd /home/sycamore/fpdb/pyfpdb<br>
python fpdb.py<br>
<br>
That will start the main GUI.<br>
<br>
Have a look at the menus, the stuff that is marked todo is not yet implemented.<br>
<br>
The main things are the bulk importer and the table viewer. To use the importer open it from the menu (import files and directories). You can set a few options at the bottom, then select a folder or single file in the main are and click Import. Please report any errors by one of the contacts listed in readme-overview.txt.<br>
Currently this will block the interface, but you can open another instance of this program e.g. if you wanna play whilst a big import is running. <br>
<br>
Please check the output at the shell for errors, if there are any please get in touch by one of the methods listed in readme-overview.txt<br>
<br>
Table Viewer (tv)<br>
=================v
To use the table viewer open it from the menu, select the hand history file of the table you're at, and click the Import&Read&Refresh button. The abbreviations there are explained in abbreviations.txt, but feel free to ask. Note that most poker software will only create the file once the first hand you payed to play is finished.<br>
In each column there is either just the number (hand count for current stake, range of seats and type of game) or a percentage and the number of hands that this percentage is based on. For example, in W$@SD (won $ at shodown) the number in brackets is how many showdowns that player has seen.<br>
<br>
Reimporting<br>
===========<br>
Currently on most updates a reimport of the whole database is required. To do this open fpdb, click the menu Database and select Create/Recreate tables. Then import all your history files again.<br>
<br>
License<br>
=======
Trademarks of third parties have been used under Fair Use or similar laws.<br>
<br>
Copyright 2008 Steffen Jobbagy-Felso<br>
Permission is granted to copy, distribute and/or modify this<br>
document under the terms of the GNU Free Documentation License,<br>
Version 1.2 as published by the Free Software Foundation; with<br>
no Invariant Sections, no Front-Cover Texts, and with no Back-Cover<br>
Texts. A copy of the license can be found in fdl-1.2.txt<br>
<br>
The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
</div>
<?php
require 'footer.php';
?>

37
website/docs.php Executable file
View File

@ -0,0 +1,37 @@
<?php
$PAGE_TITLE='Documentation';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Documentation</h1>
<ul>
<li><a href="docs-overview.php">Overview</a></li>
<li><a href="docs-requirements.php">Requirements</a></li>
</ul>
<ul>
<li><a href="docs-install-windows.php">Install in Windows</a></li>
<li><a href="docs-install-gentoo.php">Install in Gentoo Linux</a></li>
<li><a href="default.conf">Default configuration file</a> (read the installation instructions)</li>
<li><a href="docs-git-instructions.php">Git instructions</a></li>
</ul>
<ul>
<li><a href="docs-hudHowTo.php">HOW TO Use the HUD</a></li>
<li><a href="docs-usage.php">Usage instructions</a></li>
<li><a href="docs-abreviations.php">Abreviations</a></li>
<li><a href="docs-benchmarks.php">Benchmarks</a></li>
</ul>
</div>
<?php
require 'footer.php';
?>

47
website/features.php Executable file
View File

@ -0,0 +1,47 @@
<?php
$PAGE_TITLE = 'Features';
require 'header.php';
require 'sidebar.php';
?>
<div id="main">
<h1>Features</h1>
<p>Backend, Distribution<br>
=====================<br>
- Choice of MySQL/InnoDB or PostgreSQL. (not tested on PostgreSQL)<br>
- It is possible to run the database on one PC, the importer on another, and then access the database with the table viewer or HUD from a third PC. (note: do NOT do this unencrypted over an untrusted network like your employer's LAN or the Internet!)<br>
<br>
Site/Game Support<br>
=================<br>
- Initially only full support for PS, FTP coming soon<br>
- Supports Holdem, Omaha Hi and Omaha Hi/Lo. Stud and Razz coming soon.<br>
- Supports No Limit, Pot Limit, Fixed Limit NL, Cap NL and Cap PL<br>
Note that currently it does not display extra stats for NL/PL so usefulness is limited for these limit types. Suggestions welcome, I don't play these.<br>
- Supports ring/cash games, SnG/MTT coming soon<br>
<br>
Tableviewer (tv)<br>
===========<br>
Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are:<br>
- VPIP, PFR and Preflop 3B/4B (3B/4B is not quite correct I think)<br>
- Raise and Fold % on flop, turn and river. Fold only counts hands when someone raised. This can be displayed per street or as one combined value each for aggression and folding.<br>
- Number of hands this is based on.<br>
- SD/F (aka WtSD, proportion of hands where player went to showdown after seeing flop)<br>
- W$wSF (Won $ when seen Flop)<br>
- W$@SD (Won $ at showdown)<br>
For all stats it also displays how many hands this particular is based on</p>
</div>
<?php
require 'footer.php';
?>

1
website/footer.php Executable file
View File

@ -0,0 +1 @@
<div id="footer"> <a href="http://sourceforge.net"> <img src="http://sflogo.sourceforge.net/sflogo.php?group_id=226872&type=2"> </a> </div> </body> </html>

BIN
website/fpdb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

17
website/header.php Executable file
View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>fpdb - The free poker database - <?php echo ($PAGE_TITLE) ?></title>
<meta name="description" content="Home of fpdb, an open source and free poker tracking software.">
<meta name="keywords" content="fpdb, freepokerdb, poker, tracking, software">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="header">
<div id="logo"><img src="fpdb.png"></div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Some files were not shown because too many files have changed in this diff Show More