Created
January 27, 2017 15:19
-
-
Save kantlivelong/9cbda4c12665765908b4ac91d0d06d78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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