git1 - initial git commit. note that right now nothing works due to reworking things

This commit is contained in:
steffen123 2008-08-04 04:44:28 +01:00
commit f17e8b54b4
46 changed files with 8054 additions and 0 deletions

34
docs/abbreviations.txt Normal file
View File

@ -0,0 +1,34 @@
In utility output and HUD
=========================
CLI=Command Line Interface (Shell, Terminal, "DOS-window")
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
FF=Flop Fold percentage
FR=River Fold percentage
FT=Turn Fold percentage
FTP=Full Tilt Poker
GUI=Graphical User Interface (normal interface with buttons and menus)
HD=Hands
HUD=Heads-Up Display (shows stats directly in the poker software)
MTT=Multi Table Tournament
PFR=Pre Flop Raise
PS=PokerStars
SnG=Sit and Go
VPI3=Voluntary Put In on 3rd Street (ie. call+complete+raise)
VPIP=Voluntary Put In Preflop (ie. call+raise)
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

25
docs/codingstyle.txt Normal file
View File

@ -0,0 +1,25 @@
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 to.
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
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

6
docs/default.conf Normal file
View File

@ -0,0 +1,6 @@
backend=2
host=localhost
database=fpdb
user=fpdb
password=enterYourPwHere

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.

74
docs/filelist.txt Executable file
View File

@ -0,0 +1,74 @@
todo: update filelist.txt
File list
=========
.:
docs/ Documentation files
importer/ Directory with the importer (in python)
setup/ Directory with files for setting up this program
testdata/ Directory with test data
utils/ A good abbreviation for "all the crap that doesn't fit in anywhere else"
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.txt This file
status.txt Details of support for poker sites
tabledesign.odt The table design master (OpenDocument file, MS Office needs plugin)
tabledesign.html Table design copy (HTML file)
./importer:
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

27
docs/git-instructions.txt Normal file
View File

@ -0,0 +1,27 @@
Hi, welcome to my minimal git guide for fpdb devs!
I'll expand this on request, if you have any questions just send me a mail at steffen@sycamoretest.info.
How to make a local git commit
==============================
go to the root of your fpdb directory and type:
git-add--interactive
If you added any new files press a and Enter, then type the number of your new file and press Enter twice. If you made any changes to existing files press u and enter. If you want to commit all changes press * and Enter twice. Press q to leave git-add--interactive.
Then 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. If you wish to you can also add in a revision number. My tree (the "central" or "official" repository) uses the format gitX where X is a running number, e.g. git91 is followed by git92. Then give some details of your changes, try to mention anything non-trivial and definitely any user-visible bug fixes. If the table design has been changed that has to be mentioned in the first line.
Then run this:
git-commit -F since_last_commit.txt
todo: how to pull/push changes to/from me
todo: git-diff, git-rm, git-mv
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,45 @@
Last checked: 3 Aug 2008, git99
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.
1. Install everything. Check if anything is already installed and if it is remove it from the command.
For mysql:
emerge mysql mysql-python pygtk -av
/etc/init.d/mysql start
rc-update add mysql default
For postgresql:
emerge postgresql pygresql pygtk
/etc/init.d/postgresql start
rc-update add postgresql default
2. Manual configuration steps
emerge --config mysql
The --config step will ask you for the mysql root user - set this securely, we will create a seperate account for fpdb
Create a user and a database, the default names are fpdb but you can choose whatever you want to. I did this in webmin, but it will be added to the GUI as well. Then set permissions for that user to: Select | Insert | Update | Delete | Create | Drop
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. YES, THIS IS INSECURE.
3. Guided installation steps
Run the GUI as described in readme-user and click the menu database -> recreate tables
That's it!
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,74 @@
These instructions are for 32/64bit Windows NT/2k/XP/2k3/Vista/2k8. Well, in principle. I
made them in XP Pro, if you discover any differences or problems please let me know. If you're still on Win3/95/98/ME then you should switch to GNU/Linux, *BSD or WinXP.
Also see the other install-in-*.txt files.
The length of these instructions is due to MS refusal to provide any kind of package management.
For some packages I've given direct(ish) download links here, for the remainder check requirements.txt.
1a. Install MySQL and do its basic setup
Download Windows ZIP/Setup.exe from http://dev.mysql.com/downloads/mysql/5.0.html#win32
Note that there is a link to skip registration/login.
As of this writing the latest binary version is 5.0.51b whilst the latest version is 5.0.56... Windows.
- Unzip the archive, execute the setup file
At the end make sure you activate that you want to configure it now.
Use the advanced/detailed config. Leave everything as default unless stated below, or unless you have reason not to.
Make sure to DEACTIVATE TCP/IP networking, unless you want that and know how to secure it
Activate "include bin directory in windows PATH"
Set a root password. Note that this is not the account/pw that fpdb will use.
Once finished it shold confirm "service started successfully"
2. Install python
Go to http://www.python.org/download/ and get the latest Windows installer. As of this writing that is 2.5.2. Double click the .msi file to start installation and follow the prompts.
3. Install the Python-DBAPI package for MySQL:
Go to http://sourceforge.net/project/showfiles.php?group_id=22307 and get the latest version of MySQL-python-1.2.2.win32-py2.5.exe
Double click to install.
4. In MySQL create a new database fpdb and a user by the same name. Set a password. I did this in webmin. Then set permissions for that user to: Select | Insert | Update | Delete | Create | Drop
5. Time for GTK+ - here's the instructions from their bundle
To use it, create some empty folder like c:\gtk . Using either
Windows Explorer's built-in zip file management, or the command-line
unzip.exe from
ftp://tug.ctan.org/tex-archive/tools/zip/info-zip/WIN32/unz552xN.exe
unzip this bundle. (But you presumably already did that, as you are
reading this file.)
Then add the bin folder to your PATH. Make sure you have no other
versions of GTK+ in PATH.
To do that:
Right click on "My Computer" ("Arbeitsplatz" in German Windows) on the Desktop or in (Windows) Explorer. Select Properties. Then click on the tab Advanced and then you should see Environment Variables. Simply append GTK's bin folder to the existing PATH (make sure to put a ; between the old PATH and GTK's folder to seperate the entries in this list).
6. Install pycairo, pygobject and pygtk with double click.
7. Copy the default.conf from the docs folder to the appropriate folder in your system, e.g. C:\Documents and Settings\Nick\Application Data\fpdb\profiles\default.conf
Now edit the file, in particular you will always have to type in the correct password (insecure, I know) and if you differ from the default setup you may need to change host, database or user.
8. Open a shell (aka command prompt, aka DOS window) and go to the fpdb-python folder and run fpdb.py, e.g.:
c:
cd \fpdb\fpdb-python
python fpdb.py
You can run this by double click, but then any error message would be lost.
When the program started open the menu Database and click "Create or Recreate Tables".
That's it! Now you can use the bulk importer and the table viewer, more's coming. See readme-user.txt
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,92 @@
todolist (db=database, imp=importer, tv=tableviewer)
before beta
===========
current speedup attempt todo:
holdem in fpdb_simple done - now update remaining files, test, then add back postflop and stud functionality
import fails on stud/razz
tv doesnt display street 3-5 in stud/razz i think
Any comment or print with "todo" in it in the sourcecode except what is marked todo in the menu
find out if i can SQL for the rowcount, rather than select a field and then just take the rowcount. this might bring a significant performance improvement
make a quick benchmark of mysql and postgresql: import of my whole db, some tableviewer refreshes with and without updated file
fix tv browse button size
tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem
tourney bug: fails recognisePlayer
tourney bug: fails with tuple error in recogniseplayerid
verify at least 2 or 3 sng hands
db+imp+tv WtSD (went to showdown)
db+imp+tv W$SD (won $ when seeing showdown - partial win counts partially here)
db+imp+tv WwSF (Won when seen flop - partial taken into account)
db+imp+tv steal blind from btn, co, lmp. fold SB/BB/BI to steal
remove unused flags fields
update install instructions
setup wizard
change action_no to be total for this street rather than just for one player
catch index error, type error, file not found error
add field for if a game was mixed
implement error file in importer
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
fold% also counts rounds where nobody raised
handle errors properly, in particular wrt to SQL rollback.
remove mysql/myisam support.
check that we read sitout correctly in: Full Tilt Poker Game #6150325318: Table Bogside
setup database, database-user and permission from GUI.
update prepare-git to check for license header and copyright.
change/expand print_hand to cover everything new and update verified hands' .found file
no rush but before 1.0RC
========================
make tv work with ftp e.g. by making importer return site as well (easy)
make the gui display errors
log file
move directory import code from gui to backend
convert fpdb_import to not require passing "self"
(tedious general stability improvement for unusual playernames): change all the str.find so they dont accidentially count player names containing the searched phrase. e.g. with rfind.
Doesn't handle Daylight Saving Time (I don't think at least)
Need to store if someone goes all-in, particularly for better NL/PL support.
verify at least 3 hands per category per site per limit_type (when cap then do 2 normal and one 1 capped) incl tv display
put lines in tv to make it easier to read
speed up so that refresh takes no more than 10 seks on my P3M-800
select range of stakes and sng/mtt values and types for tv
change "for i" to more sensible var name instead of i
change stud street storage from 3-7 to 0-4 throughout
in all importer: stop doing if site=="ftp", make class constants for site_id instead
recognise somewhere if a file is still active and if so keep it open and only read new hands rather than detecting dupes
gentoo ebuild
separate all gui and all processing into files that are named accordingly
ensure that there is only one db handle flying around and that its state is handled properly, ie. by the GUI. i think that might be why we have to reconnect the DB in tableviewer.
why do we have to reconnect in tv.read_names_clicked?
HUD for PokerStars
HTMLify docs
can wait till 1.x
=================
finish cleaning tabledesign html code
It treats fold due to disconnect as voluntary fold which is not ideal
auto-import
check for unnecessary db.commit()
aliases
Probably PartyPoker for all or most supported games
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
windows integrated installer
benchmark properly on mysql innodb, mysql myisam, postgresql, sqlite, more?
rename things like this: ClassName.methodName and variableName. do this on tables too. update codingstyle
CLI (not ncurses, proper CLI) equivalent for fpdb.py
optimise/simplify storing by creating the SQL statements depending on hand rather than calling different methods
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

64
docs/readme-dev.txt Executable file
View File

@ -0,0 +1,64 @@
Hi,
This document is to serve as a first point of contact for current and prospective developers with:
a) organisational/legal things
b) introduction into the code structure
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 and git-instructions.txt or 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
=====================
Please see readme-overview
Dependencies
============
Since all real OS' have easy built in handling for dependencies feel free to add requirements on new libraries etc. Unfortunately due to the reality of the online poker market (namely the complete absence of clients for free/libre systems) it doesn't make sense to write this without supporting Windows so all dependencies must have a source-compatible Windows version. Please ensure to list any new deps in requirements.txt or let me know.
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
-> table viewer tab (table_viewer.py)
All files can call the simple methods that I just collected in fpdb_simple.py, in essence to reduce the other files mostly to high-level calls that direct the execution flow.
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. Why AGPL3? As far as I know it is currently the strongest copyleft license.
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 full 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

84
docs/readme-overview.txt Executable file
View File

@ -0,0 +1,84 @@
Summary
=======
A database program to track your online poker games, the behaviour of the other players and your winnings/losses. Support Holdem, Omaha, Stud and Razz for cash games as well as SnG and MTT tournaments with more possibly coming in the future
Longer summary
==============
This program is poker tracking software, a class of utilities that will record and track every little detail of your poker sessions. Want to know how many times player Y has raised before the flop at your current stakes? This program will tell you - allowing you to make much more accurate reads (poker slang for "[educated] guessing your opponents hand") and as a result better decisions. Of course in poker the end result in $ is never guaranteed, but this software will make it much easier for you.
The software currently supports importing and processing hand history files for:
- Holdem, Omaha (Hi and Hi/Lo), Stud (Hi and Hi/Lo) and Razz (I am not aware of any modern software that supports more than Holdem)
- No Limit, Pot Limit, Fixed Limit and Full Tilt's CapNL and CapPL
- Any stakes
- Cash games, Sit and Gos and Multi Table Tourneys
- All the above from PokerStars, all the above except SnG/Tourney for Full Tilt
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 :)
Contact
=======
Please contact me directly using one of the below (quickest response will be by jabber/xmpp/google talk) until I have setup Savannah.
mail: steffen(at)sycamoretest.info
jabber/xmpp/Google Talk: as above
ICQ: 7806355
MSN: steffenjf@gmx.de (don't email that)
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 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 silly legalese)
Freedom 0: The freedom to use: To run the program, for any purpose.
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. 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 criminal charges 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. This view has been uphelp by numerous courts including the highest German appeals courts for patent matters (BGH-Zivilsenat?).
I therefore do not recognise the validity or applicability of any software patent. I realise that the European Patent Office completely ignores the laws and treaties that govern its operation but that means that EPO management are criminals, not that software patents are valid.
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 open source project with an AGPL3-incompatible license then let me know and we should be able to come to an agreement.
If you wish to use all or part of this in closed source let me know how much that is worth to you :)
Disclaimer, 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

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

@ -0,0 +1,42 @@
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 fpdb-python/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. To do that open a shell (aka command prompt aka DOS window aka terminal) and run the following commands.
For *nix, e.g. if its in /home/sycamore/fpdb/:
cd /home/sycamore/fpdb/fpdb-python
python fpdb.py
In Windows, e.g. if its in C:\Program Files\fpdb
C:
cd "\Program Files\fpdb\fpdb-python\"
python fpdb.py
That will start the main GUI.
Have a look at the menues, 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.
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.
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
Please let us know whether you like this software :)
Contacts are listed in readme-overview or email steffen@sycamoretest.info
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

69
docs/release-notes.txt Executable file
View File

@ -0,0 +1,69 @@
v0.01(alpha) draft (ie. minimum requirements for alpha1)
Hi everyone,
we are proud to announce the first release of our new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why we bothered when now with HM and PT3 there are at least two excellent packages to choose from.
Three main reasons:
1. Fpdb is free/libre open source software. In short, this means you don't depend on us 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 we deserve to be paid contact us :)
2. HM and PT3 only support holdem. Fpdb (initially) supports Holdem, Omaha, Razz and Stud including Hi/Lo versions.
3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs natively on any plattform that has the required software, which will cover roundabout 99.9% of PCs that are in use ;)
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, e.g. HM will require re-activation after some types of partition change. To be fair I should add that the support is fast, friendly and helpful. Nevertheless I just don't appreciate being hassled AFTER I pay.
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 altogether. However the difficult bit (getting it all to work nicely together) for v1 is done, now we "just" need to add lots and lots of options, testing and output.
Current feature list:
Interface
=========
- Central interface programs with tabs (similar to Azureus classic)
- Follows convention on how things are arranged and what they look like.
- Works equally in *nix and Windows (tested on Gentoo GNU/Linux, MacOSX and WinXP)
- Command line interface planned
- DB setup from inside the GUI
- Bulk importer for single files, multiple files, or directories (incl recursion)
- Auto-importer
- Multi-threaded - running the importer doesn't freeze the view tabs and they don't freeze each other either (blocker for beta)
- Profiles (to store different settings)
- HUD (would be nice for alpha but not a blocker for release)
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, ring games also work in FTP.
- Supports Holdem, Omaha, Razz and Stud including Hi/Lo split where applicable
- 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 as well as SnG and MTT tourneys
- Tableviewer (tv) interface to the database. The application is currently single-threaded (though the backend DB doesn't have to be) but I will fix that. Until then you can just open the interface twice, once for import and once for 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, Steal from SB, Steal from BTN, Steal from CO, Avg Steal
- average bet size for NL/PL (blocker for beta)
- 3/4B, 2B, Raise and Fold % on flop, turn and river.
- Aggr % if everyone folded to player in final position of round
- Number of hands this is based on.
- Equivalent functions for Razz/Stud
- 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.
If you can live with alpha/beta software please give this a go and send any feedback, feature requests, bug reports and animal names to steffen@sycamoretest.info. Of course support and feature requests with patches or payment offers will be prioritised.
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 save place with any tracking software.
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

117
docs/requirements.txt Executable file
View File

@ -0,0 +1,117 @@
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 :)
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 ASAP!
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.
Before I start the list a note on the databases, as of git96 I have yet to try using this with PostgreSQL, but if I'm not mistaken it should actually work by now (the stuff in fpdb-python at least).
Make new entries in this format:
X. Program Name
===============
a. Optional?
b. Required Version and Why
c. Project Webpage
d. License
1. MySQL
========
a. Optional?
Choose MySQL or PostgreSQL
b. Required Version and Why
At least 3.23 required due to mysql-python.
I use 5.0.54 and 5.0.60-r1 (GNU/Linux) and 5.0.51b (Windows).
c. Project Webpage
http://www.mysql.com
d. License
GPL2
2. PostgreSQL
=============
a. Optional?
Choose MySQL or PostgreSQL
b. Required Version and Why
I use 8.0.15 (GNU/Linux) and 8.3.3 (Windows) but I am not aware of any incompatibilities
with older or newer versions, pls report success/failure.
c. Project Webpage
http://www.postgresql.org
d. License
BSD License
3. mysql-python
===============
a. Optional?
Required if you want to use MySQL backend
b. Required Version and Why
I use 1.2.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.
c. Project Webpage
http://sourceforge.net/projects/mysql-python/
d. License
SF lists GNU General Public License (GPL), Python License (CNRI Python License), Zope Public License.
Project states GPL without version in Pkg-info.
4. pygresql
===========
a. Optional?
Required if you want to use PostgreSQL backend
b. Required Version and Why
I use 3.6.2 but I am not aware of any incompatibilities with older or newer versions, pls report success/failure.
c. Project Webpage
http://www.pygresql.org/
d. License
http://www.pygresql.org/readme.html#copyright-notice (BSD License?)
Summary: "Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement
is hereby granted[...]" plus Disclaimer.
5. Python
=========
a. Optional?
Required.
b. Required Version and Why
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.
c. Project Webpage
http://www.python.org
d. License
Python License
6. GTK+ and dependencies
=======
a. Optional?
Required.
b. Required Version and Why
I use 2.12.9 but it should run with 2.10 or higher. That is needed as I used MessageDialog updates
c. Project Webpage
Main: http://www.gtk.org/
API spec: http://library.gnome.org/devel/gtk/2.12/
Windows DLs (get the bundle unless you know what you're doing): http://www.gtk.org/download-windows.html
d. License
LGPL2
7. PyGTK
========
a. Optional?
Required.
b. Required Version and Why
I use 2.12.0 but it should run with 2.10. That is needed as I used AccelMap.
c. Project Webpage
main: http://www.pygtk.org
Note for Windows: Due to the lack of package management you have to manually get PyGTK's dependencies (PyCairo and PyGobject).
d. License
LGPL2.1
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

72
docs/status.txt Executable file
View File

@ -0,0 +1,72 @@
For all support please note that the tables will almost certainly be changed without keeping backwards compatibility. Therefore you should keep your history files after import so you can re-import if necessary.
If support for another site/game would encourage you to help with this software please let me know at steffen@sycamoretest.info.
Note for git100 until further notice (not long though): deactivated all import of stud/razz pending update of that code for the new caching tables.
Database
========
Holdem, Omaha Hi/HiLo, Razz and Stud Hi/HiLo in NL/PL/FL are supported for ring games and tourneys. Actual storage tables are nearly final. Support/cache tables for improved viewer speed are in heavy flux.
Importer (imp)
==============
Ringgames on FTP and PS:
Holdem, Omaha Hi/HiLo, Razz and Stud Hi/HiLo in NL/PL/FL/CapNL/CapPL: beta
This should be pretty much done, I imported 30k hands.
Bug reports welcome, please send the hand that caused the error.
Tourney support: on PS alpha, on FTP incomplete, see svn comments.
Mixed Games (e.g. HORSE): alpha
GUI for importer
================
alpha
Most functionality still missing, but thats a backend problem not really a GUI thing.
CLI/automated testing interface
===============================
Simple DB Statistics Script -> migrate to GUI
Simple player stats report script -> migrate to GUI
Hand printout script -> badly needs updating
Simple regression testing script done. Need to updating existing data and create (much) more.
Table Viewer (tv)
=================
pre-alpha
Currently the importer fills a flags table, and tv selects an id field from that and does some things to create the data. Thinking of instead or additionally creating a count table that imp would also directly access. Imp would increment the values for each player that tv currently has to select for - implementing this now, as of git100.
I know tv is rather low on functionality so far, but as soon as I've finished the above update adding more will be easy and quick.
HUD
===
?
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): Let me know what you use (OS/Distribution+version, arch) 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.
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.
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

1289
docs/tabledesign.html Normal file

File diff suppressed because it is too large Load Diff

178
perlfpdb/LibFpdbImport.pm Normal file
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

84
perlfpdb/LibFpdbShared.pm Normal file
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

17
perlfpdb/LibFpdbView.pm Normal file
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.

29
perlfpdb/RunFpdbCLI.perl6 Normal file
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;

21
prepare-git.sh Executable file
View File

@ -0,0 +1,21 @@
#!/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 testdata/*.found.txt
rm utils/*.pyc
rm fpdb-python/*.pyc
git-add--interactive

428
pyfpdb/fpdb.py Executable file
View File

@ -0,0 +1,428 @@
#!/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 pygtk
pygtk.require('2.0')
import gtk
import fpdb_db
import fpdb_simple
import import_threaded
import table_viewer
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"
#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"""
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 dia_setup_wizard(self, path):
print "todo: implement setup wizard"
print "setup wizard not implemented - please create the default configuration file:", path
sys.exit(1)
#end def dia_setup_wizard
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_default_profile(self):
"""Loads the defaut profile"""
defaultpath=os.path.expanduser("~")
if not defaultpath.endswith(os.sep):#todo: check if this is needed in *nix, if not delete it
defaultpath+=(os.sep)
if (os.sep=="\\"):#ie. if Windows use application data folder
defaultpath+=("Application Data"+os.sep)
else:#ie. if real OS prefix fpdb with a . as it is convention
defaultpath+="."
defaultpath+=("fpdb"+os.sep+"profiles"+os.sep+"default.conf")
if os.path.exists(defaultpath):
self.load_profile(defaultpath)
else:
self.dia_setup_wizard(path=defaultpath)
#end def load_default_profile
def load_profile(self, filename):
"""Loads profile from the provided path name. also see load_default_profile"""
self.obtain_global_lock()
file=open(filename, "rU")
lines=file.readlines()
print "Opened and read profile file", filename
self.profile=filename
self.bulk_import_default_path="/work/poker-histories/wine-ps/" #/todo: move this to .conf
found_backend, found_host, found_database, found_user, found_password=False, False, False, False, False
for i in range(len(lines)):
if lines[i].startswith("backend="):
backend=int(lines[i][8:-1])
found_backend=True
elif lines[i].startswith("host="):
host=lines[i][5:-1]
#self.host=host
found_host=True
elif lines[i].startswith("database="):
database=lines[i][9:-1]
#self.database=database
found_database=True
elif lines[i].startswith("user="):
user=lines[i][5:-1]
found_user=True
elif lines[i].startswith("password="):
password=lines[i][9:-1]
found_password=True
if not found_backend:
raise fpdb_simple.FpdbError("failed to read backend from settings file:"+filename)
elif not found_host:
raise fpdb_simple.FpdbError("failed to read host from settings file:"+filename)
elif not found_database:
raise fpdb_simple.FpdbError("failed to read database from settings file:"+filename)
elif not found_user:
raise fpdb_simple.FpdbError("failed to read user from settings file:"+filename)
elif not found_password:
raise fpdb_simple.FpdbError("failed to read password from settings file:"+filename)
if self.db!=None:
self.db.disconnect()
self.db = fpdb_db.fpdb_db()
self.db.connect(backend, host, database, user, password)
#end def load_profile
def not_implemented(self):
print "todo: called unimplemented menu entry"#remove this once more entries are implemented
#end def not_implemented
def obtain_global_lock(self):
print "todo: implement obtain_global_lock"
#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):
print "todo: implement 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=import_threaded.import_threaded(self.db, self.bulk_import_default_path)
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
blabla todo make this read a file for the helptext
blabla
blabla""")
self.add_and_display_tab(mh_tab, "main 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=table_viewer.table_viewer(self.db)
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 __init__(self):
self.threads=[]
self.db=None
self.load_default_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")
self.window.set_border_width(1)
self.window.set_size_request(600,400)
self.window.set_resizable(True)
self.menu_items = (
( "/_Main", None, None, 0, "<Branch>" ),
( "/Main/_Load Profile", "<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/_Import Files and Directories", "<control>I", self.tab_bulk_import, 0, None ),
( "/Import/_Auto Import (todo)", "<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/_Graphs (todo)", None, self.not_implemented, 0, None ),
( "/Viewers/H_and 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", "<control>T", self.tab_table_viewer, 0, None ),
#( "/Viewers/Tourney Replayer
#( "/H_UD", None, None, 0, "<Branch>" ),
( "/_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()

270
pyfpdb/fpdb_db.py Executable file
View File

@ -0,0 +1,270 @@
#!/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 fpdb_simple
class fpdb_db:
def __init__(self):
"""Simple constructor, doesnt really do anything"""
self.db=None
self.cursor=None
self.MYSQL=1
self.MYSQL_INNODB=2
self.PGSQL=3
#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
#print "fpdb_db.connect, password:",password,"/end"
if backend==self.MYSQL or backend==self.MYSQL_INNODB:
import MySQLdb
print "fpdb_db.connect, host:", host, " user:", user, " passwd:", password, " db:", database
self.db=MySQLdb.connect(host = host, user = user, passwd = password, db = database)
elif backend==self.PGSQL:
import pgdb
self.db = pgdb.connect(dsn=host+":"+database, user='postgres', password=password)
else:
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
self.cursor=self.db.cursor()
#end def connect
def create_table(self, string):
"""creates a table for the given string
The string should the name of the table followed by the column list
in brackets as if it were an SQL command. Do NOT include the "CREATE TABLES"
bit at the beginning nor the ";" or ENGINE= at the end"""
string="CREATE TABLE "+string
if (self.backend==self.MYSQL_INNODB):
string+=" ENGINE=INNODB"
string+=";"
#print "create_table, string:", string
self.cursor.execute(string)
self.db.commit()
#end def create_table
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)
#end def disconnect
def drop_tables(self):
"""Drops the fpdb tables from the current db"""
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
self.cursor.execute("DROP TABLE IF EXISTS autorates;")
self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
self.cursor.execute("DROP TABLE IF EXISTS hands;")
self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
self.cursor.execute("DROP TABLE IF EXISTS players;")
self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
self.cursor.execute("DROP TABLE IF EXISTS sites;")
self.db.commit()
#end def drop_tables
def get_backend_name(self):
"""Returns the name of the currently used backend"""
if self.backend==1:
return "MySQL normal"
elif self.backend==2:
return "MySQL InnoDB"
elif self.backend==3:
return "PostgreSQL"
#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 recreate_tables(self):
"""(Re-)creates the tables of the current DB"""
self.drop_tables()
self.create_table("""sites (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
name varchar(32),
currency char(3))""")
self.create_table("""gametypes (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
type char(4),
category varchar(9),
limit_type char(2),
small_blind int,
big_blind int,
small_bet int,
big_bet int)""")
self.create_table("""players (
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
name VARCHAR(32) CHARACTER SET utf8,
site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
comment text,
comment_ts DATETIME)""")
self.create_table("""autorates (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
player_id INT UNSIGNED, FOREIGN KEY (player_id) REFERENCES players(id),
gametype_id SMALLINT UNSIGNED, FOREIGN KEY (gametype_id) REFERENCES gametypes(id),
description varchar(50),
short_desc char(8),
rating_time DATETIME,
hand_count int)""")
self.create_table("""hands (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
site_hand_no bigint,
gametype_id SMALLINT UNSIGNED, FOREIGN KEY (gametype_id) REFERENCES gametypes(id),
hand_start DATETIME,
seats smallint,
comment text,
comment_ts DATETIME)""")
self.create_table("""board_cards (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
PRIMARY KEY (id),
hand_id BIGINT UNSIGNED,
FOREIGN KEY (hand_id) REFERENCES hands(id),
card1_value smallint,
card1_suit char(1),
card2_value smallint,
card2_suit char(1),
card3_value smallint,
card3_suit char(1),
card4_value smallint,
card4_suit char(1),
card5_value smallint,
card5_suit char(1))""")
self.create_table("""tourneys (
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id),
site_tourney_no BIGINT,
buyin INT,
fee INT,
knockout INT,
entries INT,
prizepool INT,
start_time DATETIME,
comment TEXT,
comment_ts DATETIME)""")
self.create_table("""tourneys_players (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
tourney_id INT UNSIGNED, FOREIGN KEY (tourney_id) REFERENCES tourneys(id),
player_id INT UNSIGNED, FOREIGN KEY (player_id) REFERENCES players(id),
payin_amount INT,
rank INT,
winnings INT,
comment TEXT,
comment_ts DATETIME)""")
self.create_table("""hands_players (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
PRIMARY KEY (id),
hand_id BIGINT UNSIGNED,
FOREIGN KEY (hand_id) REFERENCES hands(id),
player_id INT UNSIGNED,
FOREIGN KEY (player_id) REFERENCES players(id),
player_startcash int,
position char(1),
ante int,
card1_value smallint,
card1_suit char(1),
card2_value smallint,
card2_suit char(1),
card3_value smallint,
card3_suit char(1),
card4_value smallint,
card4_suit char(1),
card5_value smallint,
card5_suit char(1),
card6_value smallint,
card6_suit char(1),
card7_value smallint,
card7_suit char(1),
winnings int,
rake int,
comment text,
comment_ts DATETIME,
tourneys_players_id BIGINT UNSIGNED,
FOREIGN KEY (tourneys_players_id) REFERENCES tourneys_players(id))""")
self.create_table("""hands_actions (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT,
PRIMARY KEY (id),
hand_player_id BIGINT UNSIGNED,
FOREIGN KEY (hand_player_id) REFERENCES hands_players(id),
street SMALLINT,
action_no SMALLINT,
action CHAR(5),
amount INT,
comment TEXT,
comment_ts DATETIME)""")
self.create_table("""HudDataHoldemOmaha (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES gametypes(id),
playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES players(id),
activeSeats SMALLINT,
HDs INT,
VPIP INT,
PFR INT,
PF3B4B INT,
sawFlop INT,
sawTurn INT,
sawRiver INT,
sawShowdown INT,
raisedFlop INT,
raisedTurn INT,
raisedRiver INT,
otherRaisedFlop INT,
otherRaisedFlopFold INT,
otherRaisedTurn INT,
otherRaisedTurnFold INT,
otherRaisedRiver INT,
otherRaisedRiverFold INT)""")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit()
print "finished recreating tables"
#end def recreate_tables
#end class fpdb_db

192
pyfpdb/fpdb_import.py Executable file
View File

@ -0,0 +1,192 @@
#!/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
import MySQLdb
#import pgdb
import math
import os
import datetime
import fpdb_simple
import fpdb_parse_logic
from optparse import OptionParser
def import_file(server, database, user, password, inputFile):
self.server=server
self.database=database
self.user=user
self.password=password
self.inputFile=inputFile
import_file_dict(self)
def import_file_dict(options):
last_read_hand=0
if (options.inputFile=="stdin"):
inputFile=sys.stdin
else:
inputFile=open(options.inputFile, "rU")
#connect to DB
db = MySQLdb.connect(host = options.server, user = options.user,
passwd = options.password, db = options.database)
cursor = db.cursor()
if (not options.quiet):
print "Opened file", options.inputFile, "and connected to MySQL on", options.server
line=inputFile.readline()
site=fpdb_simple.recogniseSite(line)
category=fpdb_simple.recogniseCategory(line)
inputFile.seek(0)
lines=fpdb_simple.removeTrailingEOL(inputFile.readlines())
startpos=0
stored=0 #counter
duplicates=0 #counter
partial=0 #counter
errors=0 #counter
for i in range (len(lines)): #main loop, iterates through the lines of a file and calls the appropriate parser method
if (len(lines[i])<2):
endpos=i
hand=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
fpdb_simple.filterAnteBlindFold(site,hand)
hand=fpdb_simple.filterCrap(site, hand)
try:
if (category=="holdem" or category=="omahahi" or category=="omahahilo" or category=="razz" or category=="studhi" or category=="studhilo"):
if (category=="razz" or category=="studhi" or category=="studhilo"):
raise fpdb_simple.FpdbError ("stud/razz currently out of order")
last_read_hand=fpdb_parse_logic.mainParser(db, cursor, site, category, hand)
db.commit()
else:
raise fpdb_simple.FpdbError ("invalid category")
stored+=1
db.commit()
except fpdb_simple.DuplicateError:
duplicates+=1
except (ValueError), fe:
errors+=1
print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it."
print "Filename:",options.inputFile
print "Here is the first line so you can identify it. Please mention that the error was a ValueError:"
print hand[0]
if (options.failOnError):
db.commit() #dont remove this, in case hand processing was cancelled this ties up any open ends.
inputFile.close()
cursor.close()
db.close()
raise
except (fpdb_simple.FpdbError), fe:
errors+=1
print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it."
print "Filename:",options.inputFile
print "Here is the first line so you can identify it."
print hand[0]
#fe.printStackTrace() #todo: get stacktrace
db.rollback()
if (options.failOnError):
db.commit() #dont remove this, in case hand processing was cancelled this ties up any open ends.
inputFile.close()
cursor.close()
db.close()
raise
if (options.minPrint!=0):
if ((stored+duplicates+partial+errors)%options.minPrint==0):
print "stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
if (options.handCount!=0):
if ((stored+duplicates+partial+errors)>=options.handCount):
if (not options.quiet):
print "quitting due to reaching the amount of hands to be imported"
print "Total stored:", stored, "duplicates:", duplicates, "partial/damaged:", partial, "errors:", errors
sys.exit(0)
startpos=endpos
print "Total stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
if stored==0 and duplicates>0:
for line_no in range(len(lines)):
if lines[line_no].find("Game #")!=-1:
final_game_line=lines[line_no]
last_read_hand=fpdb_simple.parseSiteHandNo(final_game_line)
#todo: this will cause return of an unstored hand number if the last hadn was error or partial
db.commit()
inputFile.close()
cursor.close()
db.close()
return last_read_hand
if __name__ == "__main__":
failOnError=False
quiet=False
#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()
import_file_dict(options)

152
pyfpdb/fpdb_parse_logic.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.
#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):
#print "hand:",hand
#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, actionAmounts, 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)
isTourney=fpdb_simple.isTourney(hand[0])
gametypeID=fpdb_simple.recogniseGametypeID(cursor, hand[0], 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])
#print "Buyin:", buyin
fee=fpdb_simple.parseFee(hand[0])
#print "Fee:", fee
entries=-1 #todo: parse this
prizepool=-1 #todo: parse this
tourneyStartTime=handStartTime #todo: read tourney start time
#print "gametypeID:",gametypeID
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)
#for i in range (len(hand)):
# print "i:",i,"lineTypes[i]:",lineTypes[i],"hand[i]:",hand[i]
#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])
#print "seatLines:",seatLines
#print "hand:",hand
names=fpdb_simple.parseNames(seatLines)
#print "names:",names
playerIDs = fpdb_simple.recognisePlayerIDs(cursor, names, siteID)
startCashes=fpdb_simple.parseCashes(seatLines, site)
fpdb_simple.createArrays(category, len(names), cardValues, cardSuits, antes, winnings, rakes, actionTypes, actionAmounts)
#3b remove people who sitout before cards are dealt (e.g. sitout instead of paying blinds)
#PS doesnt have a nameline for sitouts so for PS this can be skipped. havent tried FTP yet
#3c read positions
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
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"):
#print "hand[i]:",hand[i]
fpdb_simple.parseCardLine (site, category, lineStreets[i], hand[i], names, cardValues, cardSuits, boardValues, boardSuits)
#print "cardValues:",cardValues
elif (lineTypes[i]=="action"):
fpdb_simple.parseActionLine (hand[i], lineStreets[i], names, actionTypes, actionAmounts, site)
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, names, antes)
else:
raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
#print "end of part4 cardValues:",cardValues,"cardSuits:",cardSuits
#part 5: final preparations, then call fpdb_save_to_db.saveHoldem with
# the arrays as they are - that file will fill them.
fpdb_simple.convertCardValues(cardValues)
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
fpdb_simple.convertCardValuesBoard(boardValues)
fpdb_simple.convertBlindBet(actionTypes, actionAmounts)
fpdb_simple.checkPositions(positions)
cursor.execute("SELECT limit_type FROM gametypes WHERE id=%s",(gametypeID, ))
limit_type=cursor.fetchone()[0] #todo: remove this unnecessary database access
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)
hands_players_flags=fpdb_simple.calculate_hands_players_flags(playerIDs, category, actionTypes)
if isTourney:
payin_amounts=fpdb_simple.calcPayin(len(names), buyin, fee)
ranks=[]
for i in range (len(names)):
ranks.append(0)
knockout=0
entries=-1
prizepool=-1
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee,
knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes,
actionTypes, actionAmounts, hands_players_flags)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
result = fpdb_save_to_db.tourney_stud(cursor, category, siteTourneyNo, buyin, fee,
knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
siteHandNo, siteID, gametypeID, handStartTime, names, playerIDs,
startCashes, antes, cardValues, cardSuits, winnings, rakes,
actionTypes, actionAmounts, hands_players_flags)
else:
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
result = fpdb_save_to_db.ring_holdem_omaha(cursor, category, siteHandNo, gametypeID,
handStartTime, names, playerIDs, startCashes, positions, cardValues,
cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, hands_players_flags)
elif (category=="razz" or category=="studhi" or category=="studhilo"):
result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,
handStartTime, names, playerIDs, startCashes, antes, cardValues,
cardSuits, winnings, rakes, actionTypes, actionAmounts, hands_players_flags)
else:
raise fpdb_simple.FpdbError ("unrecognised category")
db.commit()
return result
#end def mainParser

123
pyfpdb/fpdb_save_to_db.py Normal file
View File

@ -0,0 +1,123 @@
#!/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, category, site_hand_no, gametype_id, hand_start_time,
names, player_ids, start_cashes, antes, card_values, card_suits,
winnings, rakes, action_types, action_amounts, hands_players_flags):
fpdb_simple.fillCardArrays(len(names), 7, card_values, card_suits)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names)
hands_players_ids=fpdb_simple.store_hands_players_stud(cursor, hands_id, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes)
fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
return site_hand_no
#end def ring_stud
#stores a holdem/omaha hand into the database
def ring_holdem_omaha(cursor, 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, action_amounts, hands_players_flags):
#fill up the two player card arrays
if (category=="holdem"):
fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
elif (category=="omahahi" or category=="omahahilo"):
fpdb_simple.fillCardArrays(len(names), 4, card_values, card_suits)
else:
raise fpdb_simple.FpdbError ("invalid category: category")
fpdb_simple.fill_board_cards(board_values, board_suits)
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names)
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)
fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
return site_hand_no
#end def ring_holdem_omaha
def tourney_holdem_omaha(cursor, category, site_tourney_no, buyin, fee, knockout, entries, prizepool,
tourney_start, payin_amounts, ranks, #end of tourney specific params
site_hand_no, site_id, gametype_id, hand_start_time, names, player_ids,
start_cashes, positions, card_values, card_suits,
board_values, board_suits, winnings, rakes,
action_types, action_amounts, hands_players_flags):
#stores a tourney stud/razz hand into the database
#fill up the two player card arrays
if (category=="holdem"):
fpdb_simple.fillCardArrays(len(names), 2, card_values, card_suits)
elif (category=="omahahi" or category=="omahahilo"):
fpdb_simple.fillCardArrays(len(names), 4, card_values, card_suits)
else:
raise fpdb_simple.FpdbError ("invalid category: category")
fpdb_simple.fill_board_cards(board_values, board_suits)
tourney_id=fpdb_simple.store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, 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)
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha_tourney(cursor, hands_id, player_ids,
start_cashes, positions, card_values, card_suits, winnings, rakes, tourneys_players_ids)
fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
fpdb_simple.store_board_cards(cursor, hands_id, board_values, board_suits)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
return site_hand_no
#end def tourney_holdem_omaha
def tourney_stud(cursor, category, site_tourney_no, buyin, fee, knockout, entries, prizepool,
tourney_start, payin_amounts, ranks, #end of tourney specific params
site_hand_no, site_id, gametype_id, hand_start_time, names, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes,
action_types, action_amounts, hands_players_flags):
#stores a tourney stud/razz hand into the database
fpdb_simple.fillCardArrays(len(names), 7, card_values, card_suits)
tourney_id=fpdb_simple.store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, 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)
hands_players_ids=fpdb_simple.store_hands_players_stud_tourney(cursor, hands_id, player_ids,
start_cashes, antes, card_values, card_suits, winnings, rakes, tourneys_players_ids)
fpdb_simple.store_hands_players_flags(cursor, category, hands_players_ids, hands_players_flags)
fpdb_simple.storeActions(cursor, hands_players_ids, action_types, action_amounts)
return site_hand_no
#end def tourney_stud

1345
pyfpdb/fpdb_simple.py Normal file

File diff suppressed because it is too large Load Diff

153
pyfpdb/import_threaded.py Executable file
View File

@ -0,0 +1,153 @@
#!/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 import_threaded (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
for file in os.listdir(self.path):
if os.path.isdir(file):
pass
else:
self.inputFile=self.path+os.sep+file
fpdb_import.import_file_dict(self)
print "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.handCount=0
else:
self.handCount=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.minPrint=0
else:
self.minPrint=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.quiet=False
else:
self.quiet=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.failOnError=False
else:
self.failOnError=True
self.server, self.database, self.user, self.password=self.db.get_db_info()
if os.path.isdir(self.inputFile):
self.import_dir()
else:
fpdb_import.import_file_dict(self)
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, initial_path="/work/poker-histories/wine-ps/"):
self.db=db
self.vbox=gtk.VBox(False,1)
self.vbox.show()
self.chooser = gtk.FileChooserWidget()
self.chooser.set_filename(initial_path)
#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

271
pyfpdb/table_viewer.py Executable file
View File

@ -0,0 +1,271 @@
#!/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 MySQLdb
import fpdb_import
import fpdb_db
class table_viewer (threading.Thread):
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", "Hands", "VPIP", "PFR", "AF", "FF", "AT", "FT", "AR", "FR")
streets=(1,2,3)
else:
tmp=("Name", "Hands", "VPI3", "A3", "A4", "F4", "A5", "F5", "A6", "F6", "A7", "F7")
streets=(4,5,6,7)#todo: change this once table has been changed
arr.append(tmp)
#then the data rows
for i in range(len(self.player_names)):
tmp=[]
tmp.append(self.player_names[i][0])
self.cursor.execute("""SELECT DISTINCT hands.id FROM hands
INNER JOIN hands_players ON hands_players.hand_id = hands.id
WHERE hands.gametype_id=%s AND hands_players.player_id=%s""", (self.gametype_id, self.player_ids[i][0]))
hand_count=self.cursor.rowcount
tmp.append(str(hand_count))
self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
INNER JOIN hands ON hands_players.hand_id = hands.id
WHERE hands.gametype_id=%s AND hands_players.player_id=%s
AND street0_vpi=True""", (self.gametype_id, self.player_ids[i][0]))
vpi_count=self.cursor.rowcount
vpi_percent=int(vpi_count/float(hand_count)*100)
tmp.append(str(vpi_percent))
self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
INNER JOIN hands ON hands_players.hand_id = hands.id
WHERE hands.gametype_id=%s AND hands_players.player_id=%s
AND street0_raise=True""", (self.gametype_id, self.player_ids[i][0]))
raise_count=self.cursor.rowcount
raise_percent=int(raise_count/float(hand_count)*100)
tmp.append(str(raise_percent))
######start of flop/4th street######
hand_count
play_counts=[]
raise_counts=[]
fold_counts=[]
self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
INNER JOIN hands ON hands_players.hand_id = hands.id
WHERE hands.gametype_id=%s AND hands_players.player_id=%s
AND folded_on=0""", (self.gametype_id, self.player_ids[i][0]))
preflop_fold_count=self.cursor.rowcount
last_play_count=hand_count-preflop_fold_count
play_counts.append(last_play_count)
for street in streets:
self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
INNER JOIN hands ON hands_players.hand_id = hands.id
WHERE hands.gametype_id=%s AND hands_players.player_id=%s
AND folded_on="""+str(street), (self.gametype_id, self.player_ids[i][0]))
fold_count=self.cursor.rowcount
fold_counts.append(fold_count)
last_play_count-=fold_count
play_counts.append(last_play_count)
self.cursor.execute("""SELECT DISTINCT hands.id FROM hands_players
INNER JOIN hands_players_flags ON hands_players.id = hands_players_flags.hand_player_id
INNER JOIN hands ON hands_players.hand_id = hands.id
WHERE hands.gametype_id=%s AND hands_players.player_id=%s
AND street"""+str(street)+"_raise=True""", (self.gametype_id, self.player_ids[i][0]))
raise_counts.append(self.cursor.rowcount)
for street in range (len(streets)):
if play_counts[street]>0:
raise_percent=int(raise_counts[street]/float(play_counts[street])*100)
tmp.append(str(raise_percent))
fold_percent=int(fold_counts[street]/float(play_counts[street])*100)
tmp.append(str(fold_percent))
else:
tmp.append("n/a")
tmp.append("n/a")
arr.append(tmp)
return arr
#end def table_viewer.prepare_data
def refresh_clicked(self, widget, data):
"""runs when user clicks refresh"""
if self.debug: 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])):
new_label=gtk.Label(arr[row][column])
self.data_table.attach(child=new_label, left_attach=column, right_attach=column+1, top_attach=row, bottom_attach=row+1)
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"
print "self.last_read_hand:",self.last_read_hand
self.db.reconnect()
self.cursor=self.db.cursor
self.cursor.execute("""SELECT id FROM hands WHERE site_hand_no=%s""", (self.last_read_hand))
hands_id_tmp=self.db.cursor.fetchone()
print "tmp:",hands_id_tmp
self.hands_id=hands_id_tmp[0]
self.db.cursor.execute("SELECT gametype_id 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 hands_players
INNER JOIN players ON hands_players.player_id=players.id
WHERE hand_id=%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 hands_players
INNER JOIN players ON hands_players.player_id=players.id
WHERE hand_id=%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.quiet=False
self.failOnError=False
self.minPrint=0
self.handCount=0
self.last_read_hand=fpdb_import.import_file_dict(self)
#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, debug=True):
"""Constructor for table_viewer"""
self.debug=debug
if self.debug: print "start of table_viewer constructor"
self.db=db
self.cursor=db.cursor
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.add(self.filename_label)
self.filename_label.show()
self.filename_tbuffer=gtk.TextBuffer()
self.filename_tbuffer.set_text("/home/sycamore/ps-history/HH20080726 Meliboea - $0.10-$0.20 - Limit Hold'em.txt")
self.filename_tview=gtk.TextView(self.filename_tbuffer)
self.settings_hbox.add(self.filename_tview)
self.filename_tview.show()
self.browse_button=gtk.Button("Browse...")
self.browse_button.connect("clicked", self.browse_clicked, "Browse clicked")
self.settings_hbox.add(self.browse_button)
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,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

61
testdata/ftp-stud-hilo-ring-001.txt vendored Normal file
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.

38
testdata/ftp.6367428246.expected.txt vendored Normal file
View File

@ -0,0 +1,38 @@
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

46
testdata/ftp.6929537410.expected.txt vendored Normal file
View File

@ -0,0 +1,46 @@
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

45
testdata/ftp.6929553738.expected.txt vendored Normal file
View File

@ -0,0 +1,45 @@
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

376
testdata/mysql-dump.sql vendored Normal file

File diff suppressed because one or more lines are too long

169
testdata/ps-holdem-ring-001to003.txt vendored Normal file
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)

40
testdata/ps.14519394979.expected.txt vendored Normal file
View File

@ -0,0 +1,40 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars site_id: 2
From Table hands
================
site_hand_no: 14519394979 hand_start: 2008-01-13 05:22:15 seat_count: 7 category: holdem
Board cards: Qd Th Js 2s 7s
From Table hands_players
========================
player_name:Player_1 player_startcash:75 position:Btn cards:?? ?? winnings:0 rake:0
player_name:Player_2 player_startcash:59 position:SB cards:?? ?? winnings:0 rake:0
player_name:Player_3 player_startcash:147 position:BB cards:?? ?? winnings:0 rake:0
player_name:Player_4 player_startcash:198 position:4 off Btn cards:?? ?? winnings:31 rake:1
player_name:Player_5 player_startcash:122 position:3 off Btn cards:?? ?? winnings:0 rake:0
player_name:Player_6 player_startcash:48 position:2 off Btn cards:?? ?? winnings:0 rake:0
player_name:Player_7 player_startcash:139 position:1 off Btn cards:Ts Jh winnings:0 rake:0
From Table hands_actions
========================
player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:call amount:4
player_name:Player_1 actionCount:1 street:Flop streetActionNo:0 action:call amount:2
player_name:Player_1 actionCount:2 street:Turn streetActionNo:0 action:call amount:4
player_name:Player_1 actionCount:3 street:River streetActionNo:0 action:fold amount:0
player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
player_name:Player_2 actionCount:1 street:Preflop streetActionNo:1 action:call amount:3
player_name:Player_2 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:Player_2 actionCount:3 street:Flop streetActionNo:1 action:call amount:2
player_name:Player_2 actionCount:4 street:Turn streetActionNo:0 action:check amount:0
player_name:Player_2 actionCount:5 street:Turn streetActionNo:1 action:call amount:4
player_name:Player_2 actionCount:6 street:River streetActionNo:0 action:check amount:0
player_name:Player_2 actionCount:7 street:River streetActionNo:1 action:fold amount:0
player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
player_name:Player_3 actionCount:1 street:Preflop streetActionNo:1 action:fold amount:0
player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:bet amount:4
player_name:Player_4 actionCount:1 street:Flop streetActionNo:0 action:bet amount:2
player_name:Player_4 actionCount:2 street:Turn streetActionNo:0 action:bet amount:4
player_name:Player_4 actionCount:3 street:River streetActionNo:0 action:bet amount:4
player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0

40
testdata/ps.14519420999.expected.txt vendored Normal file
View File

@ -0,0 +1,40 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars site_id: 2
From Table hands
================
site_hand_no: 14519420999 hand_start: 2008-01-13 05:23:43 seat_count: 7 category: holdem
Board cards: Th Jd 3c 7c 4s
From Table hands_players
========================
player_name:Player_1 player_startcash:65 position:2 off Btn cards:?? ?? winnings:0 rake:0
player_name:Player_2 player_startcash:49 position:1 off Btn cards:8s 9s winnings:35 rake:1
player_name:Player_3 player_startcash:179 position:Btn cards:?? ?? winnings:0 rake:0
player_name:Player_4 player_startcash:205 position:SB cards:?? ?? winnings:0 rake:0
player_name:Player_5 player_startcash:118 position:BB cards:Qh Js winnings:0 rake:0
player_name:Player_6 player_startcash:34 position:4 off Btn cards:?? ?? winnings:0 rake:0
player_name:Player_7 player_startcash:135 position:3 off Btn cards:8d 5d winnings:0 rake:0
From Table hands_actions
========================
player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
player_name:Player_2 actionCount:1 street:Flop streetActionNo:0 action:call amount:2
player_name:Player_2 actionCount:2 street:Turn streetActionNo:0 action:bet amount:8
player_name:Player_2 actionCount:3 street:River streetActionNo:0 action:bet amount:4
player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
player_name:Player_4 actionCount:1 street:Preflop streetActionNo:1 action:call amount:1
player_name:Player_4 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:Player_4 actionCount:3 street:Flop streetActionNo:1 action:call amount:2
player_name:Player_4 actionCount:4 street:Turn streetActionNo:0 action:check amount:0
player_name:Player_4 actionCount:5 street:Turn streetActionNo:1 action:fold amount:0
player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
player_name:Player_5 actionCount:1 street:Preflop streetActionNo:1 action:check amount:0
player_name:Player_5 actionCount:2 street:Flop streetActionNo:0 action:bet amount:2
player_name:Player_5 actionCount:3 street:Turn streetActionNo:0 action:bet amount:4
player_name:Player_5 actionCount:4 street:Turn streetActionNo:1 action:call amount:4
player_name:Player_5 actionCount:5 street:River streetActionNo:0 action:check amount:0
player_name:Player_5 actionCount:6 street:River streetActionNo:1 action:call amount:4
player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0

49
testdata/ps.14519433154.expected.txt vendored Normal file
View File

@ -0,0 +1,49 @@
Connected to MySQL on localhost. Print Hand Utility
options.site: PokerStars site_id: 2
From Table hands
================
site_hand_no: 14519433154 hand_start: 2008-01-13 05:24:25 seat_count: 7 category: holdem
Board cards: 4h 9s Ad Qc Ks
From Table hands_players
========================
player_name:Player_1 player_startcash:65 position:3 off Btn cards:?? ?? winnings:0 rake:0
player_name:Player_2 player_startcash:68 position:2 off Btn cards:?? ?? winnings:0 rake:0
player_name:Player_3 player_startcash:179 position:1 off Btn cards:Ah 9d winnings:92 rake:4
player_name:Player_4 player_startcash:201 position:Btn cards:Ac Td winnings:0 rake:0
player_name:Player_5 player_startcash:102 position:SB cards:?? ?? winnings:0 rake:0
player_name:Player_6 player_startcash:34 position:BB cards:?? ?? winnings:0 rake:0
player_name:Player_7 player_startcash:135 position:4 off Btn cards:7c Jh winnings:0 rake:0
From Table hands_actions
========================
player_name:Player_1 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:Player_2 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0
player_name:Player_3 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
player_name:Player_3 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
player_name:Player_3 actionCount:2 street:Flop streetActionNo:0 action:bet amount:2
player_name:Player_3 actionCount:3 street:Flop streetActionNo:1 action:bet amount:4
player_name:Player_3 actionCount:4 street:Flop streetActionNo:2 action:call amount:2
player_name:Player_3 actionCount:5 street:Turn streetActionNo:0 action:bet amount:4
player_name:Player_3 actionCount:6 street:Turn streetActionNo:1 action:bet amount:8
player_name:Player_3 actionCount:7 street:Turn streetActionNo:2 action:call amount:4
player_name:Player_3 actionCount:8 street:River streetActionNo:0 action:bet amount:4
player_name:Player_3 actionCount:9 street:River streetActionNo:1 action:bet amount:8
player_name:Player_3 actionCount:10 street:River streetActionNo:2 action:call amount:4
player_name:Player_4 actionCount:0 street:Preflop streetActionNo:0 action:call amount:2
player_name:Player_4 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
player_name:Player_4 actionCount:2 street:Flop streetActionNo:0 action:bet amount:4
player_name:Player_4 actionCount:3 street:Flop streetActionNo:1 action:bet amount:4
player_name:Player_4 actionCount:4 street:Turn streetActionNo:0 action:bet amount:8
player_name:Player_4 actionCount:5 street:Turn streetActionNo:1 action:bet amount:8
player_name:Player_4 actionCount:6 street:River streetActionNo:0 action:bet amount:8
player_name:Player_4 actionCount:7 street:River streetActionNo:1 action:bet amount:8
player_name:Player_5 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:1
player_name:Player_5 actionCount:1 street:Preflop streetActionNo:1 action:bet amount:3
player_name:Player_5 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:Player_5 actionCount:3 street:Flop streetActionNo:1 action:fold amount:0
player_name:Player_6 actionCount:0 street:Preflop streetActionNo:0 action:blind amount:2
player_name:Player_6 actionCount:1 street:Preflop streetActionNo:1 action:call amount:2
player_name:Player_6 actionCount:2 street:Flop streetActionNo:0 action:check amount:0
player_name:Player_6 actionCount:3 street:Flop streetActionNo:1 action:fold amount:0
player_name:Player_7 actionCount:0 street:Preflop streetActionNo:0 action:fold amount:0

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()

79
utils/fpdb_util_lib.py Normal file
View File

@ -0,0 +1,79 @@
#!/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]
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)

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.gametype_id = gametypes.id WHERE gametypes.type='ring'")
print "Hands, Ring:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.type='stt'")
print "Hands, STT:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = 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.gametype_id = gametypes.id WHERE gametypes.limit_type='cn'")
print "Hands, Cap No Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.limit_type='cp'")
print "Hands, Cap Pot Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='holdem' AND gametypes.limit_type='nl'")
print "Hands, Holdem No Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='holdem' AND gametypes.limit_type='pl'")
print "Hands, Holdem Pot Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='holdem' AND gametypes.limit_type='fl'")
print "Hands, Holdem Fixed Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahi' AND gametypes.limit_type='nl'")
print "Hands, Omaha Hi No Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahi' AND gametypes.limit_type='pl'")
print "Hands, Omaha Hi Pot Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahi' AND gametypes.limit_type='fl'")
print "Hands, Omaha Hi Fixed Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahilo' AND gametypes.limit_type='nl'")
print "Hands, Omaha Hi/Lo No Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahilo' AND gametypes.limit_type='pl'")
print "Hands, Omaha Hi/Lo Pot Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='omahahilo' AND gametypes.limit_type='fl'")
print "Hands, Omaha Hi/Lo Fixed Limit:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='razz'")
print "Hands, Razz:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='studhi'")
print "Hands, Stud Hi:",cursor.rowcount
cursor.execute("SELECT hands.id FROM hands INNER JOIN gametypes ON hands.gametype_id = gametypes.id WHERE gametypes.category='studhilo'")
print "Hands, Stud Hi/Lo:",cursor.rowcount
print ""
cursor.execute("SELECT id FROM board_cards")
print "Board_cards:",cursor.rowcount
cursor.execute("SELECT id FROM hands_players")
print "Hands_players:",cursor.rowcount
cursor.execute("SELECT id FROM hands_actions")
print "Hands_actions:",cursor.rowcount
cursor.close()
db.close()

169
utils/print_hand.py Executable file
View File

@ -0,0 +1,169 @@
#!/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", "--hand_number", "--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.hand_number==None or options.site==None:
print "please supply a hand number and site name. TODO: make this work"
db = MySQLdb.connect("localhost", "fpdb", options.password, "fpdb")
cursor = db.cursor()
print "Connected to MySQL on localhost. Print Hand Utility"
cursor.execute("SELECT id FROM sites WHERE name=%s", (options.site,))
site_id=cursor.fetchone()[0]
print "options.site:",options.site,"site_id:",site_id
cursor.execute("""SELECT hands.* FROM hands INNER JOIN gametypes
ON hands.gametype_id = gametypes.id WHERE gametypes.site_id=%s AND hands.site_hand_no=%s""",
(site_id, options.hand_number))
hands_result=cursor.fetchone()
gametype_id=hands_result[2]
site_hand_no=options.hand_number
hand_id=hands_result[0]
hand_start=hands_result[3]
seat_count=hands_result[4]
print ""
print "From Table gametypes"
print "===================="
cursor.execute("""SELECT type, category, limit_type FROM gametypes WHERE id=%s""",
(gametype_id, ))
type_etc=cursor.fetchone()
type=type_etc[0]
category=type_etc[1]
limit_type=type_etc[2]
print "type:", type, " category:", category, " limit_type:", limit_type
gt_string=""
do_bets=False
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
cursor.execute("SELECT small_blind FROM gametypes WHERE id=%s", (gametype_id, ))
sb=cursor.fetchone()[0]
cursor.execute("SELECT big_blind FROM gametypes WHERE id=%s", (gametype_id, ))
bb=cursor.fetchone()[0]
gt_string=("sb: "+str(sb)+" bb: "+str(bb))
if (limit_type=="fl"):
do_bets=True
elif (category=="razz" or category=="studhi" or category=="studhilo"):
do_bets=True
if do_bets:
cursor.execute("SELECT small_bet FROM gametypes WHERE id=%s", (gametype_id, ))
sbet=cursor.fetchone()[0]
cursor.execute("SELECT big_bet FROM gametypes WHERE id=%s", (gametype_id, ))
bbet=cursor.fetchone()[0]
gt_string+=(" sbet: "+str(sbet)+" bbet: "+str(bbet))
print gt_string
if type=="ring":
pass
elif type=="tour":
#cursor.execute("SELECT tourneys_players_id FROM hands
cursor.execute("""SELECT DISTINCT tourneys_players.id
FROM hands JOIN hands_players ON hands_players.hand_id=hands.id
JOIN tourneys_players ON hands_players.tourneys_players_id=tourneys_players.id
WHERE hands.id=%s""", (hand_id,))
hands_players_ids=cursor.fetchall()
print "dbg hands_players_ids:",hands_players_ids
print ""
print "From Table tourneys"
print "==================="
print "TODO"
print ""
print "From Table tourneys_players"
print "==========================="
print "TODO"
else:
print "invalid type:",type
sys.exit(1)
print ""
print "From Table hands"
print "================"
print "site_hand_no:",site_hand_no,"hand_start:",hand_start,"seat_count:",seat_count
#,"hand_id:",hand_id,"gametype_id:",gametype_id
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
cursor.execute("""SELECT * FROM board_cards WHERE hand_id=%s""",(hand_id, ))
bc=cursor.fetchone()
print "Board cards:", ful.cards2String(bc[2:])
print ""
print "From Table hands_players"
print "========================"
cursor.execute("""SELECT * FROM hands_players WHERE hand_id=%s""",(hand_id, ))
hands_players=cursor.fetchall()
player_names=[]
for i in range (len(hands_players)):
line=hands_players[i][2:]
player_names.append(ful.id_to_player_name(cursor, line[0]))
printstr="player_name:"+player_names[i]+" player_startcash:"+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[4:8])
else:
printstr+=ful.cards2String(line[4:12])
elif (category=="razz" or category=="studhi" or category=="studhilo"):
printstr+=" ante:"+str(line[3])+" cards:"
printstr+=ful.cards2String(line[4:18])
else:
print "TODO: raise error, print_hand.py"
sys.exit(1)
printstr+=" winnings:"+str(line[18])+" rake:"+str(line[19])
print printstr
print ""
print "From Table hands_actions"
print "========================"
for i in range (len(hands_players)):
cursor.execute("""SELECT * FROM hands_actions WHERE hand_player_id=%s""",(hands_players[i][0], ))
hands_actions=cursor.fetchall()
for j in range (len(hands_actions)):
line=hands_actions[j][2:]
printstr="player_name:"+player_names[i]+" actionCount:"+str(j)
printstr+=" street:"+ful.street_int2String(category, line[0])+" streetActionNo:"+str(line[1])+" action:"+line[2]
printstr+=" amount:"+str(line[3])
print printstr
cursor.close()
db.close()
sys.exit(0)

40
utils/regression-test.sh Executable file
View File

@ -0,0 +1,40 @@
#!/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 ../testdata/*.found.txt
../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ps-holdem-ring-001to003.txt -x
../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ftp-stud-hilo-ring-001.txt -x
../fpdb-python/fpdb_import.py -p$1 --file=../testdata/ftp-omaha-hi-pl-ring-001-005.txt -x
echo "it should've reported first that it stored 3, then that it had 3 duplicates,"
echo " then 1 stored, then 5 stored"
./print_hand.py -p$1 --hand=14519394979 > ../testdata/ps.14519394979.found.txt && colordiff ../testdata/ps.14519394979.found.txt ../testdata/ps.14519394979.expected.txt
./print_hand.py -p$1 --hand=14519420999 > ../testdata/ps.14519420999.found.txt && colordiff ../testdata/ps.14519420999.found.txt ../testdata/ps.14519420999.expected.txt
./print_hand.py -p$1 --hand=14519433154 > ../testdata/ps.14519433154.found.txt && colordiff ../testdata/ps.14519433154.found.txt ../testdata/ps.14519433154.expected.txt
./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6367428246 > ../testdata/ftp.6367428246.found.txt && colordiff ../testdata/ftp.6367428246.found.txt ../testdata/ftp.6367428246.expected.txt
./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929537410 > ../testdata/ftp.6929537410.found.txt && colordiff ../testdata/ftp.6929537410.found.txt ../testdata/ftp.6929537410.expected.txt
./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929553738 > ../testdata/ftp.6929553738.found.txt && colordiff ../testdata/ftp.6929553738.found.txt ../testdata/ftp.6929553738.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929572212 > ../testdata/ftp.6929572212.found.txt && colordiff ../testdata/ftp.6929572212.found.txt ../testdata/ftp.6929572212.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929576743 > ../testdata/ftp.6929576743.found.txt && colordiff ../testdata/ftp.6929576743.found.txt ../testdata/ftp.6929576743.expected.txt
#./print_hand.py -p$1 --site="Full Tilt Poker" --hand=6929587483 > ../testdata/ftp.6929587483.found.txt && colordiff ../testdata/ftp.6929587483.found.txt ../testdata/ftp.6929587483.expected.txt
echo "if everything was printed as expected this worked"
echo "todo: this doesnt verify correct gametype detection"