Implement a context processor to load gamespy query stuff
This commit is contained in:
0
minecraft/__init__.py
Normal file
0
minecraft/__init__.py
Normal file
7
minecraft/context.py
Normal file
7
minecraft/context.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import pyspy
|
||||
from django.conf import settings
|
||||
|
||||
def server_info(request):
|
||||
client = pyspy.GamespyClient(settings.MINECRAFT_SERVER, settings.MINECRAFT_SERVER_PORT)
|
||||
client.update()
|
||||
return {'onlinePlayers':client.players()}
|
Reference in New Issue
Block a user