from sqlalchemy import distinct
from pyramid.paster import bootstrap
from xonstat.models import *
+from xonstat.util import datetime_seconds
from skin import Skin
from playerdata import PlayerData
nick_pos = (36,16),
num_gametypes = 3,
nick_maxwidth = 300,
- gametype_pos = (78,30),
+ gametype_pos = (70,30),
gametype_color = (0.0, 0.0, 0.0),
gametype_text = "%s:",
- gametype_width = 96,
+ gametype_width = 100,
gametype_fontsize = 10,
gametype_align = -1,
- elo_pos = (82,30),
+ gametype_upper = False,
+ elo_pos = (75,30),
elo_text = "Elo %.0f",
elo_color = (0.7, 0.7, 0.7),
elo_align = 1,
rank_pos = None,
- nostats_pos = (82,30),
- nostats_fontsize = 10,
- nostats_angle = 0,
- nostats_text = "no stats!",
- nostats_color = (0.7, 0.4, 0.4),
- nostats_center = False,
+ nostats_pos = None,
+ #nostats_pos = (75,30),
+ #nostats_fontsize = 10,
+ #nostats_angle = 0,
+ #nostats_text = "no stats yet!",
+ #nostats_color = (0.7, 0.4, 0.4),
kdr_pos = (392,15),
kdr_fontsize = 10,
kdr_colortop = (0.6, 0.8, 0.6),
if len(skins) == 0:
skins = [ skin_classic, skin_minimal ]
-
# environment setup
env = bootstrap('../../../development.ini')
req = env['request']
if len(players) > 0:
stop = datetime.now()
td = stop-start
- total_seconds = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
- print "Query took %.2f seconds" % (total_seconds)
+ print "Query took %.2f seconds" % (datetime_seconds(td))
print "Creating badges for %d players ..." % len(players)
start = datetime.now()
playerdata.get_data(player_id)
sstop = datetime.now()
td = sstop-sstart
- total_seconds = float(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
- data_time += total_seconds
+ data_time += datetime_seconds(td)
sstart = datetime.now()
for sk in skins:
sk.render_image(playerdata, "output/%s/%d.png" % (str(sk), player_id[0]))
sstop = datetime.now()
td = sstop-sstart
- total_seconds = float(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
- render_time += total_seconds
+ render_time += datetime_seconds(td)
stop = datetime.now()
td = stop-start
- total_seconds = float(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+ total_seconds = datetime_seconds(td)
print "Creating the badges took %.1f seconds (%.3f s per player)" % (total_seconds, total_seconds/float(len(players)))
print "Total time for rendering images: %.3f s" % render_time
print "Total time for getting data: %.3f s" % data_time