Skip to content

Commit

Permalink
fixes #163
Browse files Browse the repository at this point in the history
  • Loading branch information
rlogiacco committed Jul 18, 2019
1 parent 0725890 commit 418d658
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ In this section you can configure the content of the notification messages.
5. This buttons sets the markup options for the message text. Only available when no image will be send or if image will be send in a separate message.

6. You can use variables in the messages :
* `{file}` (only usable while printing) - The currently printing file.
* `{file}`, `{path}` (only usable while printing) - The currently printing file, with or without path information.
* `{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_done}`, `{time_left}`, `{time_finish}` (only useful for height change events) - Time done / left in the print and ETA.
Expand Down
5 changes: 3 additions & 2 deletions octoprint_telegram/telegramNotifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,19 @@ def _sendNotification(self, payload, **kwargs):
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)))
#giloser 17/07/19
try:
time_finish = self.main.calculate_ETA(time_left)
except Exception, ex:
time_finish = str(ex)
self._logger.error("Exception on formatting message: " +str(ex))
if status['progress']['printTimeLeft'] == None:
time_left = gettext('[Unknown]')
file = ""
file = status['job']['file']['name']
path = status['job']['file']['path']
if "file" in payload: file = payload["file"]
if "gcode" in payload: file = payload["gcode"]
if "filename" in payload: file = payload["filename"]
self._logger.debug("VARS - " + str(locals()))
emo = EmojiFormatter(self.main)
try:
# call format with emo class object to handle emojis, otherwise use locals
Expand Down

0 comments on commit 418d658

Please sign in to comment.