Merge branch 'master' of git://git.assembla.com/fpdboz

This commit is contained in:
sqlcoder 2010-07-11 15:20:41 +01:00
commit 26642557a1
94 changed files with 2698 additions and 2021 deletions

View File

@ -1,3 +1,17 @@
#Copyright 2009-2010 Carl Gherardi
#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.
# Variable definitions # Variable definitions
VERSION = 0.20 VERSION = 0.20
DATE = $(shell date +%Y%m%d) DATE = $(shell date +%Y%m%d)
@ -9,3 +23,7 @@ all:
snapshot: snapshot:
git tag $(VERSION)-$(DATE) git tag $(VERSION)-$(DATE)
git archive --prefix=fpdb-$(VERSION)-$(DATE)/ $(VERSION)-$(DATE) | gzip -9 > ../fpdb-$(VERSION)-$(DATE).tar.gz git archive --prefix=fpdb-$(VERSION)-$(DATE)/ $(VERSION)-$(DATE) | gzip -9 > ../fpdb-$(VERSION)-$(DATE).tar.gz
release:
git tag $(VERSION)
git archive --prefix=fpdb-$(VERSION)/ $(VERSION) | gzip -9 > ../fpdb-$(VERSION).tar.gz

View File

@ -1,35 +0,0 @@
=**Thanks - Contributors to FPDB**=
This page is to acknowledge the people developing and contributing to FPDB, be it with code, documentation, testing, forum support and everything else that is required to make an open source project work.
Most people have found the project though the software forum at [[http://forumserver.twoplustwo.com/45/software/|2+2]] so most references to 2+2 aliases
Sincere apologies to those not listed. FPDB started life in August 2008, but we only got around to putting together a proper contributers list in April 2009. Private messages and emails have been deleted so we dont have a full history of non-code based contributions
==**Developers**==
Active:
Steffen123 - The initial code drop and project lead.
Eratosthenes - Initial HUD code drop, release manager
Ekdikeo - Contributor - contributed Everleaf support and much HUD work
Sorrow - Contributor - Graphing, import framework
mcturnbull (2+2?) - Contributor - import framework
Inactive:
Sqlcoder - SQL query guru - Graphing filters, Player Stats, Positional Stats queries + general sql optimisation work
Bostik - Author of [[http://bostik.iki.fi/pokerstats/|PokerStats]] - Postgres linux work. PokerStats import code was the inspiration for the new framework. I'm sure well use more of his ideas in future.
FIXME - Original windows installer/packager
==Documentation==
FIXME - Original web site guy
FIXME - Guy who wrote the Mac install page
FIXME - Any other wiki editors.
==Other==
Eleatic Stranger - Super tester and contributor - Our #1 tester. Tracks the git repo and works the code harder than anyone and gives great feedback and bug reports. Thankyou.
Xaviax - Tester and honorary helpdesk - Another excellent tester tracking git, has responded to many queries in the fpdb thread on his own time.
KayosD - Hand History donation - Carbon Poker
freerollerjb - Hand History donation - Carbon Poker
puru - Hand History donation - Carbon Poker
freestailo - Hand History donation - Carbon Poker
MoDDe (Sourceforge) - Hand History Donation - Betfair
Jay10826 - Hand History donation - Ultimate Bet

View File

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

339
gpl-2.0.txt Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, 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.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
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
this service 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.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program 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.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.
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
convey 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 General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

674
gpl-3.0.txt Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 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 General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is 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. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
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.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
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 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. Use with the GNU Affero General Public License.
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 Affero 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 special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU 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 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 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 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 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 General Public License for more details.
You should have received a copy of the GNU 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 the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
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 GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

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

View File

@ -2,6 +2,6 @@ This package was debianised by Mika Bostrom <bostik+fpdb@bostik.iki.fi>
Upstream authors: ... Upstream authors: ...
License: AGPL License: AGPL3; partially GPL2 or higher
Copyright (C) 2008- The FPDB developers Copyright (C) 2008-2010 The FPDB developers

View File

@ -1 +1 @@
/usr/share/pyshared/fpdb/fpdb.py /usr/bin/fpdb /usr/share/pyshared/fpdb/fpdb.pyw /usr/bin/fpdb

View File

@ -3,4 +3,4 @@
# When installed into .../fpdb/ the script gets mode 644 # When installed into .../fpdb/ the script gets mode 644
# Note: "dh_fixperms -Xfpdb.py" did not work, hence this hack # Note: "dh_fixperms -Xfpdb.py" did not work, hence this hack
chmod 755 /usr/bin/fpdb chmod 755 /usr/bin/fpdb
chmod 755 /usr/share/pyshared/fpdb/HUD_main.py chmod 755 /usr/share/pyshared/fpdb/HUD_main.pyw

View File

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

View File

@ -0,0 +1,134 @@
Create MySqlPython version 1.2.2 windows installer for Python26
This walkthrough is derived from excellent installation instructions released under GNU Free Documentation License 1.2. The original work is here ... http://www.bcspcsonline.com/wiki/index.php?title=MySQL-5.1.34_Python-2.6_Module_Build_Instructions The Wiki author appears to be "Irondesk"
This version by Gimick on 29th June 2010
Content is available under GNU Free Documentation License 1.2
Step 0 Get a fresh XP installation
----------------------------------
0.1/ Using XPhome 32bit
Step 1, VisualStudio 2008 express install
-----------------------------------------
1.1/ Get the ISO CD from here ... http://www.microsoft.com/express/Downloads/#2008-All
1.2/ Run and install Visual C++ only, don't bother with the additional packages offered
This package will run 30 days before registration is needed
Step 2, setup Mysql Server
--------------------------
2.1/ Install MySQL server runtime ... http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.34-win32.msi
Choose Typical, choose configure, choose Standard Configuration, choose all defaults, supply admin username/password.
Step 3, more installs
----------------------
3.1/ install the following in sequence (accept all default options) there should be no errors !
Python 2.6.5 ... http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi
7zip 914 ... http://sourceforge.net/projects/sevenzip/files/7-Zip/9.14/7z914.exe/download
Step 4, grab Mysql server Source
--------------------------------
4.1/ Download ... http://downloads.mysql.com/archives/mysql-5.1/mysql-noinstall-5.1.34-win32.zip
4.2/ Unpacking Desktop\mysqlsource (use 7zip)
4.3/ Copy the following source directories to the MySql installation:
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\data\* "c:\Program Files\MySQL\MySQL Server 5.1\data" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\Embedded\* "c:\Program Files\MySQL\MySQL Server 5.1\Embedded" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\include\* "c:\Program Files\MySQL\MySQL Server 5.1\include" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\lib\* "c:\Program Files\MySQL\MySQL Server 5.1\lib" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\mysql-test\* "c:\Program Files\MySQL\MySQL Server 5.1\mysql-test" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\sql-bench\* "c:\Program Files\MySQL\MySQL Server 5.1\sql-bench" /I/E/F/H
4.4/ You can delete Destop\mysqlsource, is no longer needed.
Step 5, grab Mysql-python source
--------------------------------
5.1/ get download
MySql for python ... http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz/download
5.2/ extract MySQL-python-1.2.2 directory to the Desktop using 7zip
(note: use 7zip, open the gz, then open the tar, then extract the directory found inside there)
Desktop\MySQL-python-1.2.2 should now exist
Step 6, get python build tools
------------------------------
6.1/ get Easy Setup installer
Easy setup installer ... http://peak.telecommunity.com/dist/ez_setup.py
6.2/ Check the DEFAULT VERSION specified in Easy Setup and get the corresponding setuptools (version c11 in this case)
Setuptools version 11 ... http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
6.3/ Put both of these files into Desktop\MySQL-python-1.2.2, overwriting any existing files
Step 7, install the build tool
------------------------------
dos> cd Desktop\MySQL-python-1.2.2
dos> c:\Python26\python.exe ez_setup.py setuptools-0.6c11-py2.6.egg
Step 8, Tweak the configuration
-------------------------------
dos> cd Desktop\MySQL-python-1.2.2
8.1/ dos> write site.cfg
Change registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0
to registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1
8.2/ dos> write _mysql.c
Find the following lines
...
#include <windows.h>
#include <config-win.h>
...
Insert an additional winsock2 line
...
#include <winsock2.h>
#include <windows.h>
#include <config-win.h>
...
Step 9, build
-------------
dos> cd Desktop\MySQL-python-1.2.2
9.1/ dos> c:\python26\python.exe setup.py build
* Note: You will probably get a bunch of warnings and maybe a manifest error, these are ok as long as there are no errors in compiling or linking.
* Note: This will generate the "MySQL-python-1.2.2/build" folder
9.2/ dos> c:\python26\python.exe setup.py bdist_wininst
Step 10, done
-------------
10.1/ the \dist directory will contain MySQL-python-1.2.2.win32-py2.6.exe !!!!!
10.2/ rename to MySQL-python-1.2.2.win32-py2.6-fpdb0.20.exe

View File

@ -0,0 +1,125 @@
Create MySqlPython version 1.2.3 windows installer for Python26
This walkthrough is derived from excellent installation instructions released under GNU Free Documentation License 1.2. The original work is here ... http://www.bcspcsonline.com/wiki/index.php?title=MySQL-5.1.34_Python-2.6_Module_Build_Instructions The Wiki author appears to be "Irondesk"
This version by Gimick on 29th June 2010
Content is available under GNU Free Documentation License 1.2
Premamble
---------
The FPDB exe needs to build against the MySql-Python project. Unfortunately, for python 2.6 there is no official installer for windows, and none is ever likely to be provided.
Community builds are available, but to reduce third-party dependencies, we will build our own here.
Step 0 Get a fresh XP installation
----------------------------------
0.1/ Using XPhome 32bit
Step 1, VisualStudio 2008 express install
-----------------------------------------
1.1/ Get the ISO CD from here ... http://www.microsoft.com/express/Downloads/#2008-All
1.2/ Run and install Visual C++ only, don't bother with the additional packages offered
This package will run 30 days before registration is needed
Step 2, setup Mysql Server
--------------------------
2.1/ Install MySQL server runtime ... http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.34-win32.msi
Choose Typical, choose configure, choose Standard Configuration, choose all defaults, supply admin username/password.
Step 3, more installs
----------------------
3.1/ install the following in sequence (accept all default options) there should be no errors !
Python 2.6.5 ... http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi
7zip 914 ... http://sourceforge.net/projects/sevenzip/files/7-Zip/9.14/7z914.exe/download
Step 4, grab Mysql server Source
--------------------------------
4.1/ Download ... http://downloads.mysql.com/archives/mysql-5.1/mysql-noinstall-5.1.34-win32.zip
4.2/ Unpacking Desktop\mysqlsource (use 7zip)
4.3/ Copy the following source directories to the MySql installation:
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\data\* "c:\Program Files\MySQL\MySQL Server 5.1\data" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\Embedded\* "c:\Program Files\MySQL\MySQL Server 5.1\Embedded" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\include\* "c:\Program Files\MySQL\MySQL Server 5.1\include" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\lib\* "c:\Program Files\MySQL\MySQL Server 5.1\lib" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\mysql-test\* "c:\Program Files\MySQL\MySQL Server 5.1\mysql-test" /I/E/F/H
dos> xcopy Desktop\mysqlsource\mysql-5.1.34-win32\sql-bench\* "c:\Program Files\MySQL\MySQL Server 5.1\sql-bench" /I/E/F/H
4.4/ You can delete Destop\mysqlsource, is no longer needed.
Step 5, grab Mysql-python source
--------------------------------
5.1/ get download
MySql for python ... http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.2/MySQL-python-1.2.3.tar.gz/download
5.2/ extract MySQL-python-1.2.3 directory to the Desktop using 7zip
(note: use 7zip, open the gz, then open the tar, then extract the directory found inside there)
Desktop\MySQL-python-1.2.3 should now exist
Step 6, get python build tools
------------------------------
6.1/ get Easy Setup installer
Easy setup installer ... http://peak.telecommunity.com/dist/ez_setup.py
6.2/ Check the DEFAULT VERSION specified in Easy Setup and get the corresponding setuptools (version c11 in this case)
Setuptools version 11 ... http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
6.3/ Put both of these files into Desktop\MySQL-python-1.2.3, overwriting any existing files
Step 7, install the build tool
------------------------------
dos> cd Desktop\MySQL-python-1.2.3
dos> c:\Python26\python.exe ez_setup.py setuptools-0.6c11-py2.6.egg
Step 8, Tweak the configuration
-------------------------------
dos> cd Desktop\MySQL-python-1.2.3
8.1/ dos> write site.cfg
Change registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0
to registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1
Step 9, build
-------------
dos> cd Desktop\MySQL-python-1.2.3
9.1/ dos> c:\python26\python.exe setup.py build
* Note: You will probably get a bunch of warnings and maybe a manifest error, these are ok as long as there are no errors in compiling or linking.
* Note: This will generate the "MySQL-python-1.2.3/build" folder
9.2/ dos> c:\python26\python.exe setup.py bdist_wininst
Step 10, done
-------------
10.1/ the \dist directory will contain MySQL-python-1.2.3.win32-py2.6.exe !!!!!
10.2/ rename to MySQL-python-1.2.3.win32-py2.6-fpdb0.20.exe

View File

@ -1,3 +1,18 @@
; Copyright 2008-2010 Michael
; 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.
;"%programfiles%\MySQL\MySQL Server 5.0\bin\mysqld" --remove ;"%programfiles%\MySQL\MySQL Server 5.0\bin\mysqld" --remove
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Includes ; Includes

View File

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

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2008, Carl Gherardi # Copyright 2008-2010, Carl Gherardi
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -177,7 +177,7 @@ or None if we fail to get the info """
# TODO: (1-on-1) does have that info in the game type line # TODO: (1-on-1) does have that info in the game type line
if self.HORSEHand: if self.HORSEHand:
hand.maxseats = 8 hand.maxseats = 8
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%Y-%m-%d %H:%M:%S") hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%Y-%m-%d %H:%M:%S")
return return
def readPlayerStacks(self, hand): def readPlayerStacks(self, hand):

View File

@ -1,4 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2009-2010 Grigorij Indigirkin
#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.
from decimal import Decimal from decimal import Decimal
from sqlalchemy import types from sqlalchemy import types

View File

@ -1,4 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2009-2010 Grigorij Indigirkin
#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.
"""@package AlchemyMappings """@package AlchemyMappings
This package contains all classes to be mapped and mappers themselves This package contains all classes to be mapped and mappers themselves
""" """
@ -34,8 +50,8 @@ class Gametype(MappedBase):
@staticmethod @staticmethod
def get_or_create(session, siteId, gametype): def get_or_create(session, siteId, gametype):
map = zip( map = zip(
['type', 'base', 'category', 'limitType', 'smallBlind', 'bigBlind', 'smallBet', 'bigBet'], ['type', 'base', 'category', 'limitType', 'smallBlind', 'bigBlind', 'smallBet', 'bigBet', 'currency'],
['type', 'base', 'category', 'limitType', 'sb', 'bb', 'dummy', 'dummy', ]) ['type', 'base', 'category', 'limitType', 'sb', 'bb', 'dummy', 'dummy', 'currency'])
gametype = dict([(new, gametype.get(old)) for new, old in map ]) gametype = dict([(new, gametype.get(old)) for new, old in map ])
hilo = "h" hilo = "h"
@ -152,8 +168,8 @@ class HandInternal(DerivedStats):
'speed': 'speed', 'speed': 'speed',
'maxSeats': 'maxseats', 'maxSeats': 'maxseats',
'knockout': 'isKO', 'knockout': 'isKO',
'rebuyOrAddon': 'isRebuy', 'rebuy': 'isRebuy',
'headsUp': 'isHU', 'addOn': 'isAddOn',
'shootout': 'isShootout', 'shootout': 'isShootout',
'matrix': 'isMatrix', 'matrix': 'isMatrix',
'sng': 'isSNG', 'sng': 'isSNG',
@ -185,7 +201,7 @@ class HandInternal(DerivedStats):
# fetch and update tourney players # fetch and update tourney players
for hp in self.handPlayers: for hp in self.handPlayers:
tp = TourneyPlayer.get_or_create(session, tour.id, hp.playerId) tp = TourneysPlayer.get_or_create(session, tour.id, hp.playerId)
# FIXME: other TourneysPlayers should be added here # FIXME: other TourneysPlayers should be added here
session.flush() session.flush()
@ -340,18 +356,20 @@ class HandPlayer(MappedBase):
class Site(object): class Site(object):
"""Class reflecting Players db table""" """Class reflecting Players db table"""
INITIAL_DATA = [ INITIAL_DATA = [
(1 , 'Full Tilt Poker','USD'), (1 , 'Full Tilt Poker','FT'),
(2 , 'PokerStars', 'USD'), (2 , 'PokerStars', 'PS'),
(3 , 'Everleaf', 'USD'), (3 , 'Everleaf', 'EV'),
(4 , 'Win2day', 'USD'), (4 , 'Win2day', 'W2'),
(5 , 'OnGame', 'USD'), (5 , 'OnGame', 'OG'),
(6 , 'UltimateBet', 'USD'), (6 , 'UltimateBet', 'UB'),
(7 , 'Betfair', 'USD'), (7 , 'Betfair', 'BF'),
(8 , 'Absolute', 'USD'), (8 , 'Absolute', 'AB'),
(9 , 'PartyPoker', 'USD'), (9 , 'PartyPoker', 'PP'),
(10, 'Partouche', 'EUR'), (10, 'Partouche', 'PA'),
(11, 'Carbon', 'CA'),
(12, 'PKR', 'PK'),
] ]
INITIAL_DATA_KEYS = ('id', 'name', 'currency') INITIAL_DATA_KEYS = ('id', 'name', 'code')
INITIAL_DATA_DICTS = [ dict(zip(INITIAL_DATA_KEYS, datum)) for datum in INITIAL_DATA ] INITIAL_DATA_DICTS = [ dict(zip(INITIAL_DATA_KEYS, datum)) for datum in INITIAL_DATA ]
@ -372,7 +390,7 @@ class Tourney(MappedBase):
class TourneyType(MappedBase): class TourneyType(MappedBase):
"""Class reflecting TourneysType db table""" """Class reflecting TourneyType db table"""
@classmethod @classmethod
def get_or_create(cls, session, **kwargs): def get_or_create(cls, session, **kwargs):
@ -380,12 +398,12 @@ class TourneyType(MappedBase):
Required kwargs: Required kwargs:
buyin fee speed maxSeats knockout buyin fee speed maxSeats knockout
rebuyOrAddon headsUp shootout matrix sng rebuy addOn shootout matrix sng currency
""" """
return get_or_create(cls, session, **kwargs)[0] return get_or_create(cls, session, **kwargs)[0]
class TourneyPlayer(MappedBase): class TourneysPlayer(MappedBase):
"""Class reflecting TourneysPlayers db table""" """Class reflecting TourneysPlayers db table"""
@classmethod @classmethod
@ -437,7 +455,7 @@ mapper (Gametype, gametypes_table, properties={
}) })
mapper (Player, players_table, properties={ mapper (Player, players_table, properties={
'playerHands': relation(HandPlayer, backref='player'), 'playerHands': relation(HandPlayer, backref='player'),
'playerTourney': relation(TourneyPlayer, backref='player'), 'playerTourney': relation(TourneysPlayer, backref='player'),
}) })
mapper (Site, sites_table, properties={ mapper (Site, sites_table, properties={
'gametypes': relation(Gametype, backref = 'site'), 'gametypes': relation(Gametype, backref = 'site'),
@ -455,7 +473,7 @@ mapper (Tourney, tourneys_table)
mapper (TourneyType, tourney_types_table, properties={ mapper (TourneyType, tourney_types_table, properties={
'tourneys': relation(Tourney, backref='type'), 'tourneys': relation(Tourney, backref='type'),
}) })
mapper (TourneyPlayer, tourneys_players_table) mapper (TourneysPlayer, tourneys_players_table)
class LambdaKeyDict(defaultdict): class LambdaKeyDict(defaultdict):
"""Operates like defaultdict but passes key argument to the factory function""" """Operates like defaultdict but passes key argument to the factory function"""

View File

@ -1,4 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2009-2010 Grigorij Indigirkin
#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.
"""@package AlchemyTables """@package AlchemyTables
Contains all sqlalchemy tables Contains all sqlalchemy tables
""" """
@ -29,6 +45,7 @@ autorates_table = Table('Autorates', metadata,
gametypes_table = Table('Gametypes', metadata, gametypes_table = Table('Gametypes', metadata,
Column('id', SmallInteger, primary_key=True), Column('id', SmallInteger, primary_key=True),
Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False), # SMALLINT Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False), # SMALLINT
Column('currency', String(4), nullable=False), # varchar(4) NOT NULL
Column('type', String(4), nullable=False), # char(4) NOT NULL Column('type', String(4), nullable=False), # char(4) NOT NULL
Column('base', String(4), nullable=False), # char(4) NOT NULL Column('base', String(4), nullable=False), # char(4) NOT NULL
Column('category', String(9), nullable=False), # varchar(9) NOT NULL Column('category', String(9), nullable=False), # varchar(9) NOT NULL
@ -338,7 +355,7 @@ settings_table = Table('Settings', metadata,
sites_table = Table('Sites', metadata, sites_table = Table('Sites', metadata,
Column('id', SmallInteger, primary_key=True), Column('id', SmallInteger, primary_key=True),
Column('name', String(32), nullable=False), # varchar(32) NOT NULL Column('name', String(32), nullable=False), # varchar(32) NOT NULL
Column('currency', String(3), nullable=False), # char(3) NOT NULL Column('code', String(2), nullable=False), # char(2) NOT NULL
mysql_charset='utf8', mysql_charset='utf8',
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
@ -352,17 +369,11 @@ tourneys_table = Table('Tourneys', metadata,
Column('prizepool', Integer), # INT NOT NULL Column('prizepool', Integer), # INT NOT NULL
Column('tourStartTime', DateTime), # DATETIME NOT NULL Column('tourStartTime', DateTime), # DATETIME NOT NULL
Column('tourEndTime', DateTime), # DATETIME Column('tourEndTime', DateTime), # DATETIME
Column('buyinChips', Integer), # INT
Column('tourneyName', String(40)), # varchar(40) Column('tourneyName', String(40)), # varchar(40)
# Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn # Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn
Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0 Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0
Column('rebuyChips', Integer, default=0), # INT DEFAULT 0 Column('totalRebuyCount', Integer, default=0), # INT DEFAULT 0
Column('addonChips', Integer, default=0), # INT DEFAULT 0 Column('totalAddOnCount', Integer, default=0), # INT DEFAULT 0
Column('rebuyAmount', MoneyColumn, default=0), # INT DEFAULT 0
Column('addonAmount', MoneyColumn, default=0), # INT DEFAULT 0
Column('totalRebuys', Integer, default=0), # INT DEFAULT 0
Column('totalAddons', Integer, default=0), # INT DEFAULT 0
Column('koBounty', Integer, default=0), # INT DEFAULT 0
Column('comment', Text), # TEXT Column('comment', Text), # TEXT
Column('commentTs', DateTime), # DATETIME Column('commentTs', DateTime), # DATETIME
mysql_charset='utf8', mysql_charset='utf8',
@ -374,36 +385,46 @@ Index('siteTourneyNo', tourneys_table.c.siteTourneyNo, tourneys_table.c.tourneyT
tourney_types_table = Table('TourneyTypes', metadata, tourney_types_table = Table('TourneyTypes', metadata,
Column('id', Integer, primary_key=True), Column('id', Integer, primary_key=True),
Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False), Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False),
Column('currency', String(4), nullable=False), # varchar(4) NOT NULL
Column('buyin', Integer, nullable=False), # INT NOT NULL Column('buyin', Integer, nullable=False), # INT NOT NULL
Column('fee', Integer, nullable=False, default=0), # INT NOT NULL Column('fee', Integer, nullable=False), # INT NOT NULL
Column('buyInChips', Integer, nullable=False), # INT NOT NULL
Column('maxSeats', Boolean, nullable=False, default=-1), # INT NOT NULL DEFAULT -1 Column('maxSeats', Boolean, nullable=False, default=-1), # INT NOT NULL DEFAULT -1
Column('rebuy', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('rebuyCost', Integer), # INT
Column('rebuyChips', Integer), # INT
Column('addOn', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('addOnCost', Integer), # INT
Column('addOnChips', Integer), # INT
Column('knockout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False Column('knockout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('rebuyOrAddon', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False Column('koBounty', Integer), # INT
Column('speed', String(10)), # varchar(10) Column('speed', String(10)), # varchar(10)
Column('headsUp', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('shootout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False Column('shootout', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('matrix', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False Column('matrix', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('sng', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False Column('sng', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('satellite', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('doubleOrNothing', Boolean, nullable=False, default=False), # BOOLEAN NOT NULL DEFAULT False
Column('guarantee', Integer, nullable=False, default=0), # INT NOT NULL DEFAULT 0
mysql_charset='utf8', mysql_charset='utf8',
mysql_engine='InnoDB', mysql_engine='InnoDB',
) )
Index('tourneyTypes_all', Index('tourneyTypes_all',
tourney_types_table.c.siteId, tourney_types_table.c.buyin, tourney_types_table.c.fee, tourney_types_table.c.siteId, tourney_types_table.c.buyin, tourney_types_table.c.fee,
tourney_types_table.c.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuyOrAddon, tourney_types_table.c.maxSeats, tourney_types_table.c.knockout, tourney_types_table.c.rebuy,
tourney_types_table.c.speed, tourney_types_table.c.headsUp, tourney_types_table.c.shootout, tourney_types_table.c.addOn, tourney_types_table.c.speed,
tourney_types_table.c.matrix, tourney_types_table.c.sng) tourney_types_table.c.shootout, tourney_types_table.c.matrix, tourney_types_table.c.sng)
tourneys_players_table = Table('TourneysPlayers', metadata, tourneys_players_table = Table('TourneysPlayers', metadata,
Column('id', BigIntColumn, primary_key=True), Column('id', BigIntColumn, primary_key=True),
Column('tourneyId', Integer, ForeignKey("Tourneys.id"), nullable=False), Column('tourneyId', Integer, ForeignKey("Tourneys.id"), nullable=False),
Column('playerId', Integer, ForeignKey("Players.id"), nullable=False), Column('playerId', Integer, ForeignKey("Players.id"), nullable=False),
Column('payinAmount', Integer), # INT NOT NULL
Column('rank', Integer), # INT NOT NULL Column('rank', Integer), # INT NOT NULL
Column('winnings', Integer), # INT NOT NULL Column('winnings', Integer), # INT NOT NULL
Column('nbRebuys', Integer, default=0), # INT DEFAULT 0 Column('winningsCurrency', Text), # TEXT
Column('nbAddons', Integer, default=0), # INT DEFAULT 0 Column('rebuyCount', Integer, default=0), # INT DEFAULT 0
Column('nbKO', Integer, default=0), # INT DEFAULT 0 Column('addOnCount', Integer, default=0), # INT DEFAULT 0
Column('koCount', Integer, default=0), # INT DEFAULT 0
Column('comment', Text), # TEXT Column('comment', Text), # TEXT
Column('commentTs', DateTime), # DATETIME Column('commentTs', DateTime), # DATETIME
mysql_charset='utf8', mysql_charset='utf8',

17
pyfpdb/Anonymise.py Normal file → Executable file
View File

@ -1,3 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2009-2010 Carl Gherardi
#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.
import os import os
import re import re
import codecs import codecs

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2008, Carl Gherardi # Copyright 2008-2010, Carl Gherardi
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -105,7 +105,7 @@ class Betfair(HandHistoryConverter):
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE'))) logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
hand.handid = m.group('HID') hand.handid = m.group('HID')
hand.tablename = m.group('TABLE') hand.tablename = m.group('TABLE')
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%A, %B %d, %H:%M:%S GMT %Y") hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%A, %B %d, %H:%M:%S GMT %Y")
#hand.buttonpos = int(m.group('BUTTON')) #hand.buttonpos = int(m.group('BUTTON'))
def readPlayerStacks(self, hand): def readPlayerStacks(self, hand):

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2010, Matthew Boss # Copyright 2010, Matthew Boss
@ -21,7 +21,7 @@
# This code is based heavily on EverleafToFpdb.py, by Carl Gherardi # This code is based heavily on EverleafToFpdb.py, by Carl Gherardi
# #
# OUTSTANDING MATTERS # TODO:
# #
# -- No siteID assigned # -- No siteID assigned
# -- No support for games other than NL hold 'em cash. Hand histories for other # -- No support for games other than NL hold 'em cash. Hand histories for other
@ -79,7 +79,7 @@ class Carbon(HandHistoryConverter):
#re_Antes = ??? #re_Antes = ???
#re_BringIn = ??? #re_BringIn = ???
re_HeroCards = re.compile(r'<cards type="HOLE" cards="(?P<CARDS>.+)" player="(?P<PSEAT>[0-9])"', re.MULTILINE) re_HeroCards = re.compile(r'<cards type="HOLE" cards="(?P<CARDS>.+)" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
re_Action = re.compile(r'<event sequence="[0-9]+" type="(?P<ATYPE>FOLD|CHECK|CALL|BET|RAISE|ALL_IN|SIT_OUT)" player="(?P<PSEAT>[0-9])"( amount="(?P<BET>[.0-9]+)")?/>', re.MULTILINE) re_Action = re.compile(r'<event sequence="[0-9]+" type="(?P<ATYPE>FOLD|CHECK|CALL|BET|RAISE|ALL_IN|SIT_OUT)" (?P<TIMESTAMP>timestamp="[0-9]+" )?player="(?P<PSEAT>[0-9])"( amount="(?P<BET>[.0-9]+)")?/>', re.MULTILINE)
re_ShowdownAction = re.compile(r'<cards type="SHOWN" cards="(?P<CARDS>..,..)" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE) re_ShowdownAction = re.compile(r'<cards type="SHOWN" cards="(?P<CARDS>..,..)" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
re_CollectPot = re.compile(r'<winner amount="(?P<POT>[.0-9]+)" uncalled="(true|false)" potnumber="[0-9]+" player="(?P<PSEAT>[0-9])"', re.MULTILINE) re_CollectPot = re.compile(r'<winner amount="(?P<POT>[.0-9]+)" uncalled="(true|false)" potnumber="[0-9]+" player="(?P<PSEAT>[0-9])"', re.MULTILINE)
re_SitsOut = re.compile(r'<event sequence="[0-9]+" type="SIT_OUT" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE) re_SitsOut = re.compile(r'<event sequence="[0-9]+" type="SIT_OUT" player="(?P<PSEAT>[0-9])"/>', re.MULTILINE)
@ -156,7 +156,7 @@ or None if we fail to get the info """
hand.handid = m.group('HID1') + m.group('HID2') hand.handid = m.group('HID1') + m.group('HID2')
hand.tablename = m.group('TABLE')[:-1] hand.tablename = m.group('TABLE')[:-1]
hand.maxseats = 2 # This value may be increased as necessary hand.maxseats = 2 # This value may be increased as necessary
hand.starttime = datetime.datetime.strptime(m.group('DATETIME')[:12], hand.startTime = datetime.datetime.strptime(m.group('DATETIME')[:12],
'%Y%m%d%H%M') '%Y%m%d%H%M')
# Check that the hand is complete up to the awarding of the pot; if # Check that the hand is complete up to the awarding of the pot; if
# not, the hand is unparseable # not, the hand is unparseable

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
# From fpdb_simple # From fpdb_simple

View File

@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2010 Mika Bostrom #Copyright 2010 Mika Bostrom
#This program is free software: you can redistribute it and/or modify #This program is free software: you can redistribute it and/or modify
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
# Error logging # Error logging
import sys import sys

View File

@ -1,10 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""Configuration.py """Configuration.py
Handles HUD configuration files. Handles HUD configuration files.
""" """
# Copyright 2008, 2009, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Database.py """Database.py
Create and manage the database objects. Create and manage the database objects.
""" """
# Copyright 2008, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -21,7 +22,7 @@ Create and manage the database objects.
######################################################################## ########################################################################
# ToDo: - rebuild indexes / vacuum option # TODO: - rebuild indexes / vacuum option
# - check speed of get_stats_from_hand() - add log info # - check speed of get_stats_from_hand() - add log info
# - check size of db, seems big? (mysql) # - check size of db, seems big? (mysql)
# - investigate size of mysql db (200K for just 7K hands? 2GB for 140K hands?) # - investigate size of mysql db (200K for just 7K hands? 2GB for 140K hands?)
@ -52,7 +53,6 @@ log = logging.getLogger("db")
# FreePokerTools modules # FreePokerTools modules
import SQL import SQL
import Card import Card
import Tourney
import Charset import Charset
from Exceptions import * from Exceptions import *
import Configuration import Configuration
@ -74,7 +74,7 @@ except ImportError:
use_numpy = False use_numpy = False
DB_VERSION = 119 DB_VERSION = 127
# Variance created as sqlite has a bunch of undefined aggregate functions. # Variance created as sqlite has a bunch of undefined aggregate functions.
@ -1343,29 +1343,30 @@ class Database:
def fillDefaultData(self): def fillDefaultData(self):
c = self.get_cursor() c = self.get_cursor()
c.execute("INSERT INTO Settings (version) VALUES (%s);" % (DB_VERSION)) c.execute("INSERT INTO Settings (version) VALUES (%s);" % (DB_VERSION))
c.execute("INSERT INTO Sites (name,currency) VALUES ('Full Tilt Poker', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('Full Tilt Poker', 'FT')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('PokerStars', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('PokerStars', 'PS')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('Everleaf', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('Everleaf', 'EV')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('Win2day', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('Win2day', 'W2')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('OnGame', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('OnGame', 'OG')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('UltimateBet', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('UltimateBet', 'UB')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('Betfair', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('Betfair', 'BF')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('Absolute', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('Absolute', 'AB')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('PartyPoker', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('PartyPoker', 'PP')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('Partouche', 'EUR')") c.execute("INSERT INTO Sites (name,code) VALUES ('Partouche', 'PA')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('Carbon', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('Carbon', 'CA')")
c.execute("INSERT INTO Sites (name,currency) VALUES ('PKR', 'USD')") c.execute("INSERT INTO Sites (name,code) VALUES ('PKR', 'PK')")
if self.backend == self.SQLITE: if self.backend == self.SQLITE:
c.execute("INSERT INTO TourneyTypes (id, siteId, buyin, fee) VALUES (NULL, 1, 0, 0);") c.execute("""INSERT INTO TourneyTypes (id, siteId, currency, buyin, fee, buyInChips, maxSeats, knockout,
rebuy, addOn, speed, shootout, matrix)
VALUES (NULL, 1, 'USD', 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0);""")
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
c.execute("""insert into TourneyTypes(siteId, buyin, fee, maxSeats, knockout c.execute("""insert into TourneyTypes(siteId, currency, buyin, fee, buyInChips, maxSeats, knockout
,rebuyOrAddon, speed, headsUp, shootout, matrix) ,rebuy, addOn, speed, shootout, matrix)
values (1, 0, 0, 0, False, False, null, False, False, False);""") values (1, 'USD', 0, 0, 0, 0, False, False, False, null, False, False);""")
elif self.backend == self.MYSQL_INNODB: elif self.backend == self.MYSQL_INNODB:
c.execute("""insert into TourneyTypes(id, siteId, buyin, fee, maxSeats, knockout c.execute("""insert into TourneyTypes(id, siteId, currency, buyin, fee, buyInChips, maxSeats, knockout
,rebuyOrAddon, speed, headsUp, shootout, matrix) ,rebuy, addOn, speed, shootout, matrix)
values (DEFAULT, 1, 0, 0, 0, False, False, null, False, False, False);""") values (DEFAULT, 1, 'USD', 0, 0, 0, 0, False, False, False, null, False, False);""")
#end def fillDefaultData #end def fillDefaultData
def rebuild_indexes(self, start=None): def rebuild_indexes(self, start=None):
@ -1373,6 +1374,7 @@ class Database:
self.createAllIndexes() self.createAllIndexes()
self.dropAllForeignKeys() self.dropAllForeignKeys()
self.createAllForeignKeys() self.createAllForeignKeys()
#end def rebuild_indexes
def rebuild_hudcache(self, h_start=None, v_start=None): def rebuild_hudcache(self, h_start=None, v_start=None):
"""clears hudcache and rebuilds from the individual handsplayers records""" """clears hudcache and rebuilds from the individual handsplayers records"""
@ -1558,6 +1560,7 @@ class Database:
pids[p], pids[p],
pdata[p]['startCash'], pdata[p]['startCash'],
pdata[p]['seatNo'], pdata[p]['seatNo'],
pdata[p]['sitout'],
pdata[p]['card1'], pdata[p]['card1'],
pdata[p]['card2'], pdata[p]['card2'],
pdata[p]['card3'], pdata[p]['card3'],
@ -1792,8 +1795,9 @@ class Database:
hilo = "s" hilo = "s"
elif game['category'] in ['razz','27_3draw','badugi']: elif game['category'] in ['razz','27_3draw','badugi']:
hilo = "l" hilo = "l"
tmp = self.insertGameTypes( (siteid, game['type'], game['base'], game['category'], game['limitType'], hilo, tmp = self.insertGameTypes( (siteid, 'USD', game['type'], game['base'], game['category'], game['limitType'], hilo,
int(Decimal(game['sb'])*100), int(Decimal(game['bb'])*100), 0, 0) ) int(Decimal(game['sb'])*100), int(Decimal(game['bb'])*100), 0, 0) )
#FIXME: recognise currency
return tmp[0] return tmp[0]
def getSqlPlayerIDs(self, pnames, siteid): def getSqlPlayerIDs(self, pnames, siteid):
@ -1853,48 +1857,6 @@ class Database:
# Finish of NEWIMPORT CODE # Finish of NEWIMPORT CODE
################################# #################################
def store_tourneys_players(self, tourney_id, player_ids, payin_amounts, ranks, winnings):
try:
result=[]
cursor = self.get_cursor()
#print "in store_tourneys_players. tourney_id:",tourney_id
#print "player_ids:",player_ids
#print "payin_amounts:",payin_amounts
#print "ranks:",ranks
#print "winnings:",winnings
for i in xrange(len(player_ids)):
try:
cursor.execute("savepoint ins_tplayer")
cursor.execute("""INSERT INTO TourneysPlayers
(tourneyId, playerId, payinAmount, rank, winnings) VALUES (%s, %s, %s, %s, %s)""".replace('%s', self.sql.query['placeholder']),
(tourney_id, player_ids[i], payin_amounts[i], ranks[i], winnings[i]))
tmp = self.get_last_insert_id(cursor)
result.append(tmp)
#print "created new tourneys_players.id:", tmp
except:
cursor.execute("rollback to savepoint ins_tplayer")
cursor.execute("SELECT id FROM TourneysPlayers WHERE tourneyId=%s AND playerId+0=%s".replace('%s', self.sql.query['placeholder'])
,(tourney_id, player_ids[i]))
tmp = cursor.fetchone()
#print "tried SELECTing tourneys_players.id:", tmp
try:
len(tmp)
result.append(tmp[0])
except:
print "tplayer id not found for tourney,player %s,%s" % (tourney_id, player_ids[i])
pass
except:
raise FpdbError( "store_tourneys_players error: " + str(sys.exc_value) )
cursor.execute("release savepoint ins_tplayer")
#print "store_tourneys_players returning", result
return result
#end def store_tourneys_players
# read HandToWrite objects from q and insert into database # read HandToWrite objects from q and insert into database
def insert_queue_hands(self, q, maxwait=10, commitEachHand=True): def insert_queue_hands(self, q, maxwait=10, commitEachHand=True):
n,fails,maxTries,firstWait = 0,0,4,0.1 n,fails,maxTries,firstWait = 0,0,4,0.1
@ -1970,59 +1932,88 @@ class Database:
print "***Error sending finish: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) print "***Error sending finish: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
# end def send_finish_msg(): # end def send_finish_msg():
def tRecogniseTourneyType(self, tourney): def createOrUpdateTourneyType(self, hand):
log.debug("Database.tRecogniseTourneyType") tourneyTypeId = 1
typeId = 1
# Check if Tourney exists, and if so retrieve TTypeId : in that case, check values of the ttype # Check if Tourney exists, and if so retrieve TTypeId : in that case, check values of the ttype
cursor = self.get_cursor() cursor = self.get_cursor()
cursor.execute (self.sql.query['getTourneyTypeIdByTourneyNo'].replace('%s', self.sql.query['placeholder']), cursor.execute (self.sql.query['getTourneyTypeIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
(tourney.tourNo, tourney.siteId) (hand.tourNo, hand.siteId)
) )
result=cursor.fetchone() result=cursor.fetchone()
expectedValues = { 1 : "buyin", 2 : "fee", 4 : "isKO", 5 : "isRebuy", 6 : "speed", expectedValues = { 1 : "buyin", 2 : "fee", 4 : "isKO", 5 : "isRebuy", 6 : "speed",
7 : "isHU", 8 : "isShootout", 9 : "isMatrix" } 7 : "isShootout", 8 : "isMatrix" }
typeIdMatch = True tourneyTypeIdMatch = True
try: try:
len(result) tourneyTypeId = result[0]
typeId = result[0] log.debug("Tourney found in db with Tourney_Type_ID = %d" % tourneyTypeId)
log.debug("Tourney found in db with Tourney_Type_ID = %d" % typeId)
for ev in expectedValues : for ev in expectedValues :
if ( getattr( tourney, expectedValues.get(ev) ) <> result[ev] ): if ( getattr( hand, expectedValues.get(ev) ) <> result[ev] ):
log.debug("TypeId mismatch : wrong %s : Tourney=%s / db=%s" % (expectedValues.get(ev), getattr( tourney, expectedValues.get(ev)), result[ev]) ) log.debug("TypeId mismatch : wrong %s : Tourney=%s / db=%s" % (expectedValues.get(ev), getattr( hand, expectedValues.get(ev)), result[ev]) )
typeIdMatch = False tourneyTypeIdMatch = False
#break #break
except: except:
# Tourney not found : a TourneyTypeId has to be found or created for that specific tourney # Tourney not found : a TourneyTypeId has to be found or created for that specific tourney
typeIdMatch = False tourneyTypeIdMatch = False
if typeIdMatch == False : if tourneyTypeIdMatch == False :
# Check for an existing TTypeId that matches tourney info (buyin/fee, knockout, rebuy, speed, matrix, shootout) # Check for an existing TTypeId that matches tourney info, if not found create it
# if not found create it
log.debug("Searching for a TourneyTypeId matching TourneyType data")
cursor.execute (self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']), cursor.execute (self.sql.query['getTourneyTypeId'].replace('%s', self.sql.query['placeholder']),
(tourney.siteId, tourney.buyin, tourney.fee, tourney.isKO, (hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.isKO,
tourney.isRebuy, tourney.speed, tourney.isHU, tourney.isShootout, tourney.isMatrix) hand.isRebuy, hand.isRebuy, hand.speed, hand.isShootout, hand.isMatrix)
) )
result=cursor.fetchone() result=cursor.fetchone()
try: try:
len(result) tourneyTypeId = result[0]
typeId = result[0]
log.debug("Existing Tourney Type Id found : %d" % typeId)
except TypeError: #this means we need to create a new entry except TypeError: #this means we need to create a new entry
log.debug("Tourney Type Id not found : create one") cursor.execute (self.sql.query['insertTourneyType'].replace('%s', self.sql.query['placeholder']),
cursor.execute (self.sql.query['insertTourneyTypes'].replace('%s', self.sql.query['placeholder']), (hand.siteId, hand.buyinCurrency, hand.buyin, hand.fee, hand.buyInChips,
(tourney.siteId, tourney.buyin, tourney.fee, tourney.isKO, tourney.isRebuy, hand.isKO, hand.isRebuy,
tourney.speed, tourney.isHU, tourney.isShootout, tourney.isMatrix) hand.isAddOn, hand.speed, hand.isShootout, hand.isMatrix)
) )
typeId = self.get_last_insert_id(cursor) tourneyTypeId = self.get_last_insert_id(cursor)
return tourneyTypeId
return typeId #end def createOrUpdateTourneyType
#end def tRecogniseTourneyType
def createOrUpdateTourney(self, hand):
cursor = self.get_cursor()
cursor.execute (self.sql.query['getTourneyIdByTourneyNo'].replace('%s', self.sql.query['placeholder']),
(hand.siteId, hand.tourNo))
result=cursor.fetchone()
if result != None and len(result)==1:
tourneyId = result[0]
else:
cursor.execute (self.sql.query['insertTourney'].replace('%s', self.sql.query['placeholder']),
(hand.tourneyTypeId, hand.tourNo, None, None,
hand.startTime, None, None, None,
None, None))
tourneyId = self.get_last_insert_id(cursor)
return tourneyId
#end def createOrUpdateTourney
def createOrUpdateTourneysPlayers(self, hand):
tourneysPlayersIds=[]
for player in hand.players:
playerId = hand.dbid_pids[player[1]]
cursor = self.get_cursor()
cursor.execute (self.sql.query['getTourneysPlayersId'].replace('%s', self.sql.query['placeholder']),
(hand.tourneyId, playerId))
result=cursor.fetchone()
if result != None and len(result)==1:
tourneysPlayersIds.append(result[0])
else:
cursor.execute (self.sql.query['insertTourneysPlayer'].replace('%s', self.sql.query['placeholder']),
(hand.tourneyId, playerId, None, None, None, None, None, None, None, None))
tourneysPlayersIds.append(self.get_last_insert_id(cursor))
return tourneysPlayersIds
#end def createOrUpdateTourneysPlayers
#end class Database
# Class used to hold all the data needed to write a hand to the db # Class used to hold all the data needed to write a hand to the db
# mainParser() in fpdb_parse_logic.py creates one of these and then passes it to # mainParser() in fpdb_parse_logic.py creates one of these and then passes it to
@ -2069,7 +2060,6 @@ class HandToWrite:
self.maxSeats = None self.maxSeats = None
self.tableName = None self.tableName = None
self.seatNos = None self.seatNos = None
self.payin_amounts = None # tourney import was complaining mightily about this missing
except: except:
print "htw.init error: " + str(sys.exc_info()) print "htw.init error: " + str(sys.exc_info())
raise raise

View File

@ -1,810 +0,0 @@
"""Database manager
@todo: (gtk) how to validate user input in gtk.Dialog? as soon as the user clicks ok the dialog is dead. we use a while loop as workaround. not nice
@todo: (fpdb) we need the application name 'fpdb' from somewhere to put it in dialog titles
@todo: (fpdb) config object should be initialized globally and accessible from all modules via Configuration.py
@todo: (all dialogs) save/restore size and pos
@todo: (WidgetDatabaseManager) give database status meaningful colors
@todo: (WidgetDatabaseManager) implement database purging
@todo: (WidgetDatabaseManager) implement database export
@todo: (WidgetDatabaseManager) what to do on database doubleclick?
@todo: (WidgetDatabaseManager) context menu for database tree
@todo: (WidgetDatabaseManager) initializing/validating databases may take a while. how to give feedback?
"""
import os
import pygtk
pygtk.require('2.0')
import gtk
import gobject
#*******************************************************************************************************
class DatabaseManager(gobject.GObject):
DatabaseTypes = {}
@classmethod
def from_fpdb(klass, data, defaultDatabaseType=None):
#NOTE: if no databases are present in config fpdb fails with
# Traceback (most recent call last):
# File "/home/me2/Scr/Repos/fpdb-mme/pyfpdb/DatabaseManager.py", line 783, in <module>
# databaseManager = DatabaseManager.from_fpdb('', defaultDatabaseType=DatabaseTypeSqLite)
# File "/home/me2/Scr/Repos/fpdb-mme/pyfpdb/DatabaseManager.py", line 36, in from_fpdb
# config = Configuration.Config(file=options.config, dbname=options.dbname)
# File "/home/me2/Scr/Repos/fpdb-mme/pyfpdb/Configuration.py", line 436, in __init__
# db = self.get_db_parameters()
# File "/home/me2/Scr/Repos/fpdb-mme/pyfpdb/Configuration.py", line 583, in get_db_parameters
# name = self.db_selected
# AttributeError: Config instance has no attribute 'db_selected'
import sys
import Options
import Configuration
#NOTE: fpdb should perform this globally
(options, argv) = Options.fpdb_options()
config = Configuration.Config(file=options.config, dbname=options.dbname)
#TODO: handle no database present
defaultDatabaseName = config.get_db_parameters().get('db-databaseName', None)
#TODO: fpdb stores databases in no particular order. this has to be fixed somehow
databases = []
for name, fpdbDatabase in config.supported_databases.items():
databaseKlass = klass.DatabaseTypes.get(fpdbDatabase.db_server, None)
#NOTE: Config does not seem to validate user input, so anything may end up here
if databaseKlass is None:
raise ValueError('Unknown databasetype: %s' % fpdbDatabase.db_server)
database = databaseKlass()
if database.Type == 'sqlite':
database.name = fpdbDatabase.db_name
database.file = fpdbDatabase.db_server
else:
database.name = fpdbDatabase.db_name
database.host = fpdbDatabase.db_server
#NOTE: fpdbDatabase.db_ip is no is a string
database.port = int(fpdbDatabase.db_ip)
database.user = fpdbDatabase.db_user
database.password = fpdbDatabase.db_pass
databases.append(database)
return klass(databases=databases, defaultDatabaseType=defaultDatabaseType)
def to_fpdb(self):
pass
def __init__(self, databases=None, defaultDatabaseType=None):
gobject.GObject.__init__(self)
self._defaultDatabaseType = defaultDatabaseType
self._databases = [] if databases is None else list(databases)
self._activeDatabase = None
def __iter__(self):
return iter(self._databases)
def set_default_database_type(self, databaseType):
self._defaultDatabaseType = defaultDatabaseType
def get_default_database_type(self):
return self._defaultDatabaseType
def database_from_id(self, idDatabase):
for database in self._databases:
if idDatabase == self.database_id(database):
return database
def database_id(self, database):
return id(database)
def add_database(self, database):
if database in self._databases:
raise ValueError('database already registered')
self._databases.append(database)
def remove_database(self, database):
self._databases.remove(database)
def activate_database(self, database):
if self._activeDatabase is not None:
self._activeDatabase.status = self._activeDatabase.StatusInactive
#TODO: finalize database
self.emit('database-deactivated', self.database_id(self._activeDatabase) )
database.status = database.StatusActive
#TODO: activate database
self._activeDatabase = database
self.emit('database-activated', self.database_id(database) )
def active_database(self):
return self._activeDatabase
# register DatabaseManager signals
gobject.type_register(DatabaseManager)
gobject.signal_new('database-activated', DatabaseManager, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (int, ))
gobject.signal_new('database-deactivated', DatabaseManager, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (int, ))
gobject.signal_new('database-error', DatabaseManager, gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (int, ))
class DatabaseTypeMeta(type):
def __new__(klass, name, bases, kws):
newKlass = type.__new__(klass, name, bases, kws)
if newKlass.Type is not None:
if newKlass.Type in DatabaseManager.DatabaseTypes:
raise ValueError('data base type already registered for: %s' % newKlass.Type)
DatabaseManager.DatabaseTypes[newKlass.Type] = newKlass
return newKlass
class DatabaseTypeBase(object):
__metaclass__ = DatabaseTypeMeta
Type = None
StatusActive = 'active'
StatusInactive = 'inactive'
StatusError = 'error' #TODO: not implemented
#TODO: not happy with returning error string. just being too lazy to impl dozens of error codes for later translation
def init_new_database(self):
"""initializes a new empty database
@return: (str) error if something goes wrong, None otherwise
"""
raise NotImplementedError()
def validate_database(self):
"""checks if the database is valid
@return: (str) error if something goes wrong, None otherwise
"""
raise NotImplementedError()
class DatabaseTypePostgres(DatabaseTypeBase):
Type = 'postgresql'
@classmethod
def display_name(klass):
return 'Postgres'
def __init__(self, name='', host='localhost', port=5432, user='postgres', password='', database='fpdb'):
self.name = name
self.host = host
self.port = port
self.user = user
self.password = password
self.database = database
self.status = self.StatusInactive
#TODO: implement
def init_new_database(self):
pass
#TODO: implement
def validate_database(self):
pass
class DatabaseTypeMysql(DatabaseTypeBase):
Type = 'mysql'
@classmethod
def display_name(klass):
return 'MySql'
def __init__(self, name='', host='localhost', port=3306, user='root', password='', database='fpdb'):
self.name = name
self.host = host
self.port = port
self.user = user
self.password = password
self.database = database
self.status = self.StatusInactive
#TODO: implement
def init_new_database(self):
pass
#TODO: implement
def validate_database(self):
pass
class DatabaseTypeSqLite(DatabaseTypeBase):
Type = 'sqlite'
@classmethod
def display_name(klass):
return 'SqLite'
def __init__(self, name='', host='', file='', database='fpdb'):
self.name = name
self.file = file
self.status = self.StatusInactive
def init_new_database(self):
# make shure all attrs are specified
if not self.file:
return 'no database file specified'
# create file if necessary (this will truncate file if it exists)
try:
open(self.file, 'w').close()
except IOError:
return 'can not write file'
#TODO: init tables (...)
def validate_database(self):
pass
#TODO: check if tables (...) exist
#TODO: how do we want to handle unsupported database types?
# ..uncomment to remove unsupported database types
#try: import psycopg2
#except ImportError: del DatabaseManager.DatabaseTypes['postgres']
#try: import MySQLdb
#except ImportError: del DatabaseManager.DatabaseTypes['mysql']
#try: import sqlite3
#except ImportError: del DatabaseManager.DatabaseTypes['sqlite']
#***************************************************************************************************************************
#TODO: there is no title (on linux), wtf?
def DialogError(parent=None, msg=''):
dlg = gtk.MessageDialog(
parent=parent,
flags=gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,
type=gtk.MESSAGE_ERROR,
buttons=gtk.BUTTONS_OK,
message_format=msg,
)
dlg.run()
dlg.destroy()
return None
#TODO: derrive from gtk.VBox?
class WidgetDatabaseProperties(gtk.VBox):
ModeNew = 0
ModeEdit = 1
ModeAdd = 2
class SqLiteFileChooserButton(gtk.HBox):
#NOTE: for some weird reason it is impossible to let the user choose a non exiting filename with gtk.FileChooserButton, so impl our own on the fly
def __init__(self, widgetDatabaseProperties, parentWidget):
gtk.HBox.__init__(self)
self.set_homogeneous(False)
self.parentWidget = parentWidget
self.widgetDatabaseProperties = widgetDatabaseProperties
self.entry = gtk.Entry()
self.button = gtk.Button('...')
self.button.connect('clicked', self.on_button_clicked)
# layout widgets
self.pack_start(self.entry, True, True)
self.pack_start(self.button, False, False)
def get_filename(self):
return self.entry.get_text()
def set_filename(self, name):
self.entry.set_text(name)
def on_button_clicked(self, button):
if self.widgetDatabaseProperties.mode == WidgetDatabaseProperties.ModeAdd:
action = gtk.FILE_CHOOSER_ACTION_OPEN
elif self.widgetDatabaseProperties.mode == WidgetDatabaseProperties.ModeNew:
action = gtk.FILE_CHOOSER_ACTION_SAVE
else:
raise ValueError('unsupported dialog mode')
dlg = gtk.FileChooserDialog(
title='Choose an exiting database file or type in name of a new one',
parent=self.parentWidget,
action=action,
buttons=(
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_OK,
),
backend=None
)
dlg.set_default_response(gtk.RESPONSE_OK)
dlg.set_do_overwrite_confirmation(True)
if dlg.run() == gtk.RESPONSE_OK:
fileName = dlg.get_filename()
self.set_filename(fileName)
dlg.destroy()
#TODO: bit ugly this thingy. try to find a better way to map database attrs to gtk widgets
class FieldWidget(object):
def __init__(self, text='', attrDatabase='', widget=None, attrGet=None, attrSet=None, defaultValue=None, canEdit=False, tooltip=''):
"""
@param canEdit: True if the user can edit the attr in edit mode, False otherwise
"""
self._label = gtk.Label(text)
self._attrDatabase = attrDatabase
self._widget = widget
self._defaultValue = defaultValue
self._attrGetter=None,
self._attrGet = attrGet
self._attrSet = attrSet
self._canEdit = canEdit
self._label.set_tooltip_text(tooltip)
self._widget.set_tooltip_text(tooltip)
def widget(self):
return self._widget
def label(self):
return self._label
def is_sensitive(self, database):
return hasattr(database, self._attrDatabase)
def can_edit(self):
return self._canEdit
def set_sensitive(self, flag):
self._label.set_sensitive(flag)
self._widget.set_sensitive(flag)
def value_from_database(self, database):
getattr(self._widget, self._attrSet)( getattr(database, self._attrDatabase) )
def value_to_database(self, database):
setattr(database, self._attrDatabase, getattr(self._widget, self._attrGet)() )
def reset_value(self):
getattr(self._widget, self._attrSet)(self._defaultValue)
def __init__(self, databaseManager, database, mode=ModeEdit, parentWidget=None):
gtk.VBox.__init__(self)
self.databaseManager = databaseManager
self.database = database
self.mode = mode
self.parentWidget = parentWidget
self.fieldWidgets = (
self.FieldWidget(
text='Name:',
attrDatabase='name',
widget=gtk.Entry(),
defaultValue='',
attrGet='get_text',
attrSet='set_text',
canEdit=True,
tooltip='Any name you like to name the database '
),
self.FieldWidget(
text='File:',
attrDatabase='file',
widget=self.SqLiteFileChooserButton(self, self.parentWidget),
defaultValue='',
attrGet='get_filename',
attrSet='set_filename',
canEdit=False,
tooltip='Fully qualified path of the file to hold the database '
),
self.FieldWidget(
text='Host:',
attrDatabase='host',
widget=gtk.Entry(),
defaultValue='',
attrGet='get_text',
attrSet='set_text',
canEdit=False,
tooltip='Host the database is located at'
),
self.FieldWidget(
text='Port:',
attrDatabase='port',
widget=gtk.SpinButton(adjustment=gtk.Adjustment(value=0, lower=0, upper=999999, step_incr=1, page_incr=10) ),
defaultValue=0,
attrGet='get_value',
attrSet='set_value',
canEdit=False,
tooltip='Port to use to connect to the host'
),
self.FieldWidget(
text='User:',
attrDatabase='user',
widget=gtk.Entry(),
defaultValue='',
attrGet='get_text',
attrSet='set_text',
canEdit=False,
tooltip='User name used to login to the host'
),
self.FieldWidget(
text='Pwd:',
attrDatabase='password',
widget=gtk.Entry(),
defaultValue='',
attrGet='get_text',
attrSet='set_text',
canEdit=False,
tooltip='Password used to login to the host'
),
self.FieldWidget(
text='Db:',
attrDatabase='database',
widget=gtk.Entry(),
defaultValue='',
attrGet='get_text',
attrSet='set_text',
canEdit=False,
tooltip='Name of the database'
),
)
# setup database type combo
self.comboType = gtk.ComboBox()
listStore= gtk.ListStore(str, str)
self.comboType.set_model(listStore)
cell = gtk.CellRendererText()
self.comboType.pack_start(cell, True)
self.comboType.add_attribute(cell, 'text', 0)
self.comboType.connect('changed', self.on_combo_type_changed)
# fill database type combo with available database klasses. we store (databaseDisplayName, databaseType) in our model for later lookup
iCurrentDatabase = 0
databaseTypes = [(klass.display_name(), klass.Type) for klass in databaseManager.DatabaseTypes.values()]
databaseTypes.sort()
for i, (databaseDisplayName, databaseType) in enumerate(databaseTypes):
listStore.append( (databaseDisplayName, databaseType) )
if databaseType == self.database.Type:
iCurrentDatabase = i
if self.mode == self.ModeEdit or len(databaseTypes) < 2:
self.comboType.set_button_sensitivity(gtk.SENSITIVITY_OFF)
# init and layout field widgets
self.pack_start(self.comboType, False, False, 2)
table = gtk.Table(rows=len(self.fieldWidgets) +1, columns=2, homogeneous=False)
self.pack_start(table, False, False, 2)
for i,fieldWidget in enumerate(self.fieldWidgets):
table.attach(fieldWidget.label(), 0, 1, i, i+1, xoptions=gtk.FILL)
table.attach(fieldWidget.widget(), 1, 2, i, i+1)
# init widget
self.comboType.set_active(iCurrentDatabase)
self._adjust_widgets(self.database)
def _adjust_widgets(self, database):
for fieldWidget in self.fieldWidgets:
isSensitive = fieldWidget.is_sensitive(database)
if isSensitive:
fieldWidget.value_from_database(database)
else:
fieldWidget.reset_value()
if self.mode == self.ModeEdit:
isSensitive = isSensitive and fieldWidget.can_edit()
fieldWidget.set_sensitive(isSensitive)
def on_combo_type_changed(self, combo):
i = self.comboType.get_active()
if i < 0:
return
# check if we need to init a new database
currentDatabaseType = self.comboType.get_model()[i][1]
if currentDatabaseType == self.database.Type:
return
# create new empty database
#NOTE: we dont register it in DatabaseManager
self.database = self.databaseManager.DatabaseTypes[currentDatabaseType]()
self._adjust_widgets(self.database)
def get_database(self):
for fieldWidget in self.fieldWidgets:
if fieldWidget.is_sensitive(self.database):
fieldWidget.value_to_database(self.database)
return self.database
class DialogDatabaseProperties(gtk.Dialog):
def __init__(self, databaseManager, database, parent=None, mode=WidgetDatabaseProperties.ModeEdit, title=''):
gtk.Dialog.__init__(self,
title=title,
parent=parent,
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
buttons=(
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
)
)
self.connect('response', self.on_dialog_response)
# setup widget
self.widgetDatabaseProperties = WidgetDatabaseProperties(databaseManager,database, mode=mode, parentWidget=self)
self.vbox.pack_start(self.widgetDatabaseProperties, True, True)
self.show_all()
def get_widget_database_properties(self):
return self.widgetDatabaseProperties
def on_dialog_response(self, dlg, responseId):
if responseId == gtk.RESPONSE_REJECT:
pass
elif responseId == gtk.RESPONSE_ACCEPT:
pass
#TODO: derrive from gtk.VBox?
# ..is there a way to derrive from gtk.Widget or similar? this would make parentWidget kw obsolete
class WidgetDatabaseManager(gtk.VBox):
"""
"""
def __init__(self, databaseManager, parentWidget=None):
gtk.VBox.__init__(self)
self.parentWidget = parentWidget
self.databaseManager = databaseManager
self.databaseManager.connect('database-activated', self.on_database_manager_database_activated)
self.databaseManager.connect('database-deactivated', self.on_database_manager_database_deactivated)
self.databaseStatusNames = {
DatabaseTypeBase.StatusActive: 'Active',
DatabaseTypeBase.StatusInactive: 'Inactive',
DatabaseTypeBase.StatusError: 'Error',
}
#TODO: dono how to make word wrap work as expected
self.labelInfo = gtk.Label('database management')
self.labelInfo.set_line_wrap(True)
self.labelInfo.set_selectable(True)
self.labelInfo.set_single_line_mode(False)
self.labelInfo.set_alignment(0, 0)
# database management buttons
#TODO: bit messy the distinction New/Add/Edit. we'd have to pass three flags to DialogDatabaseProperties
# to handle this. maybe drop Edit (is just a Remove + Add), to keep things simple
self.buttonDatabaseActivate = gtk.Button("Activate")
self.buttonDatabaseActivate.set_tooltip_text('activates the database')
self.buttonDatabaseActivate.connect('clicked', self.on_button_database_activate_clicked)
self.buttonDatabaseActivate.set_sensitive(False)
self.buttonDatabaseNew = gtk.Button("New..")
self.buttonDatabaseNew.set_tooltip_text('creates a new database')
self.buttonDatabaseNew.connect('clicked', self.on_button_database_new_clicked)
self.buttonDatabaseAdd = gtk.Button("Add..")
self.buttonDatabaseAdd.set_tooltip_text('adds an existing database')
self.buttonDatabaseAdd.connect('clicked', self.on_button_database_add_clicked)
self.buttonDatabaseEdit = gtk.Button("Edit..")
self.buttonDatabaseEdit.set_tooltip_text('edit database settings')
self.buttonDatabaseEdit.connect('clicked', self.on_button_database_edit_clicked)
self.buttonDatabaseEdit.set_sensitive(False)
self.buttonDatabaseRemove = gtk.Button("Remove")
self.buttonDatabaseRemove.set_tooltip_text('removes the database from the list')
self.buttonDatabaseRemove.set_sensitive(False)
self.buttonDatabaseRemove.connect('clicked', self.on_button_database_remove_clicked)
#TODO: i dont think we should do any real database management here. maybe drop it
#self.buttonDatabaseDelete = gtk.Button("Delete")
#self.buttonDatabaseDelete.set_tooltip_text('removes the database from the list and deletes it')
#self.buttonDatabaseDelete.set_sensitive(False)
# init database tree
self.treeDatabases = gtk.TreeView()
treeDatabaseColumns = ( # name, displayName, dataType
('name', 'Name', str),
('status', 'Status', str),
('type', 'Type', str),
('_id', '', int),
)
self.treeDatabaseColumns = {} # name --> index
store = gtk.ListStore( *[i[2] for i in treeDatabaseColumns] )
self.treeDatabases.set_model(store)
for i, (name, displayName, dataType) in enumerate(treeDatabaseColumns):
col = gtk.TreeViewColumn(displayName, gtk.CellRendererText(), text=i)
self.treeDatabases.append_column(col)
if name.startswith('_'):
col.set_visible(False)
self.treeDatabaseColumns[name] = i
self.treeDatabases.get_selection().connect('changed', self.on_tree_databases_selection_changed)
# layout widgets
vbox = gtk.VBox(self)
vbox.pack_start(self.labelInfo, False, False, 2)
vbox.pack_start(gtk.HSeparator(), False, False, 2)
hbox = gtk.HBox()
self.add(hbox)
hbox.set_homogeneous(False)
vbox = gtk.VBox()
hbox.pack_start(vbox, False, False, 2)
vbox.pack_start(self.buttonDatabaseActivate, False, False, 2)
vbox.pack_start(self.buttonDatabaseNew, False, False, 2)
vbox.pack_start(self.buttonDatabaseAdd, False, False, 2)
vbox.pack_start(self.buttonDatabaseEdit, False, False, 2)
vbox.pack_start(self.buttonDatabaseRemove, False, False, 2)
#vbox.pack_start(self.buttonDatabaseDelete, False, False, 2)
box = gtk.VBox()
vbox.pack_start(box, True, True, 0)
hbox.pack_start(gtk.VSeparator(), False, False, 2)
hbox.pack_end(self.treeDatabases, True, True, 2)
self.show_all()
# init widget
model = self.treeDatabases.get_model()
for database in self.databaseManager:
it = model.append()
model.set_value(it, self.treeDatabaseColumns['name'], database.name)
model.set_value(it, self.treeDatabaseColumns['status'], self.databaseStatusNames[database.status] )
model.set_value(it, self.treeDatabaseColumns['type'], database.display_name() )
model.set_value(it, self.treeDatabaseColumns['_id'], self.databaseManager.database_id(database))
def on_database_manager_database_activated(self, databaseManager, idDatabase):
database = self.databaseManager.database_from_id(idDatabase)
model = self.treeDatabases.get_model()
for row in iter(model):
if row[self.treeDatabaseColumns['_id']] == idDatabase:
row[self.treeDatabaseColumns['status']] = self.databaseStatusNames[database.StatusActive]
break
else:
raise ValueError('database not found')
def on_database_manager_database_deactivated(self, databaseManager, idDatabase):
database = self.databaseManager.database_from_id(idDatabase)
model = self.treeDatabases.get_model()
for row in iter(model):
if row[self.treeDatabaseColumns['_id']] == idDatabase:
row[self.treeDatabaseColumns['status']] = self.databaseStatusNames[database.StatusInactive]
break
else:
raise ValueError('database not found')
def on_button_database_activate_clicked(self, button):
selection = self.treeDatabases.get_selection()
if selection is None:
return
model, it = selection.get_selected()
idDatabase = model.get_value(it, self.treeDatabaseColumns['_id'])
database = self.databaseManager.database_from_id(idDatabase)
self.databaseManager.activate_database(database)
#TODO: for some reason i have to click OK/Cancel twice to close the dialog
def on_button_database_new_clicked(self, button):
databaseKlass = self.databaseManager.get_default_database_type()
if databaseKlass is None:
raise ValueError('no default database type set')
database = databaseKlass()
while True:
dlg = DialogDatabaseProperties(
self.databaseManager,
database,
parent=self.parentWidget,
mode=WidgetDatabaseProperties.ModeNew,
title='New database'
)
response = dlg.run()
if response == gtk.RESPONSE_ACCEPT:
database = dlg.get_widget_database_properties().get_database()
#TODO: initing may or may not take a while. how to handle?
error = database.init_new_database()
if error:
DialogError(parent=dlg, msg=error)
dlg.destroy()
continue
else:
database = None
dlg.destroy()
break
if database is None:
return
self.databaseManager.add_database(database)
model = self.treeDatabases.get_model()
it = model.append()
model.set_value(it, self.treeDatabaseColumns['name'], database.name)
model.set_value(it, self.treeDatabaseColumns['status'], self.databaseStatusNames[database.status] )
model.set_value(it, self.treeDatabaseColumns['type'], database.display_name() )
model.set_value(it, self.treeDatabaseColumns['_id'], self.databaseManager.database_id(database))
def on_button_database_add_clicked(self, button):
databaseKlass = self.databaseManager.get_default_database_type()
if databaseKlass is None:
raise ValueError('no defult database type set')
database = databaseKlass()
while True:
dlg = DialogDatabaseProperties(
self.databaseManager,
database,
parent=self.parentWidget,
mode=WidgetDatabaseProperties.ModeAdd,
title='Add database'
)
response = dlg.run()
if response == gtk.RESPONSE_ACCEPT:
database = dlg.get_widget_database_properties().get_database()
#TODO: validating may or may not take a while. how to handle?
error = database.validate_database()
if error:
DialogError(parent=self.parentWidget, msg=error)
dlg.destroy()
continue
else:
database = None
dlg.destroy()
break
if database is None:
return
self.databaseManager.add_database(database)
model = self.treeDatabases.get_model()
it = model.append()
model.set_value(it, self.treeDatabaseColumns['name'], database.name)
model.set_value(it, self.treeDatabaseColumns['status'], self.databaseStatusNames[database.status] )
model.set_value(it, self.treeDatabaseColumns['type'], database.display_name() )
model.set_value(it, self.treeDatabaseColumns['_id'], self.databaseManager.database_id(database))
dlg.destroy()
def on_button_database_edit_clicked(self, button):
selection = self.treeDatabases.get_selection()
if selection is None:
return
model, it = selection.get_selected()
idDatabase = model.get_value(it, self.treeDatabaseColumns['_id'])
database = self.databaseManager.database_from_id(idDatabase)
dlg = DialogDatabaseProperties(
self.databaseManager,
database,
parent=self.parentWidget,
mode=WidgetDatabaseProperties.ModeEdit,
title='Edit database'
)
response = dlg.run()
if response == gtk.RESPONSE_REJECT:
pass
elif response == gtk.RESPONSE_ACCEPT:
database = dlg.get_database()
selection = self.treeDatabases.get_selection()
if selection is not None:
model, it = selection.get_selected()
model.set_value(it, self.treeDatabaseColumns['name'], database.name)
dlg.destroy()
def on_button_database_remove_clicked(self, button):
selection = self.treeDatabases.get_selection()
if selection is None:
return
model, it = selection.get_selected()
#TODO: finalize database
model.remove(it)
def on_tree_databases_selection_changed(self, treeSelection):
hasSelection = bool(treeSelection.count_selected_rows())
# enable/disable selection dependend widgets
self.buttonDatabaseActivate.set_sensitive(hasSelection)
self.buttonDatabaseEdit.set_sensitive(hasSelection)
self.buttonDatabaseRemove.set_sensitive(hasSelection)
#self.buttonDatabaseDelete.set_sensitive(hasSelection)
class DialogDatabaseManager(gtk.Dialog):
def __init__(self, databaseManager, parent=None):
gtk.Dialog.__init__(self,
title="Databases",
parent=parent,
flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
buttons=(
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
))
#self.set_size_request(260, 250)
self.widgetDatabaseManager = WidgetDatabaseManager(databaseManager, parentWidget=self)
self.vbox.pack_start(self.widgetDatabaseManager, True, True)
self.show_all()
#**************************************************************************************************
if __name__ == '__main__':
databaseManager = DatabaseManager.from_fpdb('', defaultDatabaseType=DatabaseTypeSqLite)
#d = DialogDatabaseProperties(
# DatabaseManager(defaultDatabaseType=DatabaseTypeSqLite),
#database=DatabaseTypePostgres(),
# database=None,
# )
d = DialogDatabaseManager(databaseManager)
d.connect("destroy", gtk.main_quit)
d.run()
#gtk.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
#fpdb modules #fpdb modules
import Card import Card
@ -97,7 +97,7 @@ class DerivedStats():
self.hands['tableName'] = hand.tablename self.hands['tableName'] = hand.tablename
self.hands['siteHandNo'] = hand.handid self.hands['siteHandNo'] = hand.handid
self.hands['gametypeId'] = None # Leave None, handled later after checking db self.hands['gametypeId'] = None # Leave None, handled later after checking db
self.hands['handStart'] = hand.starttime # format this! self.hands['handStart'] = hand.startTime # format this!
self.hands['importTime'] = None self.hands['importTime'] = None
self.hands['seats'] = self.countPlayers(hand) self.hands['seats'] = self.countPlayers(hand)
self.hands['maxSeats'] = hand.maxseats self.hands['maxSeats'] = hand.maxseats
@ -139,6 +139,7 @@ class DerivedStats():
for player in hand.players: for player in hand.players:
self.handsplayers[player[1]]['seatNo'] = player[0] self.handsplayers[player[1]]['seatNo'] = player[0]
self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2])) self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2]))
self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection
# XXX: enumerate(list, start=x) is python 2.6 syntax; 'start' # XXX: enumerate(list, start=x) is python 2.6 syntax; 'start'
#for i, street in enumerate(hand.actionStreets[2:], start=1): #for i, street in enumerate(hand.actionStreets[2:], start=1):
@ -431,6 +432,11 @@ class DerivedStats():
self.handsplayers[player[1]]['street%sAggr' % i] = True self.handsplayers[player[1]]['street%sAggr' % i] = True
else: else:
self.handsplayers[player[1]]['street%sAggr' % i] = False self.handsplayers[player[1]]['street%sAggr' % i] = False
if len(aggrers)>0 and i>0:
for playername in others:
self.handsplayers[playername]['otherRaisedStreet%s' % i] = True
#print "otherRaised detected on handid "+str(hand.handid)+" for "+playername+" on street "+str(i)
if i > 0 and len(aggrers) > 0: if i > 0 and len(aggrers) > 0:
for playername in others: for playername in others:
@ -450,8 +456,7 @@ class DerivedStats():
for act in hand.actions[hand.actionStreets[i+1]]: for act in hand.actions[hand.actionStreets[i+1]]:
if act[1] in ('bets'): if act[1] in ('bets'):
self.handsplayers[act[0]]['street%sBets' % i] = 1 + self.handsplayers[act[0]]['street%sBets' % i] self.handsplayers[act[0]]['street%sBets' % i] = 1 + self.handsplayers[act[0]]['street%sBets' % i]
def folds(self, hand, i): def folds(self, hand, i):
for act in hand.actions[hand.actionStreets[i+1]]: for act in hand.actions[hand.actionStreets[i+1]]:
if act[1] in ('folds'): if act[1] in ('folds'):

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2008, Carl Gherardi # Copyright 2008-2010, Carl Gherardi
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -154,7 +154,7 @@ or None if we fail to get the info """
# 2008/11/10 3:58:52 ET # 2008/11/10 3:58:52 ET
#TODO: Do conversion from GMT to ET #TODO: Do conversion from GMT to ET
#TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this) #TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this)
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%Y/%m/%d - %H:%M:%S") hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%Y/%m/%d - %H:%M:%S")
return return
def readPlayerStacks(self, hand): def readPlayerStacks(self, hand):

View File

@ -1,3 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2009-2010 Matt Turnbull
#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.
class FpdbError(Exception): class FpdbError(Exception):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import threading import threading
import pygtk import pygtk

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,9 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
############################################################################ ############################################################################
# #

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2008, Carl Gherardi # Copyright 2008-2010, Carl Gherardi
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@
import logging import logging
from HandHistoryConverter import * from HandHistoryConverter import *
import TourneySummary
# Fulltilt HH Format converter # Fulltilt HH Format converter
@ -66,7 +67,7 @@ class Fulltilt(HandHistoryConverter):
''', re.VERBOSE) ''', re.VERBOSE)
re_Button = re.compile('^The button is in seat #(?P<BUTTON>\d+)', re.MULTILINE) re_Button = re.compile('^The button is in seat #(?P<BUTTON>\d+)', re.MULTILINE)
re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$(?P<CASH>[,.0-9]+)\)$', re.MULTILINE) re_PlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$(?P<CASH>[,.0-9]+)\)$', re.MULTILINE)
re_TourneyPlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$?(?P<CASH>[,.0-9]+)\)(, is sitting out)?$', re.MULTILINE) re_TourneysPlayerInfo = re.compile('Seat (?P<SEAT>[0-9]+): (?P<PNAME>.{2,15}) \(\$?(?P<CASH>[,.0-9]+)\)(, is sitting out)?$', re.MULTILINE)
re_Board = re.compile(r"\[(?P<CARDS>.+)\]") re_Board = re.compile(r"\[(?P<CARDS>.+)\]")
#static regex for tourney purpose #static regex for tourney purpose
@ -87,8 +88,8 @@ class Fulltilt(HandHistoryConverter):
re_TourneyBuyInChips = re.compile("Buy-In Chips: (?P<BUYINCHIPS>\d+)") re_TourneyBuyInChips = re.compile("Buy-In Chips: (?P<BUYINCHIPS>\d+)")
re_TourneyEntries = re.compile("(?P<ENTRIES>\d+) Entries") re_TourneyEntries = re.compile("(?P<ENTRIES>\d+) Entries")
re_TourneyPrizePool = re.compile("Total Prize Pool: (?P<PRIZEPOOL_CURRENCY>\$|)?(?P<PRIZEPOOL>[.,0-9]+)") re_TourneyPrizePool = re.compile("Total Prize Pool: (?P<PRIZEPOOL_CURRENCY>\$|)?(?P<PRIZEPOOL>[.,0-9]+)")
re_TourneyRebuyAmount = re.compile("Rebuy: (?P<REBUY_CURRENCY>\$|)?(?P<REBUY_AMOUNT>[.,0-9]+)") re_TourneyRebuyCost = re.compile("Rebuy: (?P<REBUY_CURRENCY>\$|)?(?P<REBUY_COST>[.,0-9]+)")
re_TourneyAddOnAmount = re.compile("Add-On: (?P<ADDON_CURRENCY>\$|)?(?P<ADDON_AMOUNT>[.,0-9]+)") re_TourneyAddOnCost = re.compile("Add-On: (?P<ADDON_CURRENCY>\$|)?(?P<ADDON_COST>[.,0-9]+)")
re_TourneyRebuyCount = re.compile("performed (?P<REBUY_COUNT>\d+) Rebuy") re_TourneyRebuyCount = re.compile("performed (?P<REBUY_COUNT>\d+) Rebuy")
re_TourneyAddOnCount = re.compile("performed (?P<ADDON_COUNT>\d+) Add-On") re_TourneyAddOnCount = re.compile("performed (?P<ADDON_COUNT>\d+) Add-On")
re_TourneyRebuysTotal = re.compile("Total Rebuys: (?P<REBUY_TOTAL>\d+)") re_TourneyRebuysTotal = re.compile("Total Rebuys: (?P<REBUY_TOTAL>\d+)")
@ -96,10 +97,10 @@ class Fulltilt(HandHistoryConverter):
re_TourneyRebuyChips = re.compile("Rebuy Chips: (?P<REBUY_CHIPS>\d+)") re_TourneyRebuyChips = re.compile("Rebuy Chips: (?P<REBUY_CHIPS>\d+)")
re_TourneyAddOnChips = re.compile("Add-On Chips: (?P<ADDON_CHIPS>\d+)") re_TourneyAddOnChips = re.compile("Add-On Chips: (?P<ADDON_CHIPS>\d+)")
re_TourneyKOBounty = re.compile("Knockout Bounty: (?P<KO_BOUNTY_CURRENCY>\$|)?(?P<KO_BOUNTY_AMOUNT>[.,0-9]+)") re_TourneyKOBounty = re.compile("Knockout Bounty: (?P<KO_BOUNTY_CURRENCY>\$|)?(?P<KO_BOUNTY_AMOUNT>[.,0-9]+)")
re_TourneyCountKO = re.compile("received (?P<COUNT_KO>\d+) Knockout Bounty Award(s)?") re_TourneyKoCount = re.compile("received (?P<COUNT_KO>\d+) Knockout Bounty Award(s)?")
re_TourneyTimeInfo = re.compile("Tournament started: (?P<STARTTIME>.*)\nTournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$") re_TourneyTimeInfo = re.compile("Tournament started: (?P<STARTTIME>.*)\nTournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$")
re_TourneyPlayersSummary = re.compile("^(?P<RANK>(Still Playing|\d+))( - |: )(?P<PNAME>[^\n,]+)(, )?(?P<WINNING_CURRENCY>\$|)?(?P<WINNING>[.\d]+)?", re.MULTILINE) re_TourneysPlayersSummary = re.compile("^(?P<RANK>(Still Playing|\d+))( - |: )(?P<PNAME>[^\n,]+)(, )?(?P<WINNING_CURRENCY>\$|)?(?P<WINNING>[.\d]+)?", re.MULTILINE)
re_TourneyHeroFinishingP = re.compile("(?P<HERO_NAME>.*) finished in (?P<HERO_FINISHING_POS>\d+)(st|nd|rd|th) place") re_TourneyHeroFinishingP = re.compile("(?P<HERO_NAME>.*) finished in (?P<HERO_FINISHING_POS>\d+)(st|nd|rd|th) place")
#TODO: See if we need to deal with play money tourney summaries -- Not right now (they shouldn't pass the re_TourneyInfo) #TODO: See if we need to deal with play money tourney summaries -- Not right now (they shouldn't pass the re_TourneyInfo)
@ -200,7 +201,7 @@ class Fulltilt(HandHistoryConverter):
return None return None
hand.handid = m.group('HID') hand.handid = m.group('HID')
hand.tablename = m.group('TABLE') hand.tablename = m.group('TABLE')
hand.starttime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d") hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d")
if m.group("CANCELLED") or m.group("PARTIAL"): if m.group("CANCELLED") or m.group("PARTIAL"):
raise FpdbParseError(hid=m.group('HID')) raise FpdbParseError(hid=m.group('HID'))
@ -221,7 +222,14 @@ class Fulltilt(HandHistoryConverter):
else: else:
hand.tourneyComment = n.group('TOURNEY_NAME') # can be None hand.tourneyComment = n.group('TOURNEY_NAME') # can be None
if (n.group('CURRENCY') is not None and n.group('BUYIN') is not None and n.group('FEE') is not None): if (n.group('CURRENCY') is not None and n.group('BUYIN') is not None and n.group('FEE') is not None):
hand.buyin = "%s%s+%s%s" %(n.group('CURRENCY'), n.group('BUYIN'), n.group('CURRENCY'), n.group('FEE')) if n.group('CURRENCY')=="$":
hand.buyinCurrency="USD"
elif n.group('CURRENCY')==u"":
hand.buyinCurrency="EUR"
else:
hand.buyinCurrency="NA"
hand.buyin = int(100*Decimal(n.group('BUYIN')))
hand.fee = int(100*Decimal(n.group('FEE')))
if n.group('TURBO') is not None : if n.group('TURBO') is not None :
hand.speed = "Turbo" hand.speed = "Turbo"
if n.group('SPECIAL') is not None : if n.group('SPECIAL') is not None :
@ -231,7 +239,7 @@ class Fulltilt(HandHistoryConverter):
if special == "KO": if special == "KO":
hand.isKO = True hand.isKO = True
if special == "Head's Up": if special == "Head's Up":
hand.isHU = True hand.maxSeats = 2
if re.search("Matrix", special): if re.search("Matrix", special):
hand.isMatrix = True hand.isMatrix = True
if special == "Shootout": if special == "Shootout":
@ -264,7 +272,7 @@ class Fulltilt(HandHistoryConverter):
if hand.gametype['type'] == "ring" : if hand.gametype['type'] == "ring" :
m = self.re_PlayerInfo.finditer(pre) m = self.re_PlayerInfo.finditer(pre)
else: #if hand.gametype['type'] == "tour" else: #if hand.gametype['type'] == "tour"
m = self.re_TourneyPlayerInfo.finditer(pre) m = self.re_TourneysPlayerInfo.finditer(pre)
for a in m: for a in m:
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH')) hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH'))
@ -430,10 +438,10 @@ class Fulltilt(HandHistoryConverter):
if m: if m:
# info list should be 2 lines : Tourney infos & Finsihing postions with winnings # info list should be 2 lines : Tourney infos & Finsihing postions with winnings
if (len(summaryInfoList) != 2 ): if (len(summaryInfoList) != 2 ):
log.info("Too many lines (%d) in file '%s' : '%s'" % (len(summaryInfoList), self.in_path, summaryInfoList) ) log.info("Too many or too few lines (%d) in file '%s' : '%s'" % (len(summaryInfoList), self.in_path, summaryInfoList) )
self.status = False self.status = False
else: else:
self.tourney = Tourney.Tourney(sitename = self.sitename, gametype = None, summaryText = summaryInfoList, builtFrom = "HHC") self.tourney = TourneySummary.TourneySummary(sitename = self.sitename, gametype = None, summaryText = summaryInfoList, builtFrom = "HHC")
self.status = self.getPlayersPositionsAndWinnings(self.tourney) self.status = self.getPlayersPositionsAndWinnings(self.tourney)
if self.status == True : if self.status == True :
self.status = self.determineTourneyType(self.tourney) self.status = self.determineTourneyType(self.tourney)
@ -497,7 +505,6 @@ class Fulltilt(HandHistoryConverter):
if special == "KO": if special == "KO":
tourney.isKO = True tourney.isKO = True
if special == "Heads Up": if special == "Heads Up":
tourney.isHU = True
tourney.maxseats = 2 tourney.maxseats = 2
if re.search("Matrix", special): if re.search("Matrix", special):
tourney.isMatrix = True tourney.isMatrix = True
@ -566,8 +573,8 @@ class Fulltilt(HandHistoryConverter):
dictRegex = { "BUYINCHIPS" : self.re_TourneyBuyInChips, dictRegex = { "BUYINCHIPS" : self.re_TourneyBuyInChips,
"ENTRIES" : self.re_TourneyEntries, "ENTRIES" : self.re_TourneyEntries,
"PRIZEPOOL" : self.re_TourneyPrizePool, "PRIZEPOOL" : self.re_TourneyPrizePool,
"REBUY_AMOUNT" : self.re_TourneyRebuyAmount, "REBUY_COST" : self.re_TourneyRebuyCost,
"ADDON_AMOUNT" : self.re_TourneyAddOnAmount, "ADDON_COST" : self.re_TourneyAddOnCost,
"REBUY_TOTAL" : self.re_TourneyRebuysTotal, "REBUY_TOTAL" : self.re_TourneyRebuysTotal,
"ADDONS_TOTAL" : self.re_TourneyAddOnsTotal, "ADDONS_TOTAL" : self.re_TourneyAddOnsTotal,
"REBUY_CHIPS" : self.re_TourneyRebuyChips, "REBUY_CHIPS" : self.re_TourneyRebuyChips,
@ -580,10 +587,10 @@ class Fulltilt(HandHistoryConverter):
dictHolders = { "BUYINCHIPS" : "buyInChips", dictHolders = { "BUYINCHIPS" : "buyInChips",
"ENTRIES" : "entries", "ENTRIES" : "entries",
"PRIZEPOOL" : "prizepool", "PRIZEPOOL" : "prizepool",
"REBUY_AMOUNT" : "rebuyAmount", "REBUY_COST" : "rebuyCost",
"ADDON_AMOUNT" : "addOnAmount", "ADDON_COST" : "addOnCost",
"REBUY_TOTAL" : "totalRebuys", "REBUY_TOTAL" : "totalRebuyCount",
"ADDONS_TOTAL" : "totalAddOns", "ADDONS_TOTAL" : "totalAddOnCount",
"REBUY_CHIPS" : "rebuyChips", "REBUY_CHIPS" : "rebuyChips",
"ADDON_CHIPS" : "addOnChips", "ADDON_CHIPS" : "addOnChips",
"STARTTIME" : "starttime", "STARTTIME" : "starttime",
@ -607,42 +614,39 @@ class Fulltilt(HandHistoryConverter):
if m is not None: if m is not None:
mg = m.groupdict() mg = m.groupdict()
if mg['REBUY_COUNT'] is not None : if mg['REBUY_COUNT'] is not None :
tourney.countRebuys.update( { tourney.hero : Decimal(mg['REBUY_COUNT']) } ) tourney.rebuyCounts.update( { tourney.hero : Decimal(mg['REBUY_COUNT']) } )
m = self.re_TourneyAddOnCount.search(tourneyText) m = self.re_TourneyAddOnCount.search(tourneyText)
if m is not None: if m is not None:
mg = m.groupdict() mg = m.groupdict()
if mg['ADDON_COUNT'] is not None : if mg['ADDON_COUNT'] is not None :
tourney.countAddOns.update( { tourney.hero : Decimal(mg['ADDON_COUNT']) } ) tourney.addOnCounts.update( { tourney.hero : Decimal(mg['ADDON_COUNT']) } )
m = self.re_TourneyCountKO.search(tourneyText) m = self.re_TourneyKoCount.search(tourneyText)
if m is not None: if m is not None:
mg = m.groupdict() mg = m.groupdict()
if mg['COUNT_KO'] is not None : if mg['COUNT_KO'] is not None :
tourney.countKO.update( { tourney.hero : Decimal(mg['COUNT_KO']) } ) tourney.koCounts.update( { tourney.hero : Decimal(mg['COUNT_KO']) } )
# Deal with money amounts # Deal with money amounts
tourney.koBounty = 100*Decimal(re.sub(u',', u'', "%s" % tourney.koBounty)) tourney.koBounty = 100*Decimal(re.sub(u',', u'', "%s" % tourney.koBounty))
tourney.prizepool = 100*Decimal(re.sub(u',', u'', "%s" % tourney.prizepool)) tourney.prizepool = 100*Decimal(re.sub(u',', u'', "%s" % tourney.prizepool))
tourney.rebuyAmount = 100*Decimal(re.sub(u',', u'', "%s" % tourney.rebuyAmount)) tourney.rebuyCost = 100*Decimal(re.sub(u',', u'', "%s" % tourney.rebuyCost))
tourney.addOnAmount = 100*Decimal(re.sub(u',', u'', "%s" % tourney.addOnAmount)) tourney.addOnCost = 100*Decimal(re.sub(u',', u'', "%s" % tourney.addOnCost))
# Calculate payin amounts and update winnings -- not possible to take into account nb of rebuys, addons or Knockouts for other players than hero on FTP # Calculate payin amounts and update winnings -- not possible to take into account nb of rebuys, addons or Knockouts for other players than hero on FTP
for p in tourney.players : for p in tourney.players :
tourney.payinAmounts[p] = tourney.buyin + tourney.fee + (tourney.rebuyAmount * tourney.countRebuys[p]) + (tourney.addOnAmount * tourney.countAddOns[p])
#print " player %s : payinAmount = %d" %( p, tourney.payinAmounts[p])
if tourney.isKO : if tourney.isKO :
#tourney.incrementPlayerWinnings(tourney.players[p], Decimal(tourney.koBounty)*Decimal(tourney.countKO[p])) #tourney.incrementPlayerWinnings(tourney.players[p], Decimal(tourney.koBounty)*Decimal(tourney.koCounts[p]))
tourney.winnings[p] += Decimal(tourney.koBounty)*Decimal(tourney.countKO[p]) tourney.winnings[p] += Decimal(tourney.koBounty)*Decimal(tourney.koCounts[p])
#print "player %s : winnings %d" % (p, tourney.winnings[p]) #print "player %s : winnings %d" % (p, tourney.winnings[p])
#print mg #print mg
return True return True
#end def determineTourneyType
def getPlayersPositionsAndWinnings(self, tourney): def getPlayersPositionsAndWinnings(self, tourney):
playersText = tourney.summaryText[1] playersText = tourney.summaryText[1]
#print "Examine : '%s'" %(playersText) #print "Examine : '%s'" %(playersText)
m = self.re_TourneyPlayersSummary.finditer(playersText) m = self.re_TourneysPlayersSummary.finditer(playersText)
for a in m: for a in m:
if a.group('PNAME') is not None and a.group('RANK') is not None: if a.group('PNAME') is not None and a.group('RANK') is not None:
@ -656,7 +660,7 @@ class Fulltilt(HandHistoryConverter):
else: else:
winnings = "0" winnings = "0"
tourney.addPlayer(rank, a.group('PNAME'), winnings, 0, 0, 0, 0) tourney.addPlayer(rank, a.group('PNAME'), winnings, "USD", 0, 0, 0) #TODO: make it store actual winnings currency
else: else:
print "FullTilt: Player finishing stats unreadable : %s" % a print "FullTilt: Player finishing stats unreadable : %s" % a
@ -666,10 +670,10 @@ class Fulltilt(HandHistoryConverter):
heroName = n.group('HERO_NAME') heroName = n.group('HERO_NAME')
tourney.hero = heroName tourney.hero = heroName
# Is this really useful ? # Is this really useful ?
if heroName not in tourney.finishPositions: if heroName not in tourney.ranks:
print "FullTilt:", heroName, "not found in tourney.finishPositions ..." print "FullTilt:", heroName, "not found in tourney.ranks ..."
elif (tourney.finishPositions[heroName] != Decimal(n.group('HERO_FINISHING_POS'))): elif (tourney.ranks[heroName] != Decimal(n.group('HERO_FINISHING_POS'))):
print "FullTilt: Bad parsing : finish position incoherent : %s / %s" % (tourney.finishPositions[heroName], n.group('HERO_FINISHING_POS')) print "FullTilt: Bad parsing : finish position incoherent : %s / %s" % (tourney.ranks[heroName], n.group('HERO_FINISHING_POS'))
return True return True

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import threading import threading
import subprocess import subprocess
@ -32,11 +32,12 @@ import Configuration
import string import string
class GuiAutoImport (threading.Thread): class GuiAutoImport (threading.Thread):
def __init__(self, settings, config, sql): def __init__(self, settings, config, sql, parent):
self.importtimer = 0 self.importtimer = 0
self.settings = settings self.settings = settings
self.config = config self.config = config
self.sql = sql self.sql = sql
self.parent = parent
imp = self.config.get_import_parameters() imp = self.config.get_import_parameters()
@ -138,6 +139,8 @@ class GuiAutoImport (threading.Thread):
#dia_chooser.set_current_folder(pathname) #dia_chooser.set_current_folder(pathname)
dia_chooser.set_filename(current_path) dia_chooser.set_filename(current_path)
#dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import #dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
dia_chooser.set_destroy_with_parent(True)
dia_chooser.set_transient_for(self.parent)
response = dia_chooser.run() response = dia_chooser.run()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:

View File

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

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -13,9 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import os import os
import sys import sys

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import threading import threading
import pygtk import pygtk
@ -23,6 +23,7 @@ import os
import sys import sys
import traceback import traceback
from time import * from time import *
from datetime import datetime
#import pokereval #import pokereval
try: try:
@ -48,11 +49,12 @@ import Charset
class GuiGraphViewer (threading.Thread): class GuiGraphViewer (threading.Thread):
def __init__(self, querylist, config, debug=True): def __init__(self, querylist, config, parent, debug=True):
"""Constructor for GraphViewer""" """Constructor for GraphViewer"""
self.sql = querylist self.sql = querylist
self.conf = config self.conf = config
self.debug = debug self.debug = debug
self.parent = parent
#print "start of GraphViewer constructor" #print "start of GraphViewer constructor"
self.db = Database.Database(self.conf, sql=self.sql) self.db = Database.Database(self.conf, sql=self.sql)
@ -334,21 +336,41 @@ class GuiGraphViewer (threading.Thread):
def exportGraph (self, widget, data): def exportGraph (self, widget, data):
if self.fig is None: if self.fig is None:
return # Might want to disable export button until something has been generated. return # Might want to disable export button until something has been generated.
dia_chooser = gtk.FileChooserDialog(title="Please choose the directory you wish to export to:", dia_chooser = gtk.FileChooserDialog(title="Please choose the directory you wish to export to:",
action=gtk.FILE_CHOOSER_ACTION_OPEN, action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)) buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OK,gtk.RESPONSE_OK))
#TODO: Suggest path and filename to start with dia_chooser.set_destroy_with_parent(True)
dia_chooser.set_transient_for(self.parent)
try:
dia_chooser.set_filename(self.exportFile) # use previously chosen export path as default
except:
pass
response = dia_chooser.run() response = dia_chooser.run()
if response == gtk.RESPONSE_OK:
self.exportDir = dia_chooser.get_filename() if response <> gtk.RESPONSE_OK:
print "DEBUG: self.exportDir = %s" %(self.exportDir)
elif response == gtk.RESPONSE_CANCEL:
print 'Closed, no graph exported' print 'Closed, no graph exported'
dia_chooser.destroy()
return
# generate a unique filename for export
now = datetime.now()
now_formatted = now.strftime("%Y%m%d%H%M%S")
self.exportFile = dia_chooser.get_filename() + "/fpdb" + now_formatted + ".png"
dia_chooser.destroy() dia_chooser.destroy()
#TODO: Check to see if file exists
#NOTE: Dangerous - will happily overwrite any file we have write access too #print "DEBUG: self.exportFile = %s" %(self.exportFile)
#TODO: This asks for a directory but will take a filename and overwrite it. self.fig.savefig(self.exportFile, format="png")
self.fig.savefig(self.exportDir, format="png")
#display info box to confirm graph created
diainfo = gtk.MessageDialog(parent=self.parent,
flags=gtk.DIALOG_DESTROY_WITH_PARENT,
type=gtk.MESSAGE_INFO,
buttons=gtk.BUTTONS_OK,
message_format="Graph created")
diainfo.format_secondary_text(self.exportFile)
diainfo.run()
diainfo.destroy()
#end of def exportGraph

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -13,9 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import os import os
import Queue import Queue

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import traceback import traceback
import threading import threading

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import threading import threading
import pygtk import pygtk

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -13,9 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import xml.dom.minidom import xml.dom.minidom
from xml.dom.minidom import Node from xml.dom.minidom import Node

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import sys import sys
import threading import threading

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import threading import threading
import pygtk import pygtk
@ -22,7 +22,6 @@ import gtk
import os import os
import fpdb_import import fpdb_import
import fpdb_db
from Exceptions import * from Exceptions import *

View File

@ -1,10 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Hud_main.py # Copyright 2008-2010, Ray E. Barker
Main for FreePokerTools HUD.
"""
# Copyright 2008, 2009, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -22,10 +19,14 @@ Main for FreePokerTools HUD.
######################################################################## ########################################################################
# to do allow window resizing """Hud_main.py
# to do hud to echo, but ignore non numbers
# to do no stat window for hero Main for FreePokerTools HUD.
# to do things to add to config.xml """
# TODO allow window resizing
# TODO hud to echo, but ignore non numbers
# TODO no stat window for hero
# TODO things to add to config.xml
# Standard Library modules # Standard Library modules
import sys import sys

View File

@ -1,4 +1,20 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
#Copyright 2009-2010 Eric Blade
#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.
import sys import sys
import os import os
import thread import thread

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -13,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
# TODO: get writehand() encoding correct # TODO: get writehand() encoding correct
@ -38,7 +37,7 @@ import Configuration
from Exceptions import * from Exceptions import *
import DerivedStats import DerivedStats
import Card import Card
import Tourney
class Hand(object): class Hand(object):
@ -58,7 +57,7 @@ class Hand(object):
self.siteId = self.SITEIDS[sitename] self.siteId = self.SITEIDS[sitename]
self.stats = DerivedStats.DerivedStats(self) self.stats = DerivedStats.DerivedStats(self)
self.gametype = gametype self.gametype = gametype
self.starttime = 0 self.startTime = 0
self.handText = handText self.handText = handText
self.handid = 0 self.handid = 0
self.cancelled = False self.cancelled = False
@ -70,16 +69,21 @@ class Hand(object):
self.maxseats = None self.maxseats = None
self.counted_seats = 0 self.counted_seats = 0
self.buttonpos = 0 self.buttonpos = 0
#tourney stuff
self.tourNo = None self.tourNo = None
self.tourneyId = None
self.tourneyTypeId = None
self.buyin = None self.buyin = None
self.buyinCurrency = None
self.buyInChips = None
self.fee = None # the Database code is looking for this one .. ? self.fee = None # the Database code is looking for this one .. ?
self.level = None self.level = None
self.mixed = None self.mixed = None
# Some attributes for hand from a tourney
self.speed = "Normal" self.speed = "Normal"
self.isRebuy = False self.isRebuy = False
self.isAddOn = False
self.isKO = False self.isKO = False
self.isHU = False
self.isMatrix = False self.isMatrix = False
self.isShootout = False self.isShootout = False
self.tourneyComment = None self.tourneyComment = None
@ -87,7 +91,8 @@ class Hand(object):
self.seating = [] self.seating = []
self.players = [] self.players = []
self.posted = [] self.posted = []
self.tourneysPlayersIds = []
# Collections indexed by street names # Collections indexed by street names
self.bets = {} self.bets = {}
self.lastBet = {} self.lastBet = {}
@ -136,8 +141,6 @@ class Hand(object):
("TABLE NAME", self.tablename), ("TABLE NAME", self.tablename),
("HERO", self.hero), ("HERO", self.hero),
("MAXSEATS", self.maxseats), ("MAXSEATS", self.maxseats),
("TOURNAMENT NO", self.tourNo),
("BUYIN", self.buyin),
("LEVEL", self.level), ("LEVEL", self.level),
("MIXED", self.mixed), ("MIXED", self.mixed),
("LASTBET", self.lastBet), ("LASTBET", self.lastBet),
@ -153,7 +156,20 @@ class Hand(object):
("TOTAL POT", self.totalpot), ("TOTAL POT", self.totalpot),
("TOTAL COLLECTED", self.totalcollected), ("TOTAL COLLECTED", self.totalcollected),
("RAKE", self.rake), ("RAKE", self.rake),
("START TIME", self.starttime), ("START TIME", self.startTime),
("TOURNAMENT NO", self.tourNo),
("TOURNEY ID", self.tourneyId),
("TOURNEY TYPE ID", self.tourneyTypeId),
("BUYIN", self.buyin),
("BUYIN CURRENCY", self.buyinCurrency),
("BUYIN CHIPS", self.buyInChips),
("FEE", self.fee),
("IS REBUY", self.isRebuy),
("IS ADDON", self.isAddOn),
("IS KO", self.isKO),
("IS MATRIX", self.isMatrix),
("IS SHOOTOUT", self.isShootout),
("TOURNEY COMMENT", self.tourneyComment),
) )
structs = ( ("PLAYERS", self.players), structs = ( ("PLAYERS", self.players),
@ -168,6 +184,7 @@ class Hand(object):
("BOARD", self.board), ("BOARD", self.board),
("DISCARDS", self.discards), ("DISCARDS", self.discards),
("HOLECARDS", self.holecards), ("HOLECARDS", self.holecards),
("TOURNEYS PLAYER IDS", self.tourneysPlayersIds),
) )
str = '' str = ''
for (name, var) in vars: for (name, var) in vars:
@ -209,6 +226,15 @@ dealt whether they were seen in a 'dealt to' line
#Gametypes #Gametypes
self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype) self.dbid_gt = db.getGameTypeId(self.siteId, self.gametype)
if self.tourNo!=None:
self.tourneyTypeId = db.createOrUpdateTourneyType(self)
db.commit()
self.tourneyId = db.createOrUpdateTourney(self)
db.commit()
self.tourneysPlayersIds = db.createOrUpdateTourneysPlayers(self)
db.commit()
#end def prepInsert
def insert(self, db): def insert(self, db):
""" Function to insert Hand into database """ Function to insert Hand into database
@ -231,17 +257,15 @@ db: a connected Database object"""
self.dbid_hands = db.storeHand(hh) self.dbid_hands = db.storeHand(hh)
db.storeHandsPlayers(self.dbid_hands, self.dbid_pids, self.stats.getHandsPlayers()) db.storeHandsPlayers(self.dbid_hands, self.dbid_pids, self.stats.getHandsPlayers())
# HandsActions - all actions for all players for all streets - self.actions # TODO HandsActions - all actions for all players for all streets - self.actions
# HudCache data can be generated from HandsActions (HandsPlayers?) # HudCache data can be generated from HandsActions (HandsPlayers?)
# Tourneys ?
# TourneysPlayers
else: else:
log.info("Hand.insert(): hid #: %s is a duplicate" % hh['siteHandNo']) log.info("Hand.insert(): hid #: %s is a duplicate" % hh['siteHandNo'])
self.is_duplicate = True # i.e. don't update hudcache self.is_duplicate = True # i.e. don't update hudcache
raise FpdbHandDuplicate(hh['siteHandNo']) raise FpdbHandDuplicate(hh['siteHandNo'])
def updateHudCache(self, db): def updateHudCache(self, db):
db.storeHudCache(self.dbid_gt, self.dbid_pids, self.starttime, self.stats.getHandsPlayers()) db.storeHudCache(self.dbid_gt, self.dbid_pids, self.startTime, self.stats.getHandsPlayers())
def select(self, handId): def select(self, handId):
""" Function to create Hand object from database """ """ Function to create Hand object from database """
@ -604,10 +628,10 @@ Map the tuple self.gametype onto the pokerstars string describing it
gs = gs + " %s (%s) - " % (self.getGameTypeAsString(), self.getStakesAsString()) gs = gs + " %s (%s) - " % (self.getGameTypeAsString(), self.getStakesAsString())
try: try:
timestr = datetime.datetime.strftime(self.starttime, '%Y/%m/%d %H:%M:%S ET') timestr = datetime.datetime.strftime(self.startTime, '%Y/%m/%d %H:%M:%S ET')
except TypeError: except TypeError:
print "*** ERROR - HAND: calling writeGameLine with unexpected STARTTIME value, expecting datetime.date object, received:", self.starttime print "*** ERROR - HAND: calling writeGameLine with unexpected STARTTIME value, expecting datetime.date object, received:", self.startTime
print "*** Make sure your HandHistoryConverter is setting hand.starttime properly!" print "*** Make sure your HandHistoryConverter is setting hand.startTime properly!"
print "*** Game String:", gs print "*** Game String:", gs
return gs return gs
else: else:
@ -807,7 +831,7 @@ class HoldemOmahaHand(Hand):
T.h1[ T.h1[
T.span(class_='site')["%s Game #%s]" % ('PokerStars', self.handid)], T.span(class_='site')["%s Game #%s]" % ('PokerStars', self.handid)],
T.span(class_='type_limit')[ "%s ($%s/$%s)" %(self.getGameTypeAsString(), self.sb, self.bb) ], T.span(class_='type_limit')[ "%s ($%s/$%s)" %(self.getGameTypeAsString(), self.sb, self.bb) ],
T.span(class_='date')[ datetime.datetime.strftime(self.starttime,'%Y/%m/%d - %H:%M:%S ET') ] T.span(class_='date')[ datetime.datetime.strftime(self.startTime,'%Y/%m/%d - %H:%M:%S ET') ]
], ],
T.h2[ "Table '%s' %d-max Seat #%s is the button" %(self.tablename, T.h2[ "Table '%s' %d-max Seat #%s is the button" %(self.tablename,
self.maxseats, self.buttonpos)], self.maxseats, self.buttonpos)],
@ -1557,7 +1581,7 @@ limit 1""", {'handid':handid})
SELECT SELECT
h.sitehandno as hid, h.sitehandno as hid,
h.tablename as table, h.tablename as table,
h.handstart as starttime h.handstart as startTime
FROM FROM
hands as h hands as h
WHERE h.id = %(handid)s WHERE h.id = %(handid)s
@ -1565,7 +1589,7 @@ WHERE h.id = %(handid)s
res = c.fetchone() res = c.fetchone()
h.handid = res[0] h.handid = res[0]
h.tablename = res[1] h.tablename = res[1]
h.starttime = res[2] # automatically a datetime h.startTime = res[2] # automatically a datetime
# PlayerStacks # PlayerStacks
c.execute(""" c.execute("""

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""HandHistory.py """HandHistory.py
Parses HandHistory xml files and returns requested objects. Parses HandHistory xml files and returns requested objects.
""" """
# Copyright 2008, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -13,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import re import re
import sys import sys

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Hello.py """Hello.py
Hello World demostration for Aux_Window. Hello World demostration for Aux_Window.
""" """
# Copyright 2009, Ray E. Barker # Copyright 2009-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,10 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""Hud.py """Hud.py
Create and manage the hud overlays. Create and manage the hud overlays.
""" """
# Copyright 2008, 2009 Ray E. Barker # Copyright 2008-2010 Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify

View File

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

82
pyfpdb/ImapSummaries.py Executable file
View File

@ -0,0 +1,82 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008-2010 Steffen Schaumburg
#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.
"""This file is to fetch summaries through IMAP and pass them on to the appropriate parser"""
#see http://docs.python.org/library/imaplib.html for the python interface
#see http://tools.ietf.org/html/rfc2060#section-6.4.4 for IMAP4 search criteria
import sys
from imaplib import IMAP4_SSL
import PokerStarsSummary
def splitPokerStarsSummaries(emailText):
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]
for i in range(len(splitSummaries)):
splitSummaries[i]="PokerStars Tournament #"+splitSummaries[i]
return splitSummaries
#end def emailText
if __name__ == '__main__':
#TODO: move all these into the config file. until then usage is: ./ImapSummaries.py YourImapHost YourImapUser YourImapPw
configHost=sys.argv[1]
configUser=sys.argv[2]
configPw=sys.argv[3]
#TODO: specify folder, whether to use SSL
try:
server = IMAP4_SSL(configHost) #TODO: optionally non-SSL
response = server.login(configUser, configPw) #TODO catch authentication error
#print "response to logging in:",response
#print "server.list():",server.list() #prints list of folders
response = server.select("INBOX")
#print "response to selecting INBOX:",response
if response[0]!="OK":
raise error #TODO: show error message
neededMessages=[]
response, searchData = server.search(None, "SUBJECT", "PokerStars Tournament History Request")
for messageNumber in searchData[0].split(" "):
response, headerData = server.fetch(messageNumber, "(BODY[HEADER.FIELDS (SUBJECT)])")
#print "response to fetch subject:",response
if response!="OK":
raise error #TODO: show error message
if headerData[1].find("Subject: PokerStars Tournament History Request - Last x")!=1:
neededMessages.append(("PS", messageNumber))
if (len(neededMessages)==0):
raise error #TODO: show error message
for messageData in neededMessages:
response, bodyData = server.fetch(messageData[1], "(UID BODY[TEXT])")
bodyData=bodyData[0][1]
if response!="OK":
raise error #TODO: show error message
if messageData[0]=="PS":
summaryTexts=(splitPokerStarsSummaries(bodyData))
for summaryText in summaryTexts:
result=PokerStarsSummary.PokerStarsSummary(sitename="PokerStars", gametype=None, summaryText=summaryText, builtFrom = "IMAP")
#print "result:",result
#TODO: count results and output to shell like hand importer does
print "completed running Imap import, closing server connection"
finally:
try:
server.close()
finally:
pass
server.logout()

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Mucked.py """Mucked.py
Mucked cards display for FreePokerTools HUD. Mucked cards display for FreePokerTools HUD.
""" """
# Copyright 2008, 2009, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# Copyright 2008, Carl Gherardi # -*- coding: utf-8 -*-
# Copyright 2008-2010, Carl Gherardi
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -136,7 +138,7 @@ class OnGame(HandHistoryConverter):
#TODO: Do conversion from GMT to ET #TODO: Do conversion from GMT to ET
#TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this) #TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this)
hand.starttime = time.strptime(m.group('DATETIME'), "%d %b %Y %I:%M %p") hand.startTime = time.strptime(m.group('DATETIME'), "%d %b %Y %I:%M %p")
#hand.starttime = "%d/%02d/%02d %d:%02d:%02d ET" %(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')), #hand.starttime = "%d/%02d/%02d %d:%02d:%02d ET" %(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')),
#int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC'))) #int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Ray E. Barker #Copyright 2008-2010 Ray E. Barker
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import sys import sys
from optparse import OptionParser from optparse import OptionParser

View File

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

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2009, Grigorij Indigirkin # Copyright 2009-2010, Grigorij Indigirkin
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -281,7 +281,7 @@ class PartyPoker(HandHistoryConverter):
'July','August','September','October','November','December'] 'July','August','September','October','November','December']
month = months.index(m2.group('M')) + 1 month = months.index(m2.group('M')) + 1
datetimestr = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), month,m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S')) datetimestr = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), month,m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S'))
hand.starttime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S")
# FIXME: some timezone correction required # FIXME: some timezone correction required
#tzShift = defaultdict(lambda:0, {'EDT': -5, 'EST': -6, 'MSKS': 3}) #tzShift = defaultdict(lambda:0, {'EDT': -5, 'EST': -6, 'MSKS': 3})
#hand.starttime -= datetime.timedelta(hours=tzShift[m2.group('TZ')]) #hand.starttime -= datetime.timedelta(hours=tzShift[m2.group('TZ')])

View File

@ -0,0 +1,67 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008-2010 Steffen Schaumburg
#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.
"""pokerstars-specific summary parsing code"""
from decimal import Decimal
from PokerStarsToFpdb import PokerStars
from TourneySummary import *
class PokerStarsSummary(TourneySummary):
sitename = "PokerStars"
siteId = 2
#limits = PokerStars.limits
#games = PokerStars.games
# = PokerStars.
re_TourNo = re.compile("\#[0-9]+,")
re_Entries = re.compile("[0-9]+")
re_Prizepool = re.compile("\$[0-9]+\.[0-9]+")
re_Player = re.compile("""(?P<RANK>[0-9]+):\s(?P<NAME>.*)\s\(.*\),(\s\$(?P<WINNINGS>[0-9]+\.[0-9]+)\s\()?""")
# = re.compile("")
def parseSummary(self):
lines=self.summaryText.splitlines()
self.tourNo = self.re_TourNo.findall(lines[0])[0][1:-1] #ignore game and limit type as thats not recorded
#ignore lines[1] as buyin/fee are already recorded by HHC
self.entries = self.re_Entries.findall(lines[2])[0]
self.prizepool = self.re_Prizepool.findall(lines[3])[0]
self.prizepool = self.prizepool[1:-3]+self.prizepool[-2:]
#TODO: lines 4 and 5 are dates, read them
for i in range(6,len(lines)-2): #lines with rank and winnings info
if lines[i].find(":")==-1:
break
result=self.re_Player.search(lines[i])
result=result.groupdict()
rank=result['RANK']
name=result['NAME']
winnings=result['WINNINGS']
if winnings:
winnings=int(100*Decimal(winnings))
else:
winnings=0
self.addPlayer(rank, name, winnings, "USD", None, None, None)#TODO: currency, ko/addon/rebuy count -> need examples!
#end def parseSummary
#end class PokerStarsSummary

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2008, Carl Gherardi # Copyright 2008-2010, Carl Gherardi
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -22,6 +22,7 @@
import sys import sys
from HandHistoryConverter import * from HandHistoryConverter import *
from decimal import Decimal
# PokerStars HH Format # PokerStars HH Format
@ -40,6 +41,30 @@ class PokerStars(HandHistoryConverter):
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8) 'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8)
} }
# translations from captured groups to fpdb info strings
Lim_Blinds = { '0.04': ('0.01', '0.02'), '0.10': ('0.02', '0.05'), '0.20': ('0.05', '0.10'),
'0.40': ('0.10', '0.20'), '0.50': ('0.10', '0.25'), '1.00': ('0.25', '0.50'),
'2.00': ('0.50', '1.00'), '2': ('0.50', '1.00'), '4' : ('1.00', '2.00'),
'4.00': ('1.00', '2.00'), '6': ('1.00', '3.00'), '6.00': ('1.00', '3.00'),
'10.00': ('2.00', '5.00'), '20.00': ('5.00', '10.00'), '30.00': ('10.00', '15.00'),
'60.00': ('15.00', '30.00'), '100.00': ('25.00', '50.00'), '200.00': ('50.00', '100.00'),
'400.00': ('100.00', '200.00'), '1000.00': ('250.00', '500.00')}
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
games = { # base, category
"Hold'em" : ('hold','holdem'),
'Omaha' : ('hold','omahahi'),
'Omaha Hi/Lo' : ('hold','omahahilo'),
'Razz' : ('stud','razz'),
'RAZZ' : ('stud','razz'),
'7 Card Stud' : ('stud','studhi'),
'7 Card Stud Hi/Lo' : ('stud','studhilo'),
'Badugi' : ('draw','badugi'),
'Triple Draw 2-7 Lowball' : ('draw','27_3draw'),
'5 Card Draw' : ('draw','fivedraw')
}
currencies = { u'':'EUR', '$':'USD', '':'T$' }
# Static regexes # Static regexes
re_GameInfo = re.compile(u""" re_GameInfo = re.compile(u"""
@ -143,43 +168,20 @@ class PokerStars(HandHistoryConverter):
raise FpdbParseError("Unable to recognise gametype from: '%s'" % tmp) raise FpdbParseError("Unable to recognise gametype from: '%s'" % tmp)
mg = m.groupdict() mg = m.groupdict()
# translations from captured groups to fpdb info strings
Lim_Blinds = { '0.04': ('0.01', '0.02'), '0.10': ('0.02', '0.05'), '0.20': ('0.05', '0.10'),
'0.40': ('0.10', '0.20'), '0.50': ('0.10', '0.25'), '1.00': ('0.25', '0.50'),
'2.00': ('0.50', '1.00'), '2': ('0.50', '1.00'), '4' : ('1.00', '2.00'),
'4.00': ('1.00', '2.00'), '6': ('1.00', '3.00'), '6.00': ('1.00', '3.00'),
'10.00': ('2.00', '5.00'), '20.00': ('5.00', '10.00'), '30.00': ('10.00', '15.00'),
'60.00': ('15.00', '30.00'), '100.00': ('25.00', '50.00'), '200.00': ('50.00', '100.00'),
'400.00': ('100.00', '200.00'), '1000.00': ('250.00', '500.00')}
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
games = { # base, category
"Hold'em" : ('hold','holdem'),
'Omaha' : ('hold','omahahi'),
'Omaha Hi/Lo' : ('hold','omahahilo'),
'Razz' : ('stud','razz'),
'RAZZ' : ('stud','razz'),
'7 Card Stud' : ('stud','studhi'),
'7 Card Stud Hi/Lo' : ('stud','studhilo'),
'Badugi' : ('draw','badugi'),
'Triple Draw 2-7 Lowball' : ('draw','27_3draw'),
'5 Card Draw' : ('draw','fivedraw')
}
currencies = { u'':'EUR', '$':'USD', '':'T$' }
# I don't think this is doing what we think. mg will always have all # I don't think this is doing what we think. mg will always have all
# the expected keys, but the ones that didn't match in the regex will # the expected keys, but the ones that didn't match in the regex will
# have a value of None. It is OK if it throws an exception when it # have a value of None. It is OK if it throws an exception when it
# runs across an unknown game or limit or whatever. # runs across an unknown game or limit or whatever.
if 'LIMIT' in mg: if 'LIMIT' in mg:
info['limitType'] = limits[mg['LIMIT']] info['limitType'] = self.limits[mg['LIMIT']]
if 'GAME' in mg: if 'GAME' in mg:
(info['base'], info['category']) = games[mg['GAME']] (info['base'], info['category']) = self.games[mg['GAME']]
if 'SB' in mg: if 'SB' in mg:
info['sb'] = mg['SB'] info['sb'] = mg['SB']
if 'BB' in mg: if 'BB' in mg:
info['bb'] = mg['BB'] info['bb'] = mg['BB']
if 'CURRENCY' in mg: if 'CURRENCY' in mg:
info['currency'] = currencies[mg['CURRENCY']] info['currency'] = self.currencies[mg['CURRENCY']]
if 'TOURNO' in mg and mg['TOURNO'] is None: if 'TOURNO' in mg and mg['TOURNO'] is None:
info['type'] = 'ring' info['type'] = 'ring'
@ -188,8 +190,8 @@ class PokerStars(HandHistoryConverter):
if info['limitType'] == 'fl' and info['bb'] is not None and info['type'] == 'ring' and info['base'] != 'stud': if info['limitType'] == 'fl' and info['bb'] is not None and info['type'] == 'ring' and info['base'] != 'stud':
try: try:
info['sb'] = Lim_Blinds[mg['BB']][0] info['sb'] = self.Lim_Blinds[mg['BB']][0]
info['bb'] = Lim_Blinds[mg['BB']][1] info['bb'] = self.Lim_Blinds[mg['BB']][1]
except KeyError: except KeyError:
log.error("determineGameType: Lim_Blinds has no lookup for '%s'" % mg['BB']) log.error("determineGameType: Lim_Blinds has no lookup for '%s'" % mg['BB'])
log.error("determineGameType: Raising FpdbParseError") log.error("determineGameType: Raising FpdbParseError")
@ -224,29 +226,39 @@ class PokerStars(HandHistoryConverter):
datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'), a.group('M'),a.group('D'),a.group('H'),a.group('MIN'),a.group('S')) datetimestr = "%s/%s/%s %s:%s:%s" % (a.group('Y'), a.group('M'),a.group('D'),a.group('H'),a.group('MIN'),a.group('S'))
#tz = a.group('TZ') # just assume ET?? #tz = a.group('TZ') # just assume ET??
#print " tz = ", tz, " datetime =", datetimestr #print " tz = ", tz, " datetime =", datetimestr
hand.starttime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET" hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET"
# approximate rules for ET daylight savings time: # approximate rules for ET daylight savings time:
if ( hand.starttime.month == 12 # all of Dec if ( hand.startTime.month == 12 # all of Dec
or (hand.starttime.month == 11 and hand.starttime.day > 4) # and most of November or (hand.startTime.month == 11 and hand.startTime.day > 4) # and most of November
or hand.starttime.month < 3 # and all of Jan/Feb or hand.startTime.month < 3 # and all of Jan/Feb
or (hand.starttime.month == 3 and hand.starttime.day < 11) ): # and 1st 10 days of March or (hand.startTime.month == 3 and hand.startTime.day < 11) ): # and 1st 10 days of March
offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving) offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving)
else: else:
offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving) offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving)
# adjust time into UTC: # adjust time into UTC:
hand.starttime = hand.starttime + offset hand.startTime = hand.startTime + offset
#print " tz = %s start = %s" % (tz, str(hand.starttime)) #print " tz = %s start = %s" % (tz, str(hand.startTime))
if key == 'HID': if key == 'HID':
hand.handid = info[key] hand.handid = info[key]
if key == 'TOURNO': if key == 'TOURNO':
hand.tourNo = info[key] hand.tourNo = info[key]
if key == 'BUYIN': if key == 'BUYIN':
if info[key] == 'Freeroll': if hand.tourNo!=None:
hand.buyin = '$0+$0' if info[key] == 'Freeroll':
else: hand.buyin = 0
#FIXME: The key looks like: '€0.82+€0.18 EUR' hand.fee = 0
# This should be parsed properly and used hand.buyinCurrency = "FREE"
hand.buyin = info[key] else:
if info[key].find("$")!=-1:
hand.buyinCurrency="USD"
elif info[key].find(u"")!=-1:
hand.buyinCurrency="EUR"
else:
hand.buyinCurrency="NA" #FIXME: handle other currencies, FPP, play money
info[key]=info[key][:-4]
middle=info[key].find("+")
hand.buyin = int(100*Decimal(info[key][1:middle]))
hand.fee = int(100*Decimal(info[key][middle+2:]))
if key == 'LEVEL': if key == 'LEVEL':
hand.level = info[key] hand.level = info[key]

View File

@ -1,7 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Returns a dict of SQL statements used in fpdb. """Returns a dict of SQL statements used in fpdb.
""" """
# Copyright 2008-2009, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -114,18 +115,18 @@ class Sql:
self.query['createSitesTable'] = """CREATE TABLE Sites ( self.query['createSitesTable'] = """CREATE TABLE Sites (
id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
name varchar(32) NOT NULL, name varchar(32) NOT NULL,
currency char(3) NOT NULL) code char(2) NOT NULL)
ENGINE=INNODB""" ENGINE=INNODB"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['createSitesTable'] = """CREATE TABLE Sites ( self.query['createSitesTable'] = """CREATE TABLE Sites (
id SERIAL, PRIMARY KEY (id), id SERIAL, PRIMARY KEY (id),
name varchar(32), name varchar(32),
currency char(3))""" code char(2))"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['createSitesTable'] = """CREATE TABLE Sites ( self.query['createSitesTable'] = """CREATE TABLE Sites (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
name TEXT NOT NULL, name TEXT NOT NULL,
currency TEXT NOT NULL)""" code TEXT NOT NULL)"""
################################ ################################
@ -136,6 +137,7 @@ class Sql:
self.query['createGametypesTable'] = """CREATE TABLE Gametypes ( self.query['createGametypesTable'] = """CREATE TABLE Gametypes (
id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
currency varchar(4) NOT NULL,
type char(4) NOT NULL, type char(4) NOT NULL,
base char(4) NOT NULL, base char(4) NOT NULL,
category varchar(9) NOT NULL, category varchar(9) NOT NULL,
@ -150,6 +152,7 @@ class Sql:
self.query['createGametypesTable'] = """CREATE TABLE Gametypes ( self.query['createGametypesTable'] = """CREATE TABLE Gametypes (
id SERIAL, PRIMARY KEY (id), id SERIAL, PRIMARY KEY (id),
siteId INTEGER, FOREIGN KEY (siteId) REFERENCES Sites(id), siteId INTEGER, FOREIGN KEY (siteId) REFERENCES Sites(id),
currency varchar(4),
type char(4), type char(4),
base char(4), base char(4),
category varchar(9), category varchar(9),
@ -163,6 +166,7 @@ class Sql:
self.query['createGametypesTable'] = """CREATE TABLE GameTypes ( self.query['createGametypesTable'] = """CREATE TABLE GameTypes (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
siteId INTEGER, siteId INTEGER,
currency TEXT,
type TEXT, type TEXT,
base TEXT, base TEXT,
category TEXT, category TEXT,
@ -253,6 +257,7 @@ class Sql:
importTime DATETIME NOT NULL, importTime DATETIME NOT NULL,
seats TINYINT NOT NULL, seats TINYINT NOT NULL,
maxSeats TINYINT NOT NULL, maxSeats TINYINT NOT NULL,
rush BOOLEAN NOT NULL DEFAULT True,
boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */ boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
boardcard2 smallint, boardcard2 smallint,
boardcard3 smallint, boardcard3 smallint,
@ -289,6 +294,7 @@ class Sql:
importTime timestamp without time zone NOT NULL, importTime timestamp without time zone NOT NULL,
seats SMALLINT NOT NULL, seats SMALLINT NOT NULL,
maxSeats SMALLINT NOT NULL, maxSeats SMALLINT NOT NULL,
rush BOOLEAN NOT NULL DEFAULT True,
boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */ boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
boardcard2 smallint, boardcard2 smallint,
boardcard3 smallint, boardcard3 smallint,
@ -324,6 +330,7 @@ class Sql:
importTime REAL NOT NULL, importTime REAL NOT NULL,
seats INT NOT NULL, seats INT NOT NULL,
maxSeats INT NOT NULL, maxSeats INT NOT NULL,
rush BOOLEAN NOT NULL DEFAULT 1,
boardcard1 INT, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */ boardcard1 INT, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
boardcard2 INT, boardcard2 INT,
boardcard3 INT, boardcard3 INT,
@ -356,50 +363,77 @@ class Sql:
if db_server == 'mysql': if db_server == 'mysql':
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
buyin INT NOT NULL, currency varchar(4) NOT NULL,
fee INT NOT NULL, buyIn INT NOT NULL,
maxSeats INT NOT NULL DEFAULT -1, fee INT NOT NULL,
knockout BOOLEAN NOT NULL DEFAULT False, buyInChips INT,
rebuyOrAddon BOOLEAN NOT NULL DEFAULT False, maxSeats INT,
speed varchar(10), rebuy BOOLEAN,
headsUp BOOLEAN NOT NULL DEFAULT False, rebuyCost INT,
shootout BOOLEAN NOT NULL DEFAULT False, rebuyChips INT,
matrix BOOLEAN NOT NULL DEFAULT False, addOn BOOLEAN,
sng BOOLEAN NOT NULL DEFAULT False addOnCost INT,
) addOnChips INT,
knockout BOOLEAN,
koBounty INT,
speed varchar(10),
shootout BOOLEAN,
matrix BOOLEAN,
sng BOOLEAN,
satellite BOOLEAN,
doubleOrNothing BOOLEAN,
guarantee INT)
ENGINE=INNODB""" ENGINE=INNODB"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
id SERIAL, PRIMARY KEY (id), id SERIAL, PRIMARY KEY (id),
siteId INT NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), siteId INT NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
currency varchar(4) NOT NULL,
buyin INT NOT NULL, buyin INT NOT NULL,
fee INT NOT NULL, fee INT NOT NULL,
maxSeats INT NOT NULL DEFAULT -1, buyInChips INT,
knockout BOOLEAN NOT NULL DEFAULT False, maxSeats INT,
rebuyOrAddon BOOLEAN NOT NULL DEFAULT False, rebuy BOOLEAN,
rebuyCost INT,
rebuyChips INT,
addOn BOOLEAN,
addOnCost INT,
addOnChips INT,
knockout BOOLEAN,
koBounty INT,
speed varchar(10), speed varchar(10),
headsUp BOOLEAN NOT NULL DEFAULT False, shootout BOOLEAN,
shootout BOOLEAN NOT NULL DEFAULT False, matrix BOOLEAN,
matrix BOOLEAN NOT NULL DEFAULT False, sng BOOLEAN,
sng BOOLEAN NOT NULL DEFAULT False satellite BOOLEAN,
)""" doubleOrNothing BOOLEAN,
guarantee INT)"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
siteId INT NOT NULL, siteId INT NOT NULL,
currency VARCHAR(4) NOT NULL,
buyin INT NOT NULL, buyin INT NOT NULL,
fee INT NOT NULL, fee INT NOT NULL,
maxSeats INT NOT NULL DEFAULT -1, buyInChips INT,
knockout BOOLEAN NOT NULL DEFAULT 0, maxSeats INT,
rebuyOrAddon BOOLEAN NOT NULL DEFAULT 0, rebuy BOOLEAN,
rebuyCost INT,
rebuyChips INT,
addOn BOOLEAN,
addOnCost INT,
addOnChips INT,
knockout BOOLEAN,
koBounty INT,
speed TEXT, speed TEXT,
headsUp BOOLEAN NOT NULL DEFAULT 0, shootout BOOLEAN,
shootout BOOLEAN NOT NULL DEFAULT 0, matrix BOOLEAN,
matrix BOOLEAN NOT NULL DEFAULT 0, sng BOOLEAN,
sng BOOLEAN NOT NULL DEFAULT 0 satellite BOOLEAN,
)""" doubleOrNothing BOOLEAN,
guarantee INT)"""
################################ ################################
# Create Tourneys # Create Tourneys
@ -408,65 +442,47 @@ class Sql:
if db_server == 'mysql': if db_server == 'mysql':
self.query['createTourneysTable'] = """CREATE TABLE Tourneys ( self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
id INT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), id INT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
tourneyTypeId SMALLINT UNSIGNED NOT NULL DEFAULT 1, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id), tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
siteTourneyNo BIGINT NOT NULL, siteTourneyNo BIGINT NOT NULL,
entries INT NOT NULL, entries INT,
prizepool INT NOT NULL, prizepool INT,
startTime DATETIME NOT NULL, startTime DATETIME NOT NULL,
endTime DATETIME, endTime DATETIME,
buyinChips INT,
tourneyName varchar(40), tourneyName varchar(40),
matrixIdProcessed TINYINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ matrixIdProcessed TINYINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
rebuyChips INT DEFAULT 0, totalRebuyCount INT,
addonChips INT DEFAULT 0, totalAddOnCount INT,
rebuyAmount INT DEFAULT 0,
addonAmount INT DEFAULT 0,
totalRebuys INT DEFAULT 0,
totalAddons INT DEFAULT 0,
koBounty INT DEFAULT 0,
comment TEXT, comment TEXT,
commentTs DATETIME) commentTs DATETIME)
ENGINE=INNODB""" ENGINE=INNODB"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['createTourneysTable'] = """CREATE TABLE Tourneys ( self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
id SERIAL, PRIMARY KEY (id), id SERIAL, PRIMARY KEY (id),
tourneyTypeId INT DEFAULT 1, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id), tourneyTypeId INT, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
siteTourneyNo BIGINT, siteTourneyNo BIGINT,
entries INT, entries INT,
prizepool INT, prizepool INT,
startTime timestamp without time zone, startTime timestamp without time zone,
endTime timestamp without time zone, endTime timestamp without time zone,
buyinChips INT,
tourneyName varchar(40), tourneyName varchar(40),
matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
rebuyChips INT DEFAULT 0, totalRebuyCount INT,
addonChips INT DEFAULT 0, totalAddOnCount INT,
rebuyAmount INT DEFAULT 0,
addonAmount INT DEFAULT 0,
totalRebuys INT DEFAULT 0,
totalAddons INT DEFAULT 0,
koBounty INT DEFAULT 0,
comment TEXT, comment TEXT,
commentTs timestamp without time zone)""" commentTs timestamp without time zone)"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['createTourneysTable'] = """CREATE TABLE Tourneys ( self.query['createTourneysTable'] = """CREATE TABLE Tourneys (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
tourneyTypeId INT DEFAULT 1, tourneyTypeId INT,
siteTourneyNo INT, siteTourneyNo INT,
entries INT, entries INT,
prizepool INT, prizepool INT,
startTime REAL, startTime REAL,
endTime REAL, endTime REAL,
buyinChips INT,
tourneyName TEXT, tourneyName TEXT,
matrixIdProcessed INT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ matrixIdProcessed INT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */
rebuyChips INT DEFAULT 0, totalRebuyCount INT,
addonChips INT DEFAULT 0, totalAddOnCount INT,
rebuyAmount INT DEFAULT 0,
addonAmount INT DEFAULT 0,
totalRebuys INT DEFAULT 0,
totalAddons INT DEFAULT 0,
koBounty INT DEFAULT 0,
comment TEXT, comment TEXT,
commentTs REAL)""" commentTs REAL)"""
################################ ################################
@ -481,6 +497,7 @@ class Sql:
startCash INT NOT NULL, startCash INT NOT NULL,
position CHAR(1), position CHAR(1),
seatNo SMALLINT NOT NULL, seatNo SMALLINT NOT NULL,
sitout BOOLEAN NOT NULL,
card1 smallint NOT NULL, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */ card1 smallint NOT NULL, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
card2 smallint NOT NULL, card2 smallint NOT NULL,
@ -597,6 +614,7 @@ class Sql:
startCash INT NOT NULL, startCash INT NOT NULL,
position CHAR(1), position CHAR(1),
seatNo SMALLINT NOT NULL, seatNo SMALLINT NOT NULL,
sitout BOOLEAN NOT NULL,
card1 smallint NOT NULL, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */ card1 smallint NOT NULL, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
card2 smallint NOT NULL, card2 smallint NOT NULL,
@ -613,7 +631,7 @@ class Sql:
totalProfit INT, totalProfit INT,
comment text, comment text,
commentTs timestamp without time zone, commentTs timestamp without time zone,
tourneysPlayersId BIGINT, tourneysPlayersId BIGINT, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id),
tourneyTypeId INT NOT NULL DEFAULT 1, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id), tourneyTypeId INT NOT NULL DEFAULT 1, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
wonWhenSeenStreet1 FLOAT, wonWhenSeenStreet1 FLOAT,
@ -703,9 +721,7 @@ class Sql:
street3Raises SMALLINT, street3Raises SMALLINT,
street4Raises SMALLINT, street4Raises SMALLINT,
actionString VARCHAR(15), actionString VARCHAR(15))"""
FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['createHandsPlayersTable'] = """CREATE TABLE HandsPlayers ( self.query['createHandsPlayersTable'] = """CREATE TABLE HandsPlayers (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
@ -714,6 +730,7 @@ class Sql:
startCash INT NOT NULL, startCash INT NOT NULL,
position TEXT, position TEXT,
seatNo INT NOT NULL, seatNo INT NOT NULL,
sitout BOOLEAN NOT NULL,
card1 INT NOT NULL, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */ card1 INT NOT NULL, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
card2 INT NOT NULL, card2 INT NOT NULL,
@ -819,7 +836,7 @@ class Sql:
street2Raises INT, street2Raises INT,
street3Raises INT, street3Raises INT,
street4Raises INT, street4Raises INT,
actionString REAL) actionString VARCHAR(15))
""" """
@ -832,12 +849,12 @@ class Sql:
id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
tourneyId INT UNSIGNED NOT NULL, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id), tourneyId INT UNSIGNED NOT NULL, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id), playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
payinAmount INT NOT NULL, rank INT,
rank INT NOT NULL, winnings INT,
winnings INT NOT NULL, winningsCurrency VARCHAR(4),
nbRebuys INT DEFAULT 0, rebuyCount INT,
nbAddons INT DEFAULT 0, addOnCount INT,
nbKO INT DEFAULT 0, koCount INT,
comment TEXT, comment TEXT,
commentTs DATETIME) commentTs DATETIME)
ENGINE=INNODB""" ENGINE=INNODB"""
@ -846,12 +863,12 @@ class Sql:
id BIGSERIAL, PRIMARY KEY (id), id BIGSERIAL, PRIMARY KEY (id),
tourneyId INT, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id), tourneyId INT, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
playerId INT, FOREIGN KEY (playerId) REFERENCES Players(id), playerId INT, FOREIGN KEY (playerId) REFERENCES Players(id),
payinAmount INT,
rank INT, rank INT,
winnings INT, winnings INT,
nbRebuys INT DEFAULT 0, winningsCurrency VARCHAR(4),
nbAddons INT DEFAULT 0, rebuyCount INT,
nbKO INT DEFAULT 0, addOnCount INT,
koCount INT,
comment TEXT, comment TEXT,
commentTs timestamp without time zone)""" commentTs timestamp without time zone)"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
@ -859,12 +876,12 @@ class Sql:
id INT PRIMARY KEY, id INT PRIMARY KEY,
tourneyId INT, tourneyId INT,
playerId INT, playerId INT,
payinAmount INT,
rank INT, rank INT,
winnings INT, winnings INT,
nbRebuys INT DEFAULT 0, winningsCurrency VARCHAR(4),
nbAddons INT DEFAULT 0, rebuyCount INT,
nbKO INT DEFAULT 0, addOnCount INT,
koCount INT,
comment TEXT, comment TEXT,
commentTs timestamp without time zone, commentTs timestamp without time zone,
FOREIGN KEY (tourneyId) REFERENCES Tourneys(id), FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
@ -1248,14 +1265,14 @@ class Sql:
self.query['addTPlayersIndex'] = """CREATE UNIQUE INDEX tourneyId ON TourneysPlayers (tourneyId, playerId)""" self.query['addTPlayersIndex'] = """CREATE UNIQUE INDEX tourneyId ON TourneysPlayers (tourneyId, playerId)"""
if db_server == 'mysql': if db_server == 'mysql':
self.query['addTTypesIndex'] = """ALTER TABLE TourneyTypes ADD UNIQUE INDEX tourneytypes_all(buyin, fee self.query['addTTypesIndex'] = """ALTER TABLE TourneyTypes ADD UNIQUE INDEX tourneytypes_all(siteId, buyin, fee
, maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" , maxSeats, knockout, rebuy, addOn, speed, shootout, matrix, sng)"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (buyin, fee self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (siteId, buyin, fee
, maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" , maxSeats, knockout, rebuy, addOn, speed, shootout, matrix, sng)"""
elif db_server == 'sqlite': elif db_server == 'sqlite':
self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (buyin, fee self.query['addTTypesIndex'] = """CREATE UNIQUE INDEX tourneyTypes_all ON TourneyTypes (siteId, buyin, fee
, maxSeats, knockout, rebuyOrAddon, speed, headsUp, shootout, matrix, sng)""" , maxSeats, knockout, rebuy, addOn, speed, shootout, matrix, sng)"""
self.query['get_last_hand'] = "select max(id) from Hands" self.query['get_last_hand'] = "select max(id) from Hands"
@ -3559,9 +3576,9 @@ class Sql:
""" """
self.query['insertGameTypes'] = """INSERT INTO Gametypes self.query['insertGameTypes'] = """INSERT INTO Gametypes
(siteId, type, base, category, limitType (siteId, currency, type, base, category, limitType
,hiLo, smallBlind, bigBlind, smallBet, bigBet) ,hiLo, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""" VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
self.query['isAlreadyInDB'] = """SELECT id FROM Hands self.query['isAlreadyInDB'] = """SELECT id FROM Hands
WHERE gametypeId=%s AND siteHandNo=%s WHERE gametypeId=%s AND siteHandNo=%s
@ -3572,9 +3589,9 @@ class Sql:
tt.fee, tt.fee,
tt.maxSeats, tt.maxSeats,
tt.knockout, tt.knockout,
tt.rebuyOrAddon, tt.rebuy,
tt.addOn,
tt.speed, tt.speed,
tt.headsUp,
tt.shootout, tt.shootout,
tt.matrix tt.matrix
FROM TourneyTypes tt FROM TourneyTypes tt
@ -3585,51 +3602,34 @@ class Sql:
self.query['getTourneyTypeId'] = """SELECT id self.query['getTourneyTypeId'] = """SELECT id
FROM TourneyTypes FROM TourneyTypes
WHERE siteId=%s WHERE siteId=%s
AND currency=%s
AND buyin=%s AND buyin=%s
AND fee=%s AND fee=%s
AND knockout=%s AND knockout=%s
AND rebuyOrAddon=%s AND rebuy=%s
AND addOn=%s
AND speed=%s AND speed=%s
AND headsUp=%s
AND shootout=%s AND shootout=%s
AND matrix=%s AND matrix=%s
""" """
self.query['insertTourneyTypes'] = """INSERT INTO TourneyTypes self.query['insertTourneyType'] = """INSERT INTO TourneyTypes
(siteId, buyin, fee, knockout, rebuyOrAddon (siteId, currency, buyin, fee, buyInChips, knockout, rebuy,
,speed, headsUp, shootout, matrix) addOn ,speed, shootout, matrix)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
""" """
self.query['getTourney'] = """SELECT t.id, self.query['getTourneyIdByTourneyNo'] = """SELECT t.id
t.tourneyTypeId, FROM Tourneys t
t.entries, INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id)
t.prizepool, WHERE tt.siteId=%s AND t.siteTourneyNo=%s
t.startTime,
t.endTime,
t.buyinChips,
t.tourneyName,
t.matrixIdProcessed,
t.rebuyChips,
t.addonChips,
t.rebuyAmount,
t.addonAmount,
t.totalRebuys,
t.totalAddons,
t.koBounty,
t.comment
FROM Tourneys t
INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id)
WHERE t.siteTourneyNo=%s AND tt.siteId=%s
""" """
self.query['insertTourney'] = """INSERT INTO Tourneys self.query['insertTourney'] = """INSERT INTO Tourneys
(tourneyTypeId, siteTourneyNo, entries, prizepool, (tourneyTypeId, siteTourneyNo, entries, prizepool,
startTime, endTime, buyinChips, tourneyName, matrixIdProcessed, startTime, endTime, tourneyName, matrixIdProcessed,
rebuyChips, addonChips, rebuyAmount, addonAmount, totalRebuys, totalRebuyCount, totalAddOnCount)
totalAddons, koBounty, comment, commentTs) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s)
""" """
self.query['updateTourney'] = """UPDATE Tourneys self.query['updateTourney'] = """UPDATE Tourneys
@ -3638,48 +3638,34 @@ class Sql:
prizepool = %s, prizepool = %s,
startTime = %s, startTime = %s,
endTime = %s, endTime = %s,
buyinChips = %s,
tourneyName = %s, tourneyName = %s,
matrixIdProcessed = %s, matrixIdProcessed = %s,
rebuyChips = %s, totalRebuyCount = %s,
addonChips = %s, totalAddOnCount = %s,
rebuyAmount = %s,
addonAmount = %s,
totalRebuys = %s,
totalAddons = %s,
koBounty = %s,
comment = %s, comment = %s,
commentTs = %s commentTs = %s
WHERE id=%s WHERE id=%s
""" """
self.query['getTourneysPlayers'] = """SELECT id, self.query['getTourneysPlayersId'] = """SELECT id
payinAmount,
rank,
winnings,
nbRebuys,
nbAddons,
nbKO,
comment,
commentTs
FROM TourneysPlayers FROM TourneysPlayers
WHERE tourneyId=%s AND playerId+0=%s WHERE tourneyId=%s AND playerId+0=%s
""" """
self.query['updateTourneysPlayers'] = """UPDATE TourneysPlayers self.query['updateTourneysPlayers'] = """UPDATE TourneysPlayers
SET payinAmount = %s, SET rank = %s,
rank = %s,
winnings = %s, winnings = %s,
nbRebuys = %s, winningsCurrency = %s,
nbAddons = %s, rebuyCount = %s,
nbKO = %s, addOnCount = %s,
koCount = %s,
comment = %s, comment = %s,
commentTs = %s commentTs = %s
WHERE id=%s WHERE id=%s
""" """
self.query['insertTourneysPlayers'] = """INSERT INTO TourneysPlayers self.query['insertTourneysPlayer'] = """INSERT INTO TourneysPlayers
(tourneyId, playerId, payinAmount, rank, winnings, nbRebuys, nbAddons, nbKO, comment, commentTs) (tourneyId, playerId, rank, winnings, winningsCurrency, rebuyCount, addOnCount, koCount, comment, commentTs)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
""" """
@ -3745,6 +3731,7 @@ class Sql:
playerId, playerId,
startCash, startCash,
seatNo, seatNo,
sitout,
card1, card1,
card2, card2,
card3, card3,
@ -3844,7 +3831,8 @@ class Sql:
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s, %s %s, %s, %s, %s, %s,
%s
)""" )"""
if db_server == 'mysql': if db_server == 'mysql':

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""Manage collecting and formatting of stats and tooltips. """Manage collecting and formatting of stats and tooltips.
""" """
# Copyright 2008, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify

66
pyfpdb/Summaries.py Normal file
View File

@ -0,0 +1,66 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008-2010 Steffen Schaumburg
#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.
"""This file is to fetch summaries through IMAP and pass them on to the appropriate parser"""
#see http://docs.python.org/library/imaplib.html for the python interface
#see http://tools.ietf.org/html/rfc2060#section-6.4.4 for IMAP4 search criteria
import sys
from imaplib import IMAP4_SSL
from Summaries import Summaries
from PokerStarsSummaries import PokerStarsSummaries
#TODO: move all these into the config file. until then usage is: ./ImapSummaries.py YourImapHost YourImapUser YourImapPw
configHost=sys.argv[1]
configUser=sys.argv[2]
configPw=sys.argv[3]
server = IMAP4_SSL(configHost) #TODO: optionally non-SSL
response = server.login(configUser, configPw) #TODO catch authentication error
#print "response to logging in:",response
#print "server.list():",server.list() #prints list of folders
response = server.select("INBOX")
#print "response to selecting INBOX:",response
if response[0]!="OK":
raise error #TODO: show error message
neededMessages=[]
response, searchData = server.search(None, "SUBJECT", "PokerStars Tournament History Request")
for messageNumber in searchData[0].split(" "):
response, headerData = server.fetch(messageNumber, "(BODY[HEADER.FIELDS (SUBJECT)])")
#print "response to fetch subject:",response
if response!="OK":
raise error #TODO: show error message
if headerData[1].find("Subject: PokerStars Tournament History Request - Last x")!=1:
neededMessages.append((messageNumber, "PS")
tourneys=[]
if len(neededMessages)==0:
raise error #TODO: show error message
for messageData in neededMessages:
response, bodyData = server.fetch(messageData[0], "(UID BODY[TEXT])")
if response!="OK":
raise error #TODO: show error message
if messageData[0]=="PS":
tourneys.append(PokerStarsSummaries.PokerStarsSummaries(bodyData)
for tourney in tourneys:
print "tourney:",tourney
server.close()
server.logout()

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (c) 2009 Eric Blade, and the FPDB team. # Copyright (c) 2009-2010 Eric Blade, and the FPDB team.
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
@ -13,8 +14,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import urllib, htmllib, formatter import urllib, htmllib, formatter
@ -51,7 +51,7 @@ class SummaryParser(htmllib.HTMLParser): # derive new HTML parser
self.nextPool = False self.nextPool = False
self.TourneyPool = None self.TourneyPool = None
self.nextPlayers = False self.nextPlayers = False
self.TourneyPlayers = None self.TourneysPlayers = None
self.nextAllowRebuys = False self.nextAllowRebuys = False
self.TourneyRebuys = None self.TourneyRebuys = None
self.parseResultsA = False self.parseResultsA = False
@ -134,7 +134,7 @@ class SummaryParser(htmllib.HTMLParser): # derive new HTML parser
if not self.nextPlayers and x == "Player Count:": if not self.nextPlayers and x == "Player Count:":
self.nextPlayers = True self.nextPlayers = True
elif self.nextPlayers: elif self.nextPlayers:
self.TourneyPlayers = x self.TourneysPlayers = x
self.nextPlayers = False self.nextPlayers = False
if not self.nextAllowRebuys and x == "Rebuys possible?:": if not self.nextAllowRebuys and x == "Rebuys possible?:":
@ -179,10 +179,10 @@ class EverleafSummary:
print "site=",self.parser.SiteName, "tourneyname=", self.parser.TourneyName, "tourneyid=", self.parser.TourneyId print "site=",self.parser.SiteName, "tourneyname=", self.parser.TourneyName, "tourneyid=", self.parser.TourneyId
print "start time=",self.parser.TourneyStartTime, "end time=",self.parser.TourneyEndTime print "start time=",self.parser.TourneyStartTime, "end time=",self.parser.TourneyEndTime
print "structure=", self.parser.TourneyStructure, "game type=",self.parser.TourneyGameType print "structure=", self.parser.TourneyStructure, "game type=",self.parser.TourneyGameType
print "buy-in=", self.parser.TourneyBuyIn, "rebuys=", self.parser.TourneyRebuys, "total players=", self.parser.TourneyPlayers, "pool=", self.parser.TourneyPool print "buy-in=", self.parser.TourneyBuyIn, "rebuys=", self.parser.TourneyRebuys, "total players=", self.parser.TourneysPlayers, "pool=", self.parser.TourneyPool
print "results=", self.parser.Results print "results=", self.parser.Results
if __name__ == "__main__": if __name__ == "__main__":
me = EverleafSummary() me = EverleafSummary()
me.main() me.main()

View File

@ -1,11 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Discover_TableWindow.py """Discover_TableWindow.py
Inspects the currently open windows and finds those of interest to us--that is Inspects the currently open windows and finds those of interest to us--that is
poker table windows from supported sites. Returns a list poker table windows from supported sites. Returns a list
of Table_Window objects representing the windows found. of Table_Window objects representing the windows found.
""" """
# Copyright 2008 - 2009, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,11 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Discover_Tables.py """Discover_Tables.py
Inspects the currently open windows and finds those of interest to us--that is Inspects the currently open windows and finds those of interest to us--that is
poker table windows from supported sites. Returns a list poker table windows from supported sites. Returns a list
of Table_Window objects representing the windows found. of Table_Window objects representing the windows found.
""" """
# Copyright 2008, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Tables_Demo.py """Tables_Demo.py
Main program module to test/demo the Tables subclasses. Main program module to test/demo the Tables subclasses.
""" """
# Copyright 2008 - 2009, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""TourneyTracker.py """TourneyTracker.py
Based on HUD_main .. who knows if we want to actually use this or not Based on HUD_main .. who knows if we want to actually use this or not
""" """
# Copyright 2008, 2009, Eric Blade # Copyright 2008-2010, Eric Blade
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -86,7 +87,7 @@ class Tournament:
self.buyin = summary.parser.TourneyBuyIn # need to remember to parse the Fee out of this and move it to self.fee self.buyin = summary.parser.TourneyBuyIn # need to remember to parse the Fee out of this and move it to self.fee
self.rebuys = (summary.parser.TourneyRebuys == "yes") self.rebuys = (summary.parser.TourneyRebuys == "yes")
self.prizepool = summary.parser.TourneyPool self.prizepool = summary.parser.TourneyPool
self.numplayers = summary.parser.TourneyPlayers self.numplayers = summary.parser.TourneysPlayers
self.openwindow() # let's start by getting any info we need.. meh self.openwindow() # let's start by getting any info we need.. meh

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2009 Stephane Alessio #Copyright 2009-2010 Stephane Alessio
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,9 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
"""parses and stores summary sections from e.g. eMail or summary files"""
# TODO: check to keep only the needed modules # TODO: check to keep only the needed modules
@ -34,7 +36,7 @@ import Card
log = logging.getLogger("parser") log = logging.getLogger("parser")
class Tourney(object): class TourneySummary(object):
################################################################ ################################################################
# Class Variables # Class Variables
@ -49,23 +51,27 @@ class Tourney(object):
self.sitename = sitename self.sitename = sitename
self.siteId = self.SITEIDS[sitename] self.siteId = self.SITEIDS[sitename]
self.gametype = gametype self.gametype = gametype
self.starttime = None
self.endtime = None
self.summaryText = summaryText self.summaryText = summaryText
self.tourneyName = None self.tourneyName = None
self.tourneyTypeId = None
self.tourneyId = None
self.startTime = None
self.endTime = None
self.tourNo = None self.tourNo = None
self.currency = None
self.buyin = None self.buyin = None
self.fee = None # the Database code is looking for this one .. ? self.fee = None
self.hero = None self.hero = None
self.maxseats = None self.maxseats = None
self.entries = 0 self.entries = 0
self.speed = "Normal" self.speed = "Normal"
self.prizepool = None # Make it a dict in order to deal (eventually later) with non-money winnings : {'MONEY' : amount, 'OTHER' : Value ??} self.prizepool = 0 # Make it a dict in order to deal (eventually later) with non-money winnings : {'MONEY' : amount, 'OTHER' : Value ??}
self.buyInChips = None self.buyInChips = 0
self.mixed = None self.mixed = None
self.isRebuy = False self.isRebuy = False
self.isAddOn = False
self.isKO = False self.isKO = False
self.isHU = False
self.isMatrix = False self.isMatrix = False
self.isShootout = False self.isShootout = False
self.matrixMatchId = None # For Matrix tourneys : 1-4 => match tables (traditionnal), 0 => Positional winnings info self.matrixMatchId = None # For Matrix tourneys : 1-4 => match tables (traditionnal), 0 => Positional winnings info
@ -73,33 +79,44 @@ class Tourney(object):
self.subTourneyFee = None self.subTourneyFee = None
self.rebuyChips = 0 self.rebuyChips = 0
self.addOnChips = 0 self.addOnChips = 0
self.rebuyAmount = 0 self.rebuyCost = 0
self.addOnAmount = 0 self.addOnCost = 0
self.totalRebuys = 0 self.totalRebuyCount = 0
self.totalAddOns = 0 self.totalAddOnCount = 0
self.koBounty = 0 self.koBounty = 0
self.tourneyComment = None self.tourneyComment = None
self.players = [] self.players = []
self.isSng = False
self.isSatellite = False
self.isDoubleOrNothing = False
self.guarantee = 0
# Collections indexed by player names # Collections indexed by player names
self.finishPositions = {} self.ranks = {}
self.winnings = {} self.winnings = {}
self.payinAmounts = {} self.winningsCurrency = {}
self.countRebuys = {} self.rebuyCounts = {}
self.countAddOns = {} self.addOnCounts = {}
self.countKO = {} self.koCounts = {}
# currency symbol for this summary # currency symbol for this summary
self.sym = None self.sym = None
#self.sym = self.SYMBOL[self.gametype['currency']] # save typing! delete this attr when done #self.sym = self.SYMBOL[self.gametype['currency']] # save typing! delete this attr when done
if builtFrom=="IMAP":
self.parseSummary()
#TODO: self.insert()
#end def __init__
def __str__(self): def __str__(self):
#TODO : Update #TODO : Update
vars = ( ("SITE", self.sitename), vars = ( ("SITE", self.sitename),
("START TIME", self.starttime), ("START TIME", self.startTime),
("END TIME", self.endtime), ("END TIME", self.endTime),
("TOURNEY NAME", self.tourneyName), ("TOURNEY NAME", self.tourneyName),
("TOURNEY NO", self.tourNo), ("TOURNEY NO", self.tourNo),
("TOURNEY TYPE ID", self.tourneyTypeId),
("TOURNEY ID", self.tourneyId),
("BUYIN", self.buyin), ("BUYIN", self.buyin),
("FEE", self.fee), ("FEE", self.fee),
("HERO", self.hero), ("HERO", self.hero),
@ -109,9 +126,9 @@ class Tourney(object):
("PRIZE POOL", self.prizepool), ("PRIZE POOL", self.prizepool),
("STARTING CHIP COUNT", self.buyInChips), ("STARTING CHIP COUNT", self.buyInChips),
("MIXED", self.mixed), ("MIXED", self.mixed),
("REBUY ADDON", self.isRebuy), ("REBUY", self.isRebuy),
("ADDON", self.isAddOn),
("KO", self.isKO), ("KO", self.isKO),
("HU", self.isHU),
("MATRIX", self.isMatrix), ("MATRIX", self.isMatrix),
("SHOOTOUT", self.isShootout), ("SHOOTOUT", self.isShootout),
("MATRIX MATCH ID", self.matrixMatchId), ("MATRIX MATCH ID", self.matrixMatchId),
@ -119,22 +136,25 @@ class Tourney(object):
("SUB TOURNEY FEE", self.subTourneyFee), ("SUB TOURNEY FEE", self.subTourneyFee),
("REBUY CHIPS", self.rebuyChips), ("REBUY CHIPS", self.rebuyChips),
("ADDON CHIPS", self.addOnChips), ("ADDON CHIPS", self.addOnChips),
("REBUY AMOUNT", self.rebuyAmount), ("REBUY COST", self.rebuyCost),
("ADDON AMOUNT", self.addOnAmount), ("ADDON COST", self.addOnCost),
("TOTAL REBUYS", self.totalRebuys), ("TOTAL REBUYS", self.totalRebuyCount),
("TOTAL ADDONS", self.totalAddOns), ("TOTAL ADDONS", self.totalAddOnCount),
("KO BOUNTY", self.koBounty), ("KO BOUNTY", self.koBounty),
("TOURNEY COMMENT", self.tourneyComment) ("TOURNEY COMMENT", self.tourneyComment),
("SNG", self.isSng),
("SATELLITE", self.isSatellite),
("DOUBLE OR NOTHING", self.isDoubleOrNothing),
("GUARANTEE", self.guarantee)
) )
structs = ( ("GAMETYPE", self.gametype), structs = ( ("GAMETYPE", self.gametype),
("PLAYERS", self.players), ("PLAYERS", self.players),
("PAYIN AMOUNTS", self.payinAmounts), ("RANKS", self.ranks),
("POSITIONS", self.finishPositions),
("WINNINGS", self.winnings), ("WINNINGS", self.winnings),
("COUNT REBUYS", self.countRebuys), ("COUNT REBUYS", self.rebuyCounts),
("COUNT ADDONS", self.countAddOns), ("COUNT ADDONS", self.addOnCounts),
("NB OF KO", self.countKO) ("NB OF KO", self.koCounts)
) )
str = '' str = ''
for (name, var) in vars: for (name, var) in vars:
@ -143,14 +163,17 @@ class Tourney(object):
for (name, struct) in structs: for (name, struct) in structs:
str = str + "\n%s =\n" % name + pprint.pformat(struct, 4) str = str + "\n%s =\n" % name + pprint.pformat(struct, 4)
return str return str
#end def __str__
def parseSummary(self): abstract
"""should fill the class variables with the parsed information"""
def getSummaryText(self): def getSummaryText(self):
return self.summaryText return self.summaryText
def prepInsert(self, db):
pass
def insert(self, db): def insert(self, db):
# Note that this method is not used by the PS tourney storage stuff - this is for summary files only
# First : check all needed info is filled in the object, especially for the initial select # First : check all needed info is filled in the object, especially for the initial select
# Notes on DB Insert # Notes on DB Insert
@ -161,18 +184,18 @@ class Tourney(object):
# Starttime may not match the one in the Summary file : HH = time of the first Hand / could be slighltly different from the one in the summary file # Starttime may not match the one in the Summary file : HH = time of the first Hand / could be slighltly different from the one in the summary file
# Note: If the TourneyNo could be a unique id .... this would really be a relief to deal with matrix matches ==> Ask on the IRC / Ask Fulltilt ?? # Note: If the TourneyNo could be a unique id .... this would really be a relief to deal with matrix matches ==> Ask on the IRC / Ask Fulltilt ??
dbTourneyTypeId = db.tRecogniseTourneyType(self) dbTourneyTypeId = db.getTourneyTypeId(self)
logging.debug("Tourney Type ID = %d" % dbTourneyTypeId) logging.debug("Tourney Type ID = %d" % dbTourneyTypeId)
dbTourneyId = db.tRecognizeTourney(self, dbTourneyTypeId) dbTourneyId = db.tRecognizeTourney(self, dbTourneyTypeId)
logging.debug("Tourney ID = %d" % dbTourneyId) logging.debug("Tourney ID = %d" % dbTourneyId)
dbTourneysPlayersIds = db.tStoreTourneyPlayers(self, dbTourneyId) dbTourneysPlayersIds = db.tStoreTourneysPlayers(self, dbTourneyId)
logging.debug("TourneysPlayersId = %s" % dbTourneysPlayersIds) logging.debug("TourneysPlayersId = %s" % dbTourneysPlayersIds)
db.tUpdateTourneysHandsPlayers(self, dbTourneysPlayersIds, dbTourneyTypeId) db.tUpdateTourneysHandsPlayers(self, dbTourneysPlayersIds, dbTourneyTypeId)
logging.debug("tUpdateTourneysHandsPlayers done") logging.debug("tUpdateTourneysHandsPlayers done")
logging.debug("Tourney Insert done") logging.debug("Tourney Insert done")
# TO DO : Return what has been done (tourney created, updated, nothing) # TO DO : Return what has been done (tourney created, updated, nothing)
# ?? stored = 1 if tourney is fully created / duplicates = 1, if everything was already here and correct / partial=1 if some things were already here (between tourney, tourneyPlayers and handsplayers) # ?? stored = 1 if tourney is fully created / duplicates = 1, if everything was already here and correct / partial=1 if some things were already here (between tourney, tourneysPlayers and handsPlayers)
# if so, prototypes may need changes to know what has been done or make some kind of dict in Tourney object that could be updated during the insert process to store that information # if so, prototypes may need changes to know what has been done or make some kind of dict in Tourney object that could be updated during the insert process to store that information
stored = 0 stored = 0
duplicates = 0 duplicates = 0
@ -181,83 +204,8 @@ class Tourney(object):
ttime = 0 ttime = 0
return (stored, duplicates, partial, errors, ttime) return (stored, duplicates, partial, errors, ttime)
def old_insert_from_Hand(self, db):
""" Function to insert Hand into database
Should not commit, and do minimal selects. Callers may want to cache commits
db: a connected Database object"""
# TODO:
# Players - base playerid and siteid tuple
sqlids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)
#Gametypes def addPlayer(self, rank, name, winnings, winningsCurrency, rebuyCount, addOnCount, koCount):
gtid = db.getGameTypeId(self.siteId, self.gametype)
# HudCache data to come from DerivedStats class
# HandsActions - all actions for all players for all streets - self.actions
# Hands - Summary information of hand indexed by handId - gameinfo
#This should be moved to prepInsert
hh = {}
hh['siteHandNo'] = self.handid
hh['handStart'] = self.starttime
hh['gameTypeId'] = gtid
# seats TINYINT NOT NULL,
hh['tableName'] = self.tablename
hh['maxSeats'] = self.maxseats
hh['seats'] = len(sqlids)
# Flop turn and river may all be empty - add (likely) too many elements and trim with range
boardcards = self.board['FLOP'] + self.board['TURN'] + self.board['RIVER'] + [u'0x', u'0x', u'0x', u'0x', u'0x']
cards = [Card.encodeCard(c) for c in boardcards[0:5]]
hh['boardcard1'] = cards[0]
hh['boardcard2'] = cards[1]
hh['boardcard3'] = cards[2]
hh['boardcard4'] = cards[3]
hh['boardcard5'] = cards[4]
# texture smallint,
# playersVpi SMALLINT NOT NULL, /* num of players vpi */
# Needs to be recorded
# playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4 */
# Needs to be recorded
# playersAtStreet2 SMALLINT NOT NULL,
# Needs to be recorded
# playersAtStreet3 SMALLINT NOT NULL,
# Needs to be recorded
# playersAtStreet4 SMALLINT NOT NULL,
# Needs to be recorded
# playersAtShowdown SMALLINT NOT NULL,
# Needs to be recorded
# street0Raises TINYINT NOT NULL, /* num small bets paid to see flop/street4, including blind */
# Needs to be recorded
# street1Raises TINYINT NOT NULL, /* num small bets paid to see turn/street5 */
# Needs to be recorded
# street2Raises TINYINT NOT NULL, /* num big bets paid to see river/street6 */
# Needs to be recorded
# street3Raises TINYINT NOT NULL, /* num big bets paid to see sd/street7 */
# Needs to be recorded
# street4Raises TINYINT NOT NULL, /* num big bets paid to see showdown */
# Needs to be recorded
#print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" % self.getStreetTotals()
#FIXME: Pot size still in decimal, needs to be converted to cents
(hh['street1Pot'], hh['street2Pot'], hh['street3Pot'], hh['street4Pot'], hh['showdownPot']) = self.getStreetTotals()
# comment TEXT,
# commentTs DATETIME
#print hh
handid = db.storeHand(hh)
# HandsPlayers - ? ... Do we fix winnings?
# Tourneys ?
# TourneysPlayers
pass
def select(self, tourneyId):
""" Function to create Tourney object from database """
def addPlayer(self, rank, name, winnings, payinAmount, nbRebuys, nbAddons, nbKO):
"""\ """\
Adds a player to the tourney, and initialises data structures indexed by player. Adds a player to the tourney, and initialises data structures indexed by player.
rank (int) indicating the finishing rank (can be -1 if unknown) rank (int) indicating the finishing rank (can be -1 if unknown)
@ -266,13 +214,16 @@ winnings (decimal) the money the player ended the tourney with (can be 0, or
""" """
log.debug("addPlayer: rank:%s - name : '%s' - Winnings (%s)" % (rank, name, winnings)) log.debug("addPlayer: rank:%s - name : '%s' - Winnings (%s)" % (rank, name, winnings))
self.players.append(name) self.players.append(name)
self.finishPositions.update( { name : Decimal(rank) } ) self.ranks.update( { name : Decimal(rank) } )
self.winnings.update( { name : Decimal(winnings) } ) self.winnings.update( { name : Decimal(winnings) } )
self.payinAmounts.update( {name : Decimal(payinAmount) } ) self.winningsCurrency.update( { name : winningsCurrency } )
self.countRebuys.update( {name: Decimal(nbRebuys) } ) if rebuyCount:
self.countAddOns.update( {name: Decimal(nbAddons) } ) self.rebuyCounts.update( {name: Decimal(rebuyCount) } )
self.countKO.update( {name : Decimal(nbKO) } ) if addOnCount:
self.addOnCounts.update( {name: Decimal(addOnCount) } )
if koCount:
self.koCounts.update( {name : Decimal(koCount) } )
#end def addPlayer
def incrementPlayerWinnings(self, name, additionnalWinnings): def incrementPlayerWinnings(self, name, additionnalWinnings):
log.debug("incrementPlayerWinnings: name : '%s' - Add Winnings (%s)" % (name, additionnalWinnings)) log.debug("incrementPlayerWinnings: name : '%s' - Add Winnings (%s)" % (name, additionnalWinnings))
@ -325,7 +276,7 @@ Map the tuple self.gametype onto the pokerstars string describing it
self.writeSummary(sys.stdout) self.writeSummary(sys.stdout)
def assemble(cnxn, tourneyId): def assemble(cnxn, tourneyId): #TODO: move this method to Hand or Database
# TODO !! # TODO !!
c = cnxn.cursor() c = cnxn.cursor()
@ -383,7 +334,7 @@ limit 1""", {'handid':handid})
SELECT SELECT
h.sitehandno as hid, h.sitehandno as hid,
h.tablename as table, h.tablename as table,
h.handstart as starttime h.handstart as startTime
FROM FROM
hands as h hands as h
WHERE h.id = %(handid)s WHERE h.id = %(handid)s
@ -391,7 +342,7 @@ WHERE h.id = %(handid)s
res = c.fetchone() res = c.fetchone()
h.handid = res[0] h.handid = res[0]
h.tablename = res[1] h.tablename = res[1]
h.starttime = res[2] # automatically a datetime h.startTime = res[2] # automatically a datetime
# PlayerStacks # PlayerStacks
c.execute(""" c.execute("""

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2008, Carl Gherardi # Copyright 2008-2010 Carl Gherardi
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -128,7 +128,7 @@ follow : whether to tail -f the input"""
#2008/09/07 06:23:14 ET #2008/09/07 06:23:14 ET
m2 = re.search("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)", info[key]) m2 = re.search("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)", info[key])
datetime = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), m2.group('M'),m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S')) datetime = "%s/%s/%s %s:%s:%s" % (m2.group('Y'), m2.group('M'),m2.group('D'),m2.group('H'),m2.group('MIN'),m2.group('S'))
hand.starttime = time.strptime(datetime, "%Y/%m/%d %H:%M:%S") hand.startTime = time.strptime(datetime, "%Y/%m/%d %H:%M:%S")
if key == 'HID': if key == 'HID':
hand.handid = info[key] hand.handid = info[key]
if key == 'TABLE': if key == 'TABLE':

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# Copyright 2008, Carl Gherardi # Copyright 2008-2010, Carl Gherardi
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -137,7 +137,7 @@ class Win2day(HandHistoryConverter):
for key in info: for key in info:
if key == 'DATETIME': if key == 'DATETIME':
# Win2day uses UTC timestamp # Win2day uses UTC timestamp
hand.starttime = datetime.datetime.fromtimestamp(int(info[key])) hand.startTime = datetime.datetime.fromtimestamp(int(info[key]))
if key == 'HID': if key == 'HID':
hand.handid = info[key] hand.handid = info[key]
if key == 'TABLE': if key == 'TABLE':

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""WinTables.py """WinTables.py
Routines for detecting and handling poker client windows for MS Windows. Routines for detecting and handling poker client windows for MS Windows.
""" """
# Copyright 2008 - 2009, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,11 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Discover_Tables.py """Discover_Tables.py
Inspects the currently open windows and finds those of interest to us--that is Inspects the currently open windows and finds those of interest to us--that is
poker table windows from supported sites. Returns a list poker table windows from supported sites. Returns a list
of Table_Window objects representing the windows found. of Table_Window objects representing the windows found.
""" """
# Copyright 2008 - 2009, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -13,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import os import os
import sys import sys
@ -36,7 +35,10 @@ if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6') and '-r' not in sy
os.environ['PATH'] = tmppath os.environ['PATH'] = tmppath
print "Python " + sys.version[0:3] + ' - press return to continue\n' print "Python " + sys.version[0:3] + ' - press return to continue\n'
sys.stdin.readline() sys.stdin.readline()
os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) if os.name=='nt':
os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
else:
os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
else: else:
print "\npython 2.5 not found, please install python 2.5 or 2.6 for fpdb\n" print "\npython 2.5 not found, please install python 2.5 or 2.6 for fpdb\n"
raw_input("Press ENTER to continue.") raw_input("Press ENTER to continue.")
@ -111,7 +113,7 @@ import Database
import Configuration import Configuration
import Exceptions import Exceptions
VERSION = "0.20-pre3" VERSION = "0.20"
class fpdb: class fpdb:
@ -227,9 +229,9 @@ class fpdb:
dia = gtk.AboutDialog() dia = gtk.AboutDialog()
dia.set_name("Free Poker Database (FPDB)") dia.set_name("Free Poker Database (FPDB)")
dia.set_version(VERSION) dia.set_version(VERSION)
dia.set_copyright("2008-2010, Steffen, Eratosthenes, Carl Gherardi, Eric Blade, _mt, sqlcoder, Bostik, and others") dia.set_copyright("Copyright 2008-2010, Steffen, Eratosthenes, Carl Gherardi, Eric Blade, _mt, sqlcoder, Bostik, and others")
dia.set_comments("GTK AboutDialog comments here") dia.set_comments("")
dia.set_license("GPL v3") dia.set_license("This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory")
dia.set_website("http://fpdb.sourceforge.net/") dia.set_website("http://fpdb.sourceforge.net/")
dia.set_authors(['Steffen', 'Eratosthenes', 'Carl Gherardi', dia.set_authors(['Steffen', 'Eratosthenes', 'Carl Gherardi',
'Eric Blade', '_mt', 'sqlcoder', 'Bostik', 'and others']) 'Eric Blade', '_mt', 'sqlcoder', 'Bostik', 'and others'])
@ -414,21 +416,24 @@ class fpdb:
# self.release_global_lock() # self.release_global_lock()
# lock_released = True # lock_released = True
self.db.recreate_tables() self.db.recreate_tables()
self.release_global_lock()
#else: #else:
# for other dbs use same connection as holds global lock # for other dbs use same connection as holds global lock
# self.fdb_lock.fdb.recreate_tables() # self.fdb_lock.fdb.recreate_tables()
# TODO: figure out why this seems to be necessary # TODO: figure out why this seems to be necessary
dia_restart = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING, dia_restart = gtk.MessageDialog(parent=self.window, flags=0, type=gtk.MESSAGE_WARNING,
buttons=(gtk.BUTTONS_OK), message_format="Restart fpdb") buttons=(gtk.BUTTONS_OK), message_format="Restart fpdb")
diastring = "You should now restart fpdb." diastring = "Fpdb now needs to close. Please restart it."
dia_restart.format_secondary_text(diastring) dia_restart.format_secondary_text(diastring)
dia_restart.run() dia_restart.run()
dia_restart.destroy() dia_restart.destroy()
self.quit(None, None)
elif response == gtk.RESPONSE_NO: elif response == gtk.RESPONSE_NO:
self.release_global_lock()
print 'User cancelled recreating tables' print 'User cancelled recreating tables'
#if not lock_released: #if not lock_released:
self.release_global_lock() #end def dia_recreate_tables
def dia_recreate_hudcache(self, widget, data=None): def dia_recreate_hudcache(self, widget, data=None):
if self.obtain_global_lock(): if self.obtain_global_lock():
@ -867,7 +872,7 @@ class fpdb:
def tab_auto_import(self, widget, data=None): def tab_auto_import(self, widget, data=None):
"""opens the auto import tab""" """opens the auto import tab"""
new_aimp_thread = GuiAutoImport.GuiAutoImport(self.settings, self.config, self.sql) new_aimp_thread = GuiAutoImport.GuiAutoImport(self.settings, self.config, self.sql, self.window)
self.threads.append(new_aimp_thread) self.threads.append(new_aimp_thread)
aimp_tab=new_aimp_thread.get_vbox() aimp_tab=new_aimp_thread.get_vbox()
self.add_and_display_tab(aimp_tab, "Auto Import") self.add_and_display_tab(aimp_tab, "Auto Import")
@ -906,7 +911,9 @@ You should therefore always keep your hand history files so that you can re-impo
For documentation please visit our website at http://fpdb.sourceforge.net/. For documentation please visit our website at http://fpdb.sourceforge.net/.
If you need help click on Contact - Get Help on our website. If you need help click on Contact - Get Help on our website.
Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml. Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml.
This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory.""")
This program is free/libre open source software licensed partially under the AGPL3, and partially under GPL2 or later.
You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt and gpl-3.0.txt in the fpdb installation directory.""")
self.add_and_display_tab(mh_tab, "Help") self.add_and_display_tab(mh_tab, "Help")
def tab_table_viewer(self, widget, data=None): def tab_table_viewer(self, widget, data=None):
@ -918,7 +925,7 @@ This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installat
def tabGraphViewer(self, widget, data=None): def tabGraphViewer(self, widget, data=None):
"""opens a graph viewer tab""" """opens a graph viewer tab"""
new_gv_thread = GuiGraphViewer.GuiGraphViewer(self.sql, self.config) new_gv_thread = GuiGraphViewer.GuiGraphViewer(self.sql, self.config, self.window)
self.threads.append(new_gv_thread) self.threads.append(new_gv_thread)
gv_tab = new_gv_thread.get_vbox() gv_tab = new_gv_thread.get_vbox()
self.add_and_display_tab(gv_tab, "Graphs") self.add_and_display_tab(gv_tab, "Graphs")

View File

@ -1,21 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#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.
#end class fpdb_db

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,10 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
#see status.txt for site/games support info
# Standard Library modules # Standard Library modules
@ -485,9 +483,9 @@ class Importer:
def printEmailErrorMessage(self, errors, filename, line): def printEmailErrorMessage(self, errors, filename, line):
traceback.print_exc(file=sys.stderr) traceback.print_exc(file=sys.stderr)
print "Error No.",errors,", please send the hand causing this to steffen@sycamoretest.info so I can fix it." print "Error No.",errors,", please send the hand causing this to fpdb-main@lists.sourceforge.net so we can fix the problem."
print "Filename:", filename print "Filename:", filename
print "Here is the first line so you can identify it. Please mention that the error was a ValueError:" print "Here is the first line of the hand so you can identify it. Please mention that the error was a ValueError:"
print self.hand[0] print self.hand[0]
print "Hand logged to hand-errors.txt" print "Hand logged to hand-errors.txt"
logfile = open('hand-errors.txt', 'a') logfile = open('hand-errors.txt', 'a')

View File

@ -1,3 +1,20 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#Copyright 2009-2010 Eric Blade
#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.
from distutils.core import setup from distutils.core import setup
import py2exe import py2exe
opts = { opts = {

View File

@ -1,10 +1,11 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""setup.py """setup.py
Py2exe script for fpdb. Py2exe script for fpdb.
""" """
# Copyright 2009, Ray E. Barker # Copyright 2009-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -132,7 +133,7 @@ test_and_remove(dist_dir)
setup( setup(
name = 'fpdb', name = 'fpdb',
description = 'Free Poker DataBase', description = 'Free Poker DataBase',
version = '0.12', version = '0.20',
windows = [ {'script': 'fpdb.pyw', "icon_resources": [(1, "../gfx/fpdb_large_icon.ico")]}, windows = [ {'script': 'fpdb.pyw', "icon_resources": [(1, "../gfx/fpdb_large_icon.ico")]},
{'script': 'HUD_main.pyw', }, {'script': 'HUD_main.pyw', },
@ -157,7 +158,7 @@ setup(
# files in 2nd value in tuple are moved to dir named in 1st value # files in 2nd value in tuple are moved to dir named in 1st value
#data_files updated for new locations of licences + readme nolonger exists #data_files updated for new locations of licences + readme nolonger exists
data_files = [('', ['HUD_config.xml.example', 'Cards01.png', 'logging.conf', '../agpl-3.0.txt', '../fdl-1.2.txt', '../THANKS.txt']) data_files = [('', ['HUD_config.xml.example', 'Cards01.png', 'logging.conf', '../agpl-3.0.txt', '../fdl-1.2.txt', '../THANKS.txt', '../readme.txt'])
,(dist_dir, [r'..\run_fpdb.bat']) ,(dist_dir, [r'..\run_fpdb.bat'])
,( dist_dir + r'\gfx', glob.glob(r'..\gfx\*.*') ) ,( dist_dir + r'\gfx', glob.glob(r'..\gfx\*.*') )
# line below has problem with fonts subdir ('not a regular file') # line below has problem with fonts subdir ('not a regular file')
@ -230,8 +231,6 @@ pyfpdb/share/locale
pyfpdb/share/man pyfpdb/share/man
pyfpdb/share/themes/Default pyfpdb/share/themes/Default
Please double-check that msvcr90.dll is NOT in the distribution tree
Use 7-zip to zip up the distribution and create a self extracting archive and that's it! Use 7-zip to zip up the distribution and create a self extracting archive and that's it!
""" """

View File

@ -1,4 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2009-2010 Carl Gherardi
#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.
import BetfairToFpdb import BetfairToFpdb
from Hand import * from Hand import *
import py import py

View File

@ -1,4 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2008-2010 Carl Gherardi
#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.
import sqlite3 import sqlite3
import Database import Database
import math import math

View File

@ -1,4 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2009-2010 Matt Turnbull
#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.
import EverleafToFpdb import EverleafToFpdb
import py import py

View File

@ -1,4 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2009-2010 Matt Turnbull
#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.
import FulltiltToFpdb import FulltiltToFpdb
import py import py

View File

@ -1,4 +1,20 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
#Copyright 2009-2010 Matt Turnbull
#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.
import PokerStarsToFpdb import PokerStarsToFpdb
from Hand import * from Hand import *
import py import py

View File

@ -1,3 +1,19 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2009-2010 Carl Gherardi
#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.
# create .bat scripts in windows to try out different gtk dirs # create .bat scripts in windows to try out different gtk dirs

1
readme.txt Normal file
View File

@ -0,0 +1 @@
Please visit http://fpdb.sourceforge.net for documentation, tips and help.

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
#This is intended mostly for regression testing #This is intended mostly for regression testing

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
#This is intended mostly for regression testing #This is intended mostly for regression testing

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import sys import sys

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +12,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
echo "Please note for this to work you need to work on an empty database, otherwise some info (the id fields) will be off" echo "Please note for this to work you need to work on an empty database, otherwise some info (the id fields) will be off"

View File

@ -1,6 +1,7 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2008 Carl Gherardi #Copyright 2008-2010 Carl Gherardi
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -12,8 +13,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
import os import os
import sys import sys

View File

@ -1,4 +1,12 @@
# setup.py #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Created by Mika Bostrom, released into the public domain as far as legally possible.
#
#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.
# Python packaging for fpdb # Python packaging for fpdb
from distutils.core import setup from distutils.core import setup
@ -12,8 +20,7 @@ setup(name = 'fpdb',
package_dir = { 'fpdb' : 'pyfpdb' }, package_dir = { 'fpdb' : 'pyfpdb' },
data_files = [ data_files = [
('/usr/share/doc/python-fpdb', ('/usr/share/doc/python-fpdb',
['docs/readme.txt', 'docs/release-notes.txt', ['THANKS.txt']),
'docs/tabledesign.html', 'THANKS.txt']),
('/usr/share/pixmaps', ('/usr/share/pixmaps',
['gfx/fpdb-icon.png', 'gfx/fpdb-icon2.png', ['gfx/fpdb-icon.png', 'gfx/fpdb-icon2.png',
'gfx/fpdb-cards.png' 'gfx/fpdb-cards.png'

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""test1.py """test1.py
Test if python is working. Test if python is working.
""" """
# Copyright 2008, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""test2.py """test2.py
Test if gtk is working. Test if gtk is working.
""" """
# Copyright 2008, Ray E. Barker # Copyright 2008-2010, Ray E. Barker
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
#Copyright 2008 Steffen Jobbagy-Felso #Copyright 2008-2010 Steffen Schaumburg, Ray E. Barker
#Copyright 2009 Ray E. Barker
#This program is free software: you can redistribute it and/or modify #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 #it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -13,8 +12,7 @@
# #
#You should have received a copy of the GNU Affero General Public License #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/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in #In the "official" distribution you can find the license in agpl-3.0.txt.
#agpl-3.0.txt in the docs folder of the package.
# This script prepares the compressed distribution files for # This script prepares the compressed distribution files for
# uploading to sourceforge. # uploading to sourceforge.

View File

@ -1,4 +1,19 @@
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*-
#Copyright 2009-2010 Ray E. Barker
#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.
import re import re