Set game directory listing to update every 30 mins, changed setting to GAME_DIRECTORY_LISTING and removed too verbose logging.
This commit is contained in:
parent
bc04d5f99e
commit
8f1378c47e
3 changed files with 39 additions and 34 deletions
|
|
@ -59,8 +59,8 @@ Evennia server has finished starting:
|
||||||
can be added to it). The function should not return anything. Plugin
|
can be added to it). The function should not return anything. Plugin
|
||||||
services are started last in the Server startup process.
|
services are started last in the Server startup process.
|
||||||
"""
|
"""
|
||||||
from evennia.contrib.gamedir_client import EvenniaGameDirService
|
|
||||||
|
|
||||||
|
from evennia.contrib.gamedir_client import EvenniaGameDirService
|
||||||
|
|
||||||
def start_plugin_services(server):
|
def start_plugin_services(server):
|
||||||
"""
|
"""
|
||||||
|
|
@ -79,7 +79,7 @@ Next, configure your game listing by opening up `server/conf/settings.py` and
|
||||||
# Contrib config
|
# Contrib config
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
GAMEDIR_CLIENT = {
|
GAME_DIRECTORY_LISTING = {
|
||||||
'game_status': 'pre-alpha',
|
'game_status': 'pre-alpha',
|
||||||
'listing_contact': 'me@my-game.com',
|
'listing_contact': 'me@my-game.com',
|
||||||
'telnet_hostname': 'my-game.com',
|
'telnet_hostname': 'my-game.com',
|
||||||
|
|
@ -92,7 +92,7 @@ At this point, you should be all set! Simply restart your game and check the
|
||||||
server logs for errors. Your listing and some game state will be sent every
|
server logs for errors. Your listing and some game state will be sent every
|
||||||
half hour.
|
half hour.
|
||||||
|
|
||||||
## Possible GAMEDIR_CLIENT settings
|
## Possible GAMEDIR_DIRECTORY_LISTING settings
|
||||||
|
|
||||||
### game_status
|
### game_status
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ class EvenniaGameDirClient(object):
|
||||||
self.report_host = 'http://evennia-game-directory.appspot.com'
|
self.report_host = 'http://evennia-game-directory.appspot.com'
|
||||||
self.report_path = '/api/v1/game/check_in'
|
self.report_path = '/api/v1/game/check_in'
|
||||||
self.report_url = self.report_host + self.report_path
|
self.report_url = self.report_host + self.report_path
|
||||||
|
self.logged_first_connect = False
|
||||||
|
|
||||||
self._on_bad_request = on_bad_request
|
self._on_bad_request = on_bad_request
|
||||||
# Oh, the humanity. Silence the factory start/stop messages.
|
# Oh, the humanity. Silence the factory start/stop messages.
|
||||||
|
|
@ -43,8 +44,10 @@ class EvenniaGameDirClient(object):
|
||||||
"""
|
"""
|
||||||
status_code, response_body = yield self._form_and_send_request()
|
status_code, response_body = yield self._form_and_send_request()
|
||||||
if status_code == 200:
|
if status_code == 200:
|
||||||
logger.log_infomsg(
|
if not self.logged_first_connect:
|
||||||
"Successfully sent game details to Evennia Game Directory.")
|
logger.log_infomsg(
|
||||||
|
"Successfully sent game details to Evennia Game Directory.")
|
||||||
|
self.logged_first_connect = True
|
||||||
return
|
return
|
||||||
# At this point, either EGD is having issues or the payload we sent
|
# At this point, either EGD is having issues or the payload we sent
|
||||||
# is improperly formed (probably due to mis-configuration).
|
# is improperly formed (probably due to mis-configuration).
|
||||||
|
|
@ -64,7 +67,7 @@ class EvenniaGameDirClient(object):
|
||||||
'User-Agent': ['Evennia Game Directory Client'],
|
'User-Agent': ['Evennia Game Directory Client'],
|
||||||
'Content-Type': ['application/x-www-form-urlencoded'],
|
'Content-Type': ['application/x-www-form-urlencoded'],
|
||||||
}
|
}
|
||||||
gd_config = settings.GAMEDIR_CLIENT
|
gd_config = settings.GAME_DIRECTORY_LISTING
|
||||||
values = {
|
values = {
|
||||||
'game_name': settings.SERVERNAME,
|
'game_name': settings.SERVERNAME,
|
||||||
'game_status': gd_config['game_status'],
|
'game_status': gd_config['game_status'],
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ from twisted.internet.task import LoopingCall
|
||||||
from evennia.contrib.gamedir_client.client import EvenniaGameDirClient
|
from evennia.contrib.gamedir_client.client import EvenniaGameDirClient
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
|
|
||||||
|
# How often to sync to the server
|
||||||
|
_CLIENT_UPDATE_RATE = 60 * 30
|
||||||
|
|
||||||
class EvenniaGameDirService(Service):
|
class EvenniaGameDirService(Service):
|
||||||
"""
|
"""
|
||||||
|
|
@ -20,7 +22,7 @@ class EvenniaGameDirService(Service):
|
||||||
def startService(self):
|
def startService(self):
|
||||||
super(EvenniaGameDirService, self).startService()
|
super(EvenniaGameDirService, self).startService()
|
||||||
# TODO: Check to make sure that the client is configured.
|
# TODO: Check to make sure that the client is configured.
|
||||||
self.loop.start(10)
|
self.loop.start(_CLIENT_UPDATE_RATE)
|
||||||
|
|
||||||
def stopService(self):
|
def stopService(self):
|
||||||
if self.running == 0:
|
if self.running == 0:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue