Add Mumble user list to stats

This commit is contained in:
Tanner Collin 2020-10-31 22:53:44 +00:00
parent 7e1385331b
commit 93d3731507
3 changed files with 19 additions and 0 deletions

View File

@ -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]

View File

@ -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

View File

@ -60,6 +60,7 @@ DOOR_API_TOKEN = ''
DOOR_CODE = ''
WIFI_PASS = ''
MINECRAFT = ''
MUMBLE = ''
# Portal Email Credentials
# For sending password resets, etc.