blob: e8db9951f2543c229e62edfe7f585353cf84a371 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import os
class PlayerList:
def __init__(self, fn):
self._filename = fn
self._last_modified = os.path.getmtime(fn)
self._list = self._load_file(fn)
def _load_file(self, fn):
self._list = []
with open(fn, 'r') as f:
for l in f:
self._list.append(l.strip())
return self._list
def check_player(self, pn):
if pn in self._list:
return True
else:
lm = os.path.getmtime(self._filename)
if lm != self._last_modified:
self._last_modified = lm
self._load_file(self._filename)
if pn in self._list:
return True
return False
|