Skip to content

Instantly share code, notes, and snippets.

@kantlivelong
Created January 27, 2017 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kantlivelong/9cbda4c12665765908b4ac91d0d06d78 to your computer and use it in GitHub Desktop.
Save kantlivelong/9cbda4c12665765908b4ac91d0d06d78 to your computer and use it in GitHub Desktop.
def on_event(self, event, payload):
if event == Events.CLIENT_OPENED:
self._plugin_manager.send_plugin_message(self._identifier, dict(automaticShutdownEnabled=self._automatic_shutdown_enabled, type="timeout", timeout_value=self._timeout_value))
return
if not self._automatic_shutdown_enabled or not self._settings.global_get(["server", "commands", "systemShutdownCommand"]):
return
if event not in [Events.PRINT_DONE, Events.MOVIE_DONE, Events.MOVIE_FAILED]:
return
if event == Events.PRINT_DONE:
webcam_config = self._settings.global_get(["webcam", "timelapse"], merged=True)
timelapse_type = webcam_config["type"]
if (timelapse_type is not None and timelapse_type != "off"):
self._logger.info("Waiting for timelapse to finish rendering before starting shutdown timer...")
return
if self._timer is not None:
return
self._timeout_value = self.abortTimeout
self._timer = RepeatedTimer(1, self._timer_task)
self._timer.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment