Add Mumble user list to stats
This commit is contained in:
parent
7e1385331b
commit
93d3731507
|
@ -14,6 +14,8 @@ class Command(BaseCommand):
|
|||
|
||||
players = utils_stats.check_minecraft_server()
|
||||
self.stdout.write('Found Minecraft players: ' + str(players))
|
||||
users = utils_stats.check_mumble_server()
|
||||
self.stdout.write('Found Mumble users: ' + str(users))
|
||||
|
||||
self.stdout.write('Completed tasks in {} s'.format(
|
||||
str(time.time() - start)[:4]
|
||||
|
|
|
@ -22,6 +22,7 @@ DEFAULTS = {
|
|||
'bay_108_temp': None,
|
||||
'bay_110_temp': None,
|
||||
'minecraft_players': [],
|
||||
'mumble_users': [],
|
||||
'card_scans': 0,
|
||||
'track': {},
|
||||
}
|
||||
|
@ -114,6 +115,21 @@ def check_minecraft_server():
|
|||
|
||||
return []
|
||||
|
||||
def check_mumble_server():
|
||||
if secrets.MUMBLE:
|
||||
url = secrets.MUMBLE
|
||||
|
||||
try:
|
||||
r = requests.get(url, timeout=5)
|
||||
r.raise_for_status()
|
||||
users = r.text.split()
|
||||
cache.set('mumble_users', users)
|
||||
return users
|
||||
except BaseException as e:
|
||||
logger.error('Problem checking Mumble: {} - {}'.format(e.__class__.__name__, str(e)))
|
||||
|
||||
return []
|
||||
|
||||
def calc_card_scans():
|
||||
date = today_alberta_tz()
|
||||
cards = models.Card.objects
|
||||
|
|
|
@ -60,6 +60,7 @@ DOOR_API_TOKEN = ''
|
|||
DOOR_CODE = ''
|
||||
WIFI_PASS = ''
|
||||
MINECRAFT = ''
|
||||
MUMBLE = ''
|
||||
|
||||
# Portal Email Credentials
|
||||
# For sending password resets, etc.
|
||||
|
|
Loading…
Reference in New Issue
Block a user