Skip to content

Commit

Permalink
add whitelist capability
Browse files Browse the repository at this point in the history
A whitelist is helpful if you want to run the tourney scripts
for a small group.

If WHITELISTFILE is set to a valid/existing file, then is_not_tourney()
returns True for players not in the whitelist file.

WHITELISTFILE defaults to 'player-whitelist.txt'. Simply omit this
file if you don't want to use the whitelist.
  • Loading branch information
jmbjr committed Nov 3, 2015
1 parent 992bc95 commit 26ba194
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion loaddb.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
CLAN_DEADLINE = (TEST_CLAN_DEADLINE or
datetime.datetime(2015, 11, 14, 20)) # Nov 14, 20:00

WHITELISTFILE = 'player-whitelist.txt'

DATE_FORMAT = '%Y%m%d%H%M'

GAME_VERSION = T_VERSION
Expand Down Expand Up @@ -736,7 +738,12 @@ def record_is_milestone(rec):
def is_not_tourney(game):
"""A game started before the tourney start or played after the end
doesn't count."""

if os.path.exists(WHITELISTFILE):
f = open(WHITELISTFILE)
whitelist=f.read().splitlines()
if not (game.get('name').lower() in whitelist):
return True

start = game.get('start')
if not start:
return True
Expand Down

0 comments on commit 26ba194

Please sign in to comment.