From a5290e9421f35f653d2c59d9464ed00ffed8a668 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Thu, 18 Feb 2016 09:37:15 +0000 Subject: [PATCH] Added variable 'time_done'. --- README.md | 2 +- octoprint_telegram/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 675fa13..5db25fb 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,6 @@ To allow the plugin to send messages via telegram, you have to register a telegr * `{file}` - The currently printing file. * `{z}` (only for height change events) - The current z value. * `{percent}` (only useful for height change notifications) - The current percentage of the print progress. - * `{time_left}` (only useful for height change events) - Time left in the print. + * `{time_done}`, `{time_left}` (only useful for height change events) - Time done / left in the print. * `{bed_temp}`, `{e1_temp}`, `{e2_temp}` - Temperatures of bed, extruder 1 and extruder 2. * `{bed_target}`, `{e1_target}`, `{e2_target}` - Target temperatures of bed, extruder 1 and extruder 2. \ No newline at end of file diff --git a/octoprint_telegram/__init__.py b/octoprint_telegram/__init__.py index fd6200f..e7a3e4c 100644 --- a/octoprint_telegram/__init__.py +++ b/octoprint_telegram/__init__.py @@ -192,7 +192,7 @@ def get_settings_defaults(self): messages = dict( PrintStarted = "Started printing {file}.", PrintFailed = "Printing {file} failed.", - ZChange = "Printing at Z={z}.\nBed {bed_temp}/{bed_target}, Extruder {e1_temp}/{e1_target}.\n{percent}% done, {time_left} remaining.", + ZChange = "Printing at Z={z}.\nBed {bed_temp}/{bed_target}, Extruder {e1_temp}/{e1_target}.\n{time_done}, {percent}% done, {time_left} remaining.", PrintDone = "Finished printing {file}.", ) ) @@ -283,6 +283,7 @@ def on_event(self, event, payload, *args, **kwargs): e2_temp = temps['tool1']['actual'] e2_target = temps['tool1']['target'] percent = int(status['progress']['completion'] or 0) + time_done = octoprint.util.get_formatted_timedelta(datetime.timedelta(seconds=(status['progress']['printTime'] or 0))) time_left = octoprint.util.get_formatted_timedelta(datetime.timedelta(seconds=(status['progress']['printTimeLeft'] or 0))) if "file" in payload: file = payload["file"]