1
0
Fork 0
trespassed/software/main.py

31 lines
933 B
Python

from twisted.application.service import Service, Application
from twisted.internet import reactor, defer
from trespassed.game import game_init
from trespassed.serial import SerialService, watchdog_service
from trespassed.email import email_routine
from trespassed.status import status_service
from trespassed.web import WebService
reactor.callLater(5, email_routine, "Trespassed Service Restarted","")
application = Application("Trespassed")
serial_service = SerialService()
serial_service.setServiceParent(application)
web_service = WebService("tcp:8000")
web_service.setServiceParent(application)
watchdog_service.setServiceParent(application)
status_service.setServiceParent(application)
def cleanup():
from trespassed.media import MEDIA_CHANNELS
if MEDIA_CHANNELS.music is not None:
MEDIA_CHANNELS.music.stop()
reactor.addSystemEventTrigger('before', 'shutdown', cleanup)
reactor.callLater(2, game_init)