Use debian 2.7 only
[fpbd-bostik.git] / pyfpdb / ScriptGenerateWikiPage.py
blobe1f0808678225f8faa6e3fbfdb5decd6739a9a5a
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
4 # Copyright 2010-2011, Carl Gherardi
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ########################################################################
21 import os
22 import copy
24 import Configuration
25 import IdentifySite
26 import pprint
27 pp = pprint.PrettyPrinter(indent=4)
29 def print_site(name, data, mask):
30 print "! %s" % name
31 for game, limits in gametypes:
32 tmp = ""
33 for lim in limits:
34 style = "red"
35 if mask[name][game][lim] == False: style = "lightgrey"
36 if data[name][game][lim] == True: style = "lightgreen"
37 tmp += "| style='background:%s' | %s |" %(style, lim.upper())
38 print tmp[:-1]
39 print "|-"
42 #########################################################################
43 # Masks - If a value is False, it means the site doesn't support the game
44 #########################################################################
46 defaultmask = { 'holdem' : { 'nl': None, 'pl': None, 'fl': None},
47 'omahahi' : { 'nl': False, 'pl': None, 'fl': None},
48 'omahahilo': { 'nl': False, 'pl': None, 'fl': None},
49 'fivedraw' : { 'nl': None, 'pl': None, 'fl': None},
50 '27_1draw' : { 'nl': None, 'pl': False, 'fl': False},
51 '27_3draw' : { 'nl': None, 'pl': False, 'fl': None},
52 'a5_3draw' : { 'nl': None, 'pl': None, 'fl': None},
53 'badugi' : { 'nl': None, 'pl': False, 'fl': False},
54 'razz' : { 'nl': None, 'pl': None, 'fl': None},
55 'studhi' : { 'nl': None, 'pl': None, 'fl': None},
56 'studhilo' : { 'nl': None, 'pl': None, 'fl': None},
57 '5studhi' : { 'nl': False, 'pl': False, 'fl': False},
60 sitemasks = { "PokerStars": copy.deepcopy(defaultmask),
61 "Full Tilt Poker": copy.deepcopy(defaultmask),
62 "Everleaf": copy.deepcopy(defaultmask),
63 "Boss": copy.deepcopy(defaultmask),
64 "Absolute": copy.deepcopy(defaultmask),
65 "PartyPoker": copy.deepcopy(defaultmask),
66 "Betfair": copy.deepcopy(defaultmask),
67 "Merge": copy.deepcopy(defaultmask),
68 "OnGame": copy.deepcopy(defaultmask),
69 "PKR": copy.deepcopy(defaultmask),
70 "iPoker": copy.deepcopy(defaultmask),
71 "Winamax": copy.deepcopy(defaultmask),
72 "Everest": copy.deepcopy(defaultmask),
73 "PacificPoker": copy.deepcopy(defaultmask),
74 "Cake": copy.deepcopy(defaultmask),
75 "Entraction": copy.deepcopy(defaultmask),
76 "BetOnline": copy.deepcopy(defaultmask),
77 "Microgaming": copy.deepcopy(defaultmask),
80 # Site specific changes from the defaults
81 # Stars - no A-5 draw, does have PLBadugi
82 sitemasks['PokerStars']['a5_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
83 sitemasks['PokerStars']['badugi'] = { 'nl': False, 'pl': None, 'fl' : None}
84 # PartyPoker - no draw games, no razz
85 sitemasks['PartyPoker']['fivedraw'] = { 'nl': False, 'pl': False, 'fl': False}
86 sitemasks['PartyPoker']['27_1draw'] = { 'nl': False, 'pl': False, 'fl': False}
87 sitemasks['PartyPoker']['27_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
88 sitemasks['PartyPoker']['a5_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
89 sitemasks['PartyPoker']['badugi'] = { 'nl': False, 'pl': False, 'fl': False}
90 sitemasks['PartyPoker']['razz'] = { 'nl': False, 'pl': False, 'fl': False}
91 # Everleaf - no draw games
92 sitemasks['Everleaf']['fivedraw'] = { 'nl': False, 'pl': False, 'fl': False}
93 sitemasks['Everleaf']['27_1draw'] = { 'nl': False, 'pl': False, 'fl': False}
94 sitemasks['Everleaf']['27_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
95 sitemasks['Everleaf']['a5_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
96 sitemasks['Everleaf']['badugi'] = { 'nl': False, 'pl': False, 'fl': False}
97 # Everest - no draw games
98 sitemasks['Everest']['fivedraw'] = { 'nl': False, 'pl': False, 'fl': False}
99 sitemasks['Everest']['27_1draw'] = { 'nl': False, 'pl': False, 'fl': False}
100 sitemasks['Everest']['27_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
101 sitemasks['Everest']['a5_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
102 sitemasks['Everest']['badugi'] = { 'nl': False, 'pl': False, 'fl': False}
103 # Cake - Only flop based games
104 sitemasks['Cake']['razz'] = { 'nl': False, 'pl': False, 'fl': False}
105 sitemasks['Cake']['studhi'] = { 'nl': False, 'pl': False, 'fl': False}
106 sitemasks['Cake']['studhilo'] = { 'nl': False, 'pl': False, 'fl': False}
107 sitemasks['Cake']['5studhi'] = { 'nl': False, 'pl': False, 'fl': False}
108 sitemasks['Cake']['fivedraw'] = { 'nl': False, 'pl': False, 'fl': False}
109 sitemasks['Cake']['27_1draw'] = { 'nl': False, 'pl': False, 'fl': False}
110 sitemasks['Cake']['27_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
111 sitemasks['Cake']['a5_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
112 sitemasks['Cake']['badugi'] = { 'nl': False, 'pl': False, 'fl': False}
113 # Boss -Razz, +5CD, -other draw games
114 sitemasks['Boss']['razz'] = { 'nl': False, 'pl': False, 'fl': False}
115 sitemasks['Boss']['27_1draw'] = { 'nl': False, 'pl': False, 'fl': False}
116 sitemasks['Boss']['27_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
117 sitemasks['Boss']['a5_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
118 sitemasks['Boss']['badugi'] = { 'nl': False, 'pl': False, 'fl': False}
119 # Winamax - Only Omaha and Holdem
120 sitemasks['Winamax']['omahahilo'] = { 'nl': False, 'pl': False, 'fl': False}
121 sitemasks['Winamax']['razz'] = { 'nl': False, 'pl': False, 'fl': False}
122 sitemasks['Winamax']['studhi'] = { 'nl': False, 'pl': False, 'fl': False}
123 sitemasks['Winamax']['studhilo'] = { 'nl': False, 'pl': False, 'fl': False}
124 sitemasks['Winamax']['5studhi'] = { 'nl': False, 'pl': False, 'fl': False}
125 sitemasks['Winamax']['fivedraw'] = { 'nl': False, 'pl': False, 'fl': False}
126 sitemasks['Winamax']['27_1draw'] = { 'nl': False, 'pl': False, 'fl': False}
127 sitemasks['Winamax']['27_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
128 sitemasks['Winamax']['a5_3draw'] = { 'nl': False, 'pl': False, 'fl': False}
129 sitemasks['Winamax']['badugi'] = { 'nl': False, 'pl': False, 'fl': False}
133 defaults = { 'nl':None, 'pl':None, 'fl':None, }
135 games = {"27_1draw" : copy.deepcopy(defaults)
136 ,"27_3draw" : copy.deepcopy(defaults)
137 ,"a5_3draw" : copy.deepcopy(defaults)
138 ,"5studhi" : copy.deepcopy(defaults)
139 ,"badugi" : copy.deepcopy(defaults)
140 ,"fivedraw" : copy.deepcopy(defaults)
141 ,"holdem" : copy.deepcopy(defaults)
142 ,"omahahi" : copy.deepcopy(defaults)
143 ,"omahahilo" : copy.deepcopy(defaults)
144 ,"razz" : copy.deepcopy(defaults)
145 ,"studhi" : copy.deepcopy(defaults)
146 ,"studhilo" : copy.deepcopy(defaults)
149 Configuration.set_logfile("fpdb-log.txt")
150 config = Configuration.Config(file = "HUD_config.test.xml")
151 in_path = os.path.abspath('regression-test-files')
152 idsite = IdentifySite.IdentifySite(config, in_path)
153 idsite.scan()
154 idsite.fetchGameTypes()
157 sites = { "PokerStars": copy.deepcopy(games),
158 "Full Tilt Poker": copy.deepcopy(games),
159 "Everleaf": copy.deepcopy(games),
160 "Boss": copy.deepcopy(games),
161 "Absolute": copy.deepcopy(games),
162 "PartyPoker": copy.deepcopy(games),
163 "Betfair": copy.deepcopy(games),
164 "Merge": copy.deepcopy(games),
165 "OnGame": copy.deepcopy(games),
166 "PKR": copy.deepcopy(games),
167 "iPoker": copy.deepcopy(games),
168 "Winamax": copy.deepcopy(games),
169 "Everest": copy.deepcopy(games),
170 "PacificPoker": copy.deepcopy(games),
171 "Cake": copy.deepcopy(games),
172 "Entraction": copy.deepcopy(games),
173 "BetOnline": copy.deepcopy(games),
174 "Microgaming": copy.deepcopy(games),
177 ring = copy.deepcopy(sites)
178 tour = copy.deepcopy(sites)
179 summ = copy.deepcopy(sites)
181 for idx, f in idsite.filelist.iteritems():
182 if f.gametype != False:
183 a = f.gametype['category']
184 b = f.gametype['limitType']
185 c = f.site.name
186 if f.gametype['type'] == 'ring':
187 ring[c][a][b] = True
188 if f.gametype['type'] == 'tour':
189 if f.site.name == "Full Tilt Poker":
190 print "DEBUG: Found FTP: %s" % f.path
191 tour[c][a][b] = True
192 else:
193 print "Skipping: %s" % f.path
196 gametypes = [ ('holdem', ['nl','pl','fl']),
197 ('omahahi', ['nl','pl','fl']),
198 ('omahahilo', ['nl','pl','fl']),
199 ('5studhi', [ 'pl','fl']),
200 ('studhi', [ 'fl']),
201 ('studhilo', [ 'fl']),
202 ('razz', [ 'fl']),
203 ('fivedraw', ['nl','pl','fl']),
204 ('27_1draw', ['nl' ]),
205 ('27_3draw', [ 'pl','fl']),
206 ('a5_3draw', [ 'pl','fl']),
207 ('badugi', [ 'pl','fl']),
210 # The following needs to be written to 4 lines - its a lot easier to work with as laid out below
211 #print """{| border=0<br>
213 #| Site || colspan=3 style='background:%s' | Holdem |
214 # | colspan=3 style='background:%s' | Omaha |
215 # | colspan=3 style='background:%s' | O8 |
216 # | colspan=2 style='background:%s' | 5CS |
217 # | style='background:%s' | 7CS |
218 # | style='background:%s' | 7CS H/L |
219 # | style='background:%s' | Razz |
220 # | colspan=3 style='background:%s' | 5CD |
221 # | style='background:%s' | 27SD |
222 # | colspan=2 style='background:%s' | 27TD |
223 # | colspan=2 style='background:%s' | A5TD |
224 # | colspan=2 style='background:%s' | Badugi
225 #|-""" % col_colours
228 hdcol1 = "grey"
229 hdcol2 = "lightgrey"
231 col_colours = (hdcol1,hdcol2,hdcol1,hdcol2,hdcol1,hdcol2,hdcol1,hdcol2,hdcol1,hdcol2,hdcol1,hdcol2)
233 ###################### Cash Game Wiki Table ##############################
235 print """{| border=0<br>
237 | Site || colspan=3 style='background:%s' | Holdem || colspan=3 style='background:%s' | Omaha || colspan=3 style='background:%s' | O8 || colspan=2 style='background:%s' | 5CS || style='background:%s' | 7CS || style='background:%s' | 7CS H/L || style='background:%s' | Razz || colspan=3 style='background:%s' | 5CD || style='background:%s' | 27SD || colspan=2 style='background:%s' | 27TD || colspan=2 style='background:%s' | A5TD || colspan=2 style='background:%s' | Badugi
238 |-""" % col_colours
241 print_site("PokerStars", ring, sitemasks)
242 print_site("Full Tilt Poker", ring, sitemasks)
243 print_site("PartyPoker", ring, sitemasks)
244 print_site("Everleaf", ring, sitemasks)
245 print_site("Boss", ring, sitemasks)
246 print_site("Merge", ring, sitemasks)
247 print_site("OnGame", ring, sitemasks)
248 print_site("iPoker", ring, sitemasks)
249 print_site("Winamax", ring, sitemasks)
250 print_site("Everest", ring, sitemasks)
251 print_site("Cake", ring, sitemasks)
252 print_site("Entraction", ring, sitemasks)
253 print_site("BetOnline", ring, sitemasks)
254 print_site("Absolute", ring, sitemasks)
255 print_site("Betfair", ring, sitemasks)
256 print_site("PKR", ring, sitemasks)
257 print_site("PacificPoker", ring, sitemasks)
259 print "|}"
261 print "###################### Tourney Wiki Table ##############################"
263 # Site specific changes for tourneys
264 # Stars: Preference for NLO8 to PLO8 in tourneys
265 sitemasks['PokerStars']['omahahilo'] = { 'nl': None, 'pl': None, 'fl': None}
266 print """{| border=0<br>
268 | Site || colspan=3 style='background:%s' | Holdem || colspan=3 style='background:%s' | Omaha || colspan=3 style='background:%s' | O8 || colspan=2 style='background:%s' | 5CS || style='background:%s' | 7CS || style='background:%s' | 7CS H/L || style='background:%s' | Razz || colspan=3 style='background:%s' | 5CD || style='background:%s' | 27SD || colspan=2 style='background:%s' | 27TD || colspan=2 style='background:%s' | A5TD || colspan=2 style='background:%s' | Badugi
269 |-""" % col_colours
271 print_site("PokerStars", tour, sitemasks)
272 print_site("Full Tilt Poker", tour, sitemasks)
273 print_site("PartyPoker", tour, sitemasks)
274 print_site("Everleaf", tour, sitemasks)
275 print_site("Boss", tour, sitemasks)
276 print_site("Merge", tour, sitemasks)
277 print_site("OnGame", tour, sitemasks)
278 print_site("iPoker", tour, sitemasks)
279 print_site("Winamax", tour, sitemasks)
280 print_site("Everest", tour, sitemasks)
281 print_site("Cake", tour, sitemasks)
282 print_site("Entraction", tour, sitemasks)
283 print_site("BetOnline", tour, sitemasks)
284 print_site("Absolute", tour, sitemasks)
285 print_site("Betfair", tour, sitemasks)
286 print_site("PKR", tour, sitemasks)
287 print_site("PacificPoker", tour, sitemasks)
289 print "|}"