imrahil / OctoPrint-PrintHistory

Plugin for OctoPrint - saves filename, print time and filament usage for each print
GNU Affero General Public License v3.0
63 stars 64 forks source link

Correct references for payload name #89

Closed merlindk closed 3 years ago

merlindk commented 3 years ago

Following the fix suggested in: https://github.com/imrahil/OctoPrint-PrintHistory/issues/86 I implemented it and tested locally and it works perfectly. My install of the plug in stopped working on april and after reinstalling with this change it started working again: image

merlindk commented 3 years ago

@guysoft Can you take a look?

guysoft commented 3 years ago

Installed by running:

~/oprint/bin/pip install git+https://github.com/merlindk/OctoPrint-PrintHistory@fix-history-population --upgrade

I will run a print and see if it fixes the issue

guysoft commented 3 years ago

I don't seem to see any lines added to the history after upgrading with the command above

merlindk commented 3 years ago

I installed directly from inside OctoPrint. You can download my code as a zip: https://github.com/merlindk/OctoPrint-PrintHistory.git [image: image.png] Then you can install that from the plug in manager in octoPrint: [image: image.png] That's how I did it and it works.

On Thu, Jun 3, 2021 at 8:13 AM Guy Sheffer @.***> wrote:

I don't seem to see any lines added to the history after upgrading with the command above

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/imrahil/OctoPrint-PrintHistory/pull/89#issuecomment-853790000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5CFEPKZF3NLAQICP6GZTTTQ5PV3ANCNFSM45NYQGIQ .

guysoft commented 3 years ago

This is the error I am getting:

14:28:16,173 - octoprint.plugin - ERROR - Error while calling plugin printhistory
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugin/__init__.py", line 271, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1941, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_printhistory/__init__.py", line 147, in on_event
    return eventHandler.eventHandler(self, event, payload)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_printhistory/eventHandler.py", line 45, in eventHandler
    gcode_parser = UniversalParser(payload["path"], logger=self._logger)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_printhistory/parser.py", line 26, in __init__
    self.file = open(file_path, "r")
FileNotFoundError: [Errno 2] No such file or directory: 'ABS/kenwood_icecream_mixer.gcode'
guysoft commented 3 years ago

You have this line there, it hard-codes a solution only for Octopi: https://github.com/merlindk/OctoPrint-PrintHistory/blob/fix-history-population/octoprint_printhistory/eventHandler.py#L45

guysoft commented 3 years ago

Foosel said it should be something like this:

self._filemanager.path_on_disk(payload["origin"], payload["path"])
merlindk commented 3 years ago

ok. checking it.

merlindk commented 3 years ago

@guysoft Finally got it working, I was pulling my hair over filemanager not existing when I realized is file_manager hahaha. Could you check if it works for you now?

guysoft commented 3 years ago

Installing and will update when I print

guysoft commented 3 years ago

Getting now: Not sure why, taht is not a file that you edited

2021-06-09 21:28:33,472 - octoprint.plugin.core - ERROR - Invalid syntax in /home/pi/oprint/lib/python3.7/site-packages/octoprint_printhistory/__init__.py for plugin printhistory
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugin/core.py", line 711, in _parse_metadata
    root = ast.parse(f.read(), filename=path)
  File "/usr/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_printhistory/__init__.py", line 178
    if sys.version_info >= (3,0):
guysoft commented 3 years ago

Ok, fixed that, will test :)

merlindk commented 3 years ago

Oh, nice. :D

guysoft commented 3 years ago

It seems to not to work, and I see no error in the log.

merlindk commented 3 years ago

@guysoft It simply doesn't work? can you try re installing it and starting and immediately cancelling the print? it works for me.

guysoft commented 3 years ago

I worked before - do you have the old branch dhat did work? I see there was a git force push or something.

merlindk commented 3 years ago

@guysoft I don't know. But I added some extra logging, can you try again and see if this can shed some light into the issue?

guysoft commented 3 years ago

Yes will do and update

guysoft commented 3 years ago

Here is the full log, I can't seem to see the history, U can't see any mention of the plugin

Plugin is loaded:

|  Print History Plugin (1.2) = /home/pi/oprint/lib/python3.7/site-packages/octoprint_printhistory

...

2021-07-19 22:33:04,369 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: ABS/Vive_Controller_Bumper_Top.gcode, owner: admin, user: admin
2021-07-19 22:35:46,535 - octoprint.plugins.tracking - INFO - Sent tracking event system_unthrottled, payload: {'throttled_now': False, 'throttled_past': False, 'throttled_mask': 524288, 'throttled_voltage_now': False, 'throttled_voltage_past': False, 'throttled_overheat_now': False, 'throttled_overheat_past': False}
2021-07-19 22:36:34,364 - octoprint.util.comm - INFO - Starting job on behalf of user admin
2021-07-19 22:36:34,374 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
2021-07-19 22:36:34,390 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: ABS/Vive_Controller_Bumper_Top.gcode, owner: admin, user: admin
2021-07-19 22:36:34,471 - octoprint.util.comm - INFO - Communication timeout while printing, trying to trigger response from printer.
2021-07-19 22:36:34,514 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2021-07-19 22:36:34,522 - octoprint.plugins.telegram.TMSG - INFO - get thumbnail url for path=ABS/Vive_Controller_Bumper_Top.gcode
2021-07-19 22:36:34,531 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
2021-07-19 22:36:34,537 - octoprint.plugins.telegram.TMSG - INFO - thumbnail =None
2021-07-19 22:36:34,620 - octoprint.plugins.telegram - ERROR - Caught an exception in loop chatId for key: 8512659 => 'Home'
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_telegram/__init__.py", line 1153, in send_msg
    if self.chats[key]['notifications'][kwargs['event']] and (key not in self.shut_up or self.shut_up[key]==0) and self.chats[key]['send_notifications']:
KeyError: 'Home'
2021-07-19 22:36:34,783 - octoprint.plugins.tracking - INFO - Sent tracking event print_started, payload: {'origin': 'local', 'file': '3c7fab552393e79c17a4944de113abb87a63f5a4'}
2021-07-19 22:36:36,614 - octoprint.util.comm - INFO - Printer seems to support the busy protocol, will adjust timeouts and set busy interval accordingly
2021-07-19 22:37:00,561 - octoprint.util.comm - INFO - Telling the printer to set the busy interval to our "communicationBusy" timeout - 1s = 2s
2021-07-19 22:45:39,821 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-19 22:45:48,336 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 909, 'printer_state': 'PRINTING'}
2021-07-19 22:48:20,925 - octoprint.server.util.sockjs - INFO - Client connection closed: 2a0d:6fc1:2:1f00:135c:e1f8:dc05:d1e6
2021-07-19 22:48:24,881 - octoprint.server.util.sockjs - INFO - New connection from client: 2a0d:6fc1:2:1f00:6a36:6d8b:3a77:7b34
2021-07-19 22:48:25,151 - octoprint.server.util.flask - INFO - Passively logging in user admin from 2a0d:6fc1:2:1f00:6a36:6d8b:3a77:7b34
2021-07-19 22:48:25,152 - octoprint.access.users - INFO - Logged in user: admin
2021-07-19 22:48:25,285 - octoprint.server.util.sockjs - INFO - User admin logged in on the socket from client 2a0d:6fc1:2:1f00:6a36:6d8b:3a77:7b34
2021-07-19 23:00:39,822 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-19 23:00:48,327 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 1809, 'printer_state': 'PRINTING'}
2021-07-19 23:01:14,180 - octoprint.plugins.telegram.listener - INFO - Got a command: '/status' with parameter: '' in chat 8512659
2021-07-19 23:05:20,968 - octoprint.server.util.sockjs - INFO - Client connection closed: 2a0d:6fc1:2:1f00:6a36:6d8b:3a77:7b34
2021-07-19 23:15:39,825 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-19 23:15:48,363 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 2709, 'printer_state': 'PRINTING'}
2021-07-19 23:30:39,826 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-19 23:30:48,353 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 3609, 'printer_state': 'PRINTING'}
2021-07-19 23:45:39,827 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-19 23:45:48,353 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 4509, 'printer_state': 'PRINTING'}
2021-07-20 00:00:39,829 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 00:00:48,366 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 5409, 'printer_state': 'PRINTING'}
2021-07-20 00:15:39,830 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 00:15:48,339 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 6309, 'printer_state': 'PRINTING'}
2021-07-20 00:30:39,832 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 00:30:48,399 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 7209, 'printer_state': 'PRINTING'}
2021-07-20 00:45:39,834 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 00:45:48,392 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 8109, 'printer_state': 'PRINTING'}
2021-07-20 01:00:39,836 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 01:00:48,317 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 9009, 'printer_state': 'PRINTING'}
2021-07-20 01:15:39,837 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 01:15:48,424 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 9909, 'printer_state': 'PRINTING'}
2021-07-20 01:30:39,838 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 01:30:48,388 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 10809, 'printer_state': 'PRINTING'}
2021-07-20 01:37:17,491 - octoprint.plugins.telegram - ERROR - Caught an exception in loop chatId for key: 8512659 => 'Home'
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_telegram/__init__.py", line 1153, in send_msg
    if self.chats[key]['notifications'][kwargs['event']] and (key not in self.shut_up or self.shut_up[key]==0) and self.chats[key]['send_notifications']:
KeyError: 'Home'
2021-07-20 01:37:19,875 - octoprint.util.comm - INFO - Finished in 10845.510 s.
2021-07-20 01:37:19,876 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Finishing"
2021-07-20 01:37:19,889 - octoprint.printer.standard.job - INFO - Print job done - origin: local, path: ABS/Vive_Controller_Bumper_Top.gcode, owner: admin
2021-07-20 01:37:20,025 - octoprint.util.comm - INFO - Changing monitoring state from "Finishing" to "Operational"
2021-07-20 01:37:20,333 - octoprint.plugins.tracking - INFO - Sent tracking event print_done, payload: {'origin': 'local', 'file': '3c7fab552393e79c17a4944de113abb87a63f5a4', 'elapsed': 10845}
2021-07-20 01:40:47,771 - octoprint.plugins.tracking - INFO - Sent tracking event system_unthrottled, payload: {'throttled_now': False, 'throttled_past': False, 'throttled_mask': 524296, 'throttled_voltage_now': False, 'throttled_voltage_past': False, 'throttled_overheat_now': False, 'throttled_overheat_past': False}
2021-07-20 01:45:39,839 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 01:45:48,326 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 11709, 'printer_state': 'OPERATIONAL'}
2021-07-20 01:46:28,502 - octoprint.plugins.telegram - ERROR - Caught an exception in loop chatId for key: 8512659 => 'MovieDone'
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_telegram/__init__.py", line 1153, in send_msg
    if self.chats[key]['notifications'][kwargs['event']] and (key not in self.shut_up or self.shut_up[key]==0) and self.chats[key]['send_notifications']:
KeyError: 'MovieDone'
2021-07-20 01:50:47,874 - octoprint.plugins.tracking - INFO - Sent tracking event system_unthrottled, payload: {'throttled_now': False, 'throttled_past': False, 'throttled_mask': 524288, 'throttled_voltage_now': False, 'throttled_voltage_past': False, 'throttled_overheat_now': False, 'throttled_overheat_past': False}
2021-07-20 02:00:39,840 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 02:00:48,444 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 12609, 'printer_state': 'OPERATIONAL'}
2021-07-20 02:15:39,842 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 02:15:48,395 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 13509, 'printer_state': 'OPERATIONAL'}
2021-07-20 02:30:39,843 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 02:30:48,399 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 14409, 'printer_state': 'OPERATIONAL'}
2021-07-20 02:45:39,844 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 02:45:48,393 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 15309, 'printer_state': 'OPERATIONAL'}
2021-07-20 03:00:39,846 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 03:00:48,413 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 16209, 'printer_state': 'OPERATIONAL'}
2021-07-20 03:15:39,847 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 03:15:48,391 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 17109, 'printer_state': 'OPERATIONAL'}
2021-07-20 03:30:39,849 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 03:30:48,457 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 18009, 'printer_state': 'OPERATIONAL'}
2021-07-20 03:45:39,850 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 03:45:48,440 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 18909, 'printer_state': 'OPERATIONAL'}
2021-07-20 04:00:39,851 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 04:00:48,409 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 19809, 'printer_state': 'OPERATIONAL'}
2021-07-20 04:15:39,853 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 04:15:48,396 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 20709, 'printer_state': 'OPERATIONAL'}
2021-07-20 04:30:39,854 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 04:30:48,532 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 21609, 'printer_state': 'OPERATIONAL'}
2021-07-20 04:45:39,855 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 04:45:48,458 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 22509, 'printer_state': 'OPERATIONAL'}
2021-07-20 05:00:39,857 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 05:00:48,453 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 23409, 'printer_state': 'OPERATIONAL'}
2021-07-20 05:15:39,858 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 05:15:48,400 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 24309, 'printer_state': 'OPERATIONAL'}
2021-07-20 05:30:39,859 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 05:30:48,437 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 25209, 'printer_state': 'OPERATIONAL'}
2021-07-20 05:45:39,860 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 05:45:48,421 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 26109, 'printer_state': 'OPERATIONAL'}
2021-07-20 06:00:39,862 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 06:00:48,434 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 27009, 'printer_state': 'OPERATIONAL'}
2021-07-20 06:15:39,863 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 06:15:48,450 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 27909, 'printer_state': 'OPERATIONAL'}
2021-07-20 06:30:39,864 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 06:30:48,463 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 28809, 'printer_state': 'OPERATIONAL'}
2021-07-20 06:45:39,866 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 06:45:48,472 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 29709, 'printer_state': 'OPERATIONAL'}
2021-07-20 07:00:39,867 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 07:00:48,474 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 30609, 'printer_state': 'OPERATIONAL'}
2021-07-20 07:15:39,868 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 07:15:48,456 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 31509, 'printer_state': 'OPERATIONAL'}
2021-07-20 07:30:39,870 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 07:30:48,492 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 32409, 'printer_state': 'OPERATIONAL'}
2021-07-20 07:45:39,871 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 07:45:48,607 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 33309, 'printer_state': 'OPERATIONAL'}
2021-07-20 08:00:39,872 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 08:00:48,547 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 34209, 'printer_state': 'OPERATIONAL'}
2021-07-20 08:15:39,874 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 08:15:48,476 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 35109, 'printer_state': 'OPERATIONAL'}
2021-07-20 08:30:39,875 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 08:30:48,476 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 36009, 'printer_state': 'OPERATIONAL'}
2021-07-20 08:45:39,877 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 08:45:48,485 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 36909, 'printer_state': 'OPERATIONAL'}
2021-07-20 09:00:39,878 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 09:00:49,354 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 37809, 'printer_state': 'OPERATIONAL'}
2021-07-20 09:15:39,879 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 09:15:48,526 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 38709, 'printer_state': 'OPERATIONAL'}
2021-07-20 09:30:39,881 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 09:30:48,529 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 39609, 'printer_state': 'OPERATIONAL'}
2021-07-20 09:45:39,882 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 09:45:48,557 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 40509, 'printer_state': 'OPERATIONAL'}
2021-07-20 10:00:39,883 - octoprint.server.heartbeat - INFO - Server heartbeat <3
2021-07-20 10:00:48,498 - octoprint.plugins.tracking - INFO - Sent tracking event ping, payload: {'octoprint_uptime': 41409, 'printer_state': 'OPERATIONAL'}
2021-07-20 10:11:36,779 - octoprint.server.util.sockjs - INFO - New connection from client: fdc8:457c:ae1e:0:a17f:ec33:e4cf:9071
2021-07-20 10:11:36,838 - octoprint.server.util.flask - INFO - Passively logging in user admin from fdc8:457c:ae1e:0:a17f:ec33:e4cf:9071
2021-07-20 10:11:36,839 - octoprint.access.users - INFO - Logged in user: admin
2021-07-20 10:11:36,924 - octoprint.server.util.sockjs - INFO - User admin logged in on the socket from client fdc8:457c:ae1e:0:a17f:ec33:e4cf:9071
2021-07-20 10:12:14,096 - octoprint.filemanager.analysis - INFO - Starting analysis of local:ABS/Vive_Controller_Bumper_Bottom.gcode
2021-07-20 10:12:14,098 - octoprint.filemanager.analysis - INFO - Invoking analysis command: /home/pi/oprint/bin/python3 -m octoprint analysis gcode --speed-x=6000 --speed-y=6000 --max-t=10 --throttle=0.0 --throttle-lines=100 --bed-z=0.0 /home/pi/.octoprint/uploads/ABS/Vive_Controller_Bumper_Bottom.gcode
2021-07-20 10:12:14,145 - octoprint.plugins.autoselect - INFO - Selecting ABS/Vive_Controller_Bumper_Bottom.gcode on local that was just uploaded
2021-07-20 10:12:14,446 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: ABS/Vive_Controller_Bumper_Bottom.gcode, owner: None, user: None
2021-07-20 10:12:49,476 - octoprint.filemanager.analysis - INFO - Analysis of entry local:ABS/Vive_Controller_Bumper_Bottom.gcode finished, needed 35.38s
guysoft commented 3 years ago

Ok, I just tested and it seems to work on files not in folders. So its an issue around that still

merlindk commented 3 years ago

@guysoft from your logs, the plug in doesn't seem to be triggering, here: 2021-07-20 01:37:20,025 - octoprint.util.comm - INFO - Changing monitoring state from "Finishing" to "Operational" When that status changes the plug in is supposed to fire but I see nothing in the logs except for an exception with telegram. What do you mean it works on files not in folders?

guysoft commented 3 years ago

Ok, so

  1. Indeed it looks like its not triggered.
  2. I mean that when I print something from the root folder, it seems to work. but in a folder it does not
guysoft commented 3 years ago

Ok, here i another log comparison::

not in folder:

2021-07-20 18:49:58,787 - octoprint.plugins.tracking - INFO - Sent tracking event print_started, payload: {'origin': 'local', 'file': '45deb4a5f777679bcbb6fa3fef75411d6db795d1'}
2021-07-20 18:50:00,567 - octoprint.util.comm - INFO - Printer seems to support the busy protocol, will adjust timeouts and set busy interval accordingly
2021-07-20 18:50:04,172 - octoprint.util.comm - INFO - Cancelling job on behalf of user admin
2021-07-20 18:50:04,178 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Cancelling"
2021-07-20 18:50:05,934 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: door-sign-LuggageTag-1-2.gcode, owner: admin, user: admin
2021-07-20 18:50:06,185 - octoprint.plugins.printhistory - INFO - Origin: local
2021-07-20 18:50:06,185 - octoprint.plugins.printhistory - INFO - Path: door-sign-LuggageTag-1-2.gcode
2021-07-20 18:50:06,189 - octoprint.plugins.printhistory - INFO - Path_On_disk: /home/pi/.octoprint/uploads/door-sign-LuggageTag-1-2.gcode
2021-07-20 18:50:06,193 - octoprint.plugins.printhistory - INFO - Can't parse additional parameters from /home/pi/.octoprint/uploads/door-sign-LuggageTag-1-2.gcode
2021-07-20 18:50:06,193 - octoprint.plugins.printhistory - INFO - {}
2021-07-20 18:50:06,327 - octoprint.plugins.tracking - INFO - Sent tracking event print_cancelled, payload: {'origin': 'local', 'file': '45deb4a5f777679bcbb6fa3fef75411d6db795d1', 'elapsed': 7}
2021-07-20 18:50:06,627 - octoprint.plugins.tracking - INFO - Sent tracking event print_failed, payload: {'origin': 'local', 'file': '45deb4a5f777679bcbb6fa3fef75411d6db795d1', 'elapsed': 7, 'reason': 'cancelled'}

In folder:

2021-07-20 18:51:13,780 - octoprint.util.comm - INFO - Starting job on behalf of user admin
2021-07-20 18:51:14,779 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
2021-07-20 18:51:14,798 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: ABS/ella_sword_holder.gcode, owner: admin, user: admin
2021-07-20 18:51:14,911 - octoprint.plugins.telegram.TMSG - INFO - get thumbnail url for path=ABS/ella_sword_holder.gcode
2021-07-20 18:51:14,927 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2021-07-20 18:51:14,929 - octoprint.plugins.telegram.TMSG - INFO - thumbnail =None
2021-07-20 18:51:14,946 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
2021-07-20 18:51:15,183 - octoprint.plugins.tracking - INFO - Sent tracking event print_started, payload: {'origin': 'local', 'file': '0607f3338b62743f329c5698542484aeab141dac'}
2021-07-20 18:51:17,026 - octoprint.util.comm - INFO - Printer seems to support the busy protocol, will adjust timeouts and set busy interval accordingly
2021-07-20 18:51:20,149 - octoprint.util.comm - INFO - Cancelling job on behalf of user admin
2021-07-20 18:51:20,155 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Cancelling"
2021-07-20 18:51:20,184 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: ABS/ella_sword_holder.gcode, owner: admin, user: admin
2021-07-20 18:51:20,668 - octoprint.plugins.tracking - INFO - Sent tracking event print_cancelled, payload: {'origin': 'local', 'file': '0607f3338b62743f329c5698542484aeab141dac', 'elapsed': 6}
2021-07-20 18:51:20,970 - octoprint.plugins.tracking - INFO - Sent tracking event print_failed, payload: {'origin': 'local', 'file': '0607f3338b62743f329c5698542484aeab141dac', 'elapsed': 6, 'reason': 'cancelled'}
merlindk commented 3 years ago

@guysoft well, I suspect something, I added more logging and a retry for the metadata gathering part. Could you try again?

guysoft commented 3 years ago

Will do, might take a while because my extruder broke. Fixing it.

merlindk commented 3 years ago

@guysoft man that is sad. You can trigger the plug in by launching a print and immediately canceling it, just so you know.

guysoft commented 3 years ago

I've been doing that. I will have to disconnect the heater first, which is not coupled with a heater block. Will get to it

guysoft commented 3 years ago

Ok, Now I am getting output when printing-canceling a file in a folder: Still not appearing in the database at the end.

2021-07-21 22:50:29,635 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: ABS/Vive_Controller_Bumper_Bottom.gcode, owner: admin, user: admin
2021-07-21 22:50:29,662 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
2021-07-21 22:50:29,671 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: ABS/Vive_Controller_Bumper_Bottom.gcode, owner: admin, user: admin
2021-07-21 22:50:29,722 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2021-07-21 22:50:29,735 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
2021-07-21 22:50:29,765 - octoprint.plugins.telegram.TMSG - INFO - get thumbnail url for path=ABS/Vive_Controller_Bumper_Bottom.gcode
2021-07-21 22:50:29,775 - octoprint.plugins.telegram.TMSG - INFO - thumbnail =None
2021-07-21 22:50:30,009 - octoprint.plugins.tracking - INFO - Sent tracking event print_started, payload: {'origin': 'local', 'file': '91088c39639636aad10700b4113de4de9454c376'}
2021-07-21 22:50:31,823 - octoprint.util.comm - INFO - Printer seems to support the busy protocol, will adjust timeouts and set busy interval accordingly
2021-07-21 22:50:35,590 - octoprint.util.comm - INFO - Cancelling job on behalf of user admin
2021-07-21 22:50:35,595 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Cancelling"
2021-07-21 22:50:35,951 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: ABS/Vive_Controller_Bumper_Bottom.gcode, owner: admin, user: admin
2021-07-21 22:50:36,211 - octoprint.plugins.printhistory - INFO - Name: Vive_Controller_Bumper_Bottom.gcode
2021-07-21 22:50:36,211 - octoprint.plugins.printhistory - INFO - Origin: local
2021-07-21 22:50:36,211 - octoprint.plugins.printhistory - INFO - Path: ABS/Vive_Controller_Bumper_Bottom.gcode
2021-07-21 22:50:36,217 - octoprint.plugins.printhistory - INFO - Path_On_disk: /home/pi/.octoprint/uploads/ABS/Vive_Controller_Bumper_Bottom.gcode
2021-07-21 22:50:36,353 - octoprint.plugins.tracking - INFO - Sent tracking event print_cancelled, payload: {'origin': 'local', 'file': '91088c39639636aad10700b4113de4de9454c376', 'elapsed': 6}
2021-07-21 22:50:36,623 - octoprint.plugins.tracking - INFO - Sent tracking event print_failed, payload: {'origin': 'local', 'file': '91088c39639636aad10700b4113de4de9454c376', 'elapsed': 6, 'reason': 'cancelled'}
2021-07-21 22:51:16,922 - octoprint.plugins.telegram - ERROR - Caught an exception in loop chatId for key: 8512659 => 'MovieDone'
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_telegram/__init__.py", line 1153, in send_msg
    if self.chats[key]['notifications'][kwargs['event']] and (key not in self.shut_up or self.shut_up[key]==0) and self.chats[key]['send_notifications']:
KeyError: 'MovieDone'
guysoft commented 3 years ago

Looks like its reaching this line: https://github.com/imrahil/OctoPrint-PrintHistory/pull/89/files#diff-d1abbc564952b405b12ff83ea2b1043051177cad4d9ae45d61342e16e73b61dbR36

But not this line: https://github.com/imrahil/OctoPrint-PrintHistory/pull/89/files#diff-d1abbc564952b405b12ff83ea2b1043051177cad4d9ae45d61342e16e73b61dbR60

So fileData might be None. If that is the case.

merlindk commented 3 years ago

yes, there is an issue with the metadata, I'm trying to reproduce it myself so I can debug faster but couldn't make the time.

merlindk commented 3 years ago

@guysoft I tried using a folder and it works perfectly on my machine so I'm unable to reproduce the issue. I added some more logging, could you try again?

guysoft commented 3 years ago

Getting now on start of octoprint:

2021-07-27 01:01:58,475 - octoprint.plugin - ERROR - Error while calling plugin printhistory
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugin/__init__.py", line 271, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1941, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_printhistory/__init__.py", line 147, in on_event
    from . import eventHandler
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_printhistory/eventHandler.py", line 50
    if fileData is None:
                       ^
IndentationError: unindent does not match any outer indentation level
guysoft commented 3 years ago

After fixing indentation it seems to be working now, this is the output:

2021-07-27 01:07:38,977 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: ABS/50mm_15degree_sealing_clip.gcode, owner: admin, user: admin
2021-07-27 01:07:38,992 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
2021-07-27 01:07:38,999 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: ABS/50mm_15degree_sealing_clip.gcode, owner: admin, user: admin
2021-07-27 01:07:39,053 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2021-07-27 01:07:39,077 - octoprint.plugins.telegram.TMSG - INFO - get thumbnail url for path=ABS/50mm_15degree_sealing_clip.gcode
2021-07-27 01:07:39,082 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
2021-07-27 01:07:39,090 - octoprint.plugins.telegram.TMSG - INFO - thumbnail =None
2021-07-27 01:07:39,360 - octoprint.plugins.tracking - INFO - Sent tracking event print_started, payload: {'origin': 'local', 'file': '6d36d3278f2efa00cd5a40196daef6189ae5af9f'}
2021-07-27 01:07:41,145 - octoprint.util.comm - INFO - Printer seems to support the busy protocol, will adjust timeouts and set busy interval accordingly
2021-07-27 01:07:43,219 - octoprint.util.comm - INFO - Cancelling job on behalf of user admin
2021-07-27 01:07:43,226 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Cancelling"
2021-07-27 01:07:43,260 - octoprint.printer.standard.job - INFO - Print job cancelled - origin: local, path: ABS/50mm_15degree_sealing_clip.gcode, owner: admin, user: admin
2021-07-27 01:07:43,626 - octoprint.plugins.tracking - INFO - Sent tracking event print_cancelled, payload: {'origin': 'local', 'file': '6d36d3278f2efa00cd5a40196daef6189ae5af9f', 'elapsed': 4}
2021-07-27 01:07:51,347 - octoprint.plugins.printhistory - INFO - fileData not found
2021-07-27 01:07:51,441 - octoprint.plugins.printhistory - INFO - Name: 50mm_15degree_sealing_clip.gcode
2021-07-27 01:07:51,443 - octoprint.plugins.printhistory - INFO - Origin: local
2021-07-27 01:07:51,465 - octoprint.plugins.printhistory - INFO - Path: ABS/50mm_15degree_sealing_clip.gcode
2021-07-27 01:07:51,483 - octoprint.plugins.printhistory - INFO - Path_On_disk: /home/pi/.octoprint/uploads/ABS/50mm_15degree_sealing_clip.gcode
2021-07-27 01:07:51,488 - octoprint.plugins.printhistory - INFO - Got metadata from name
2021-07-27 01:07:51,489 - octoprint.plugins.printhistory - INFO - FileData came out empty, trying to get it from path
2021-07-27 01:07:51,493 - octoprint.plugins.printhistory - INFO - found fileData
2021-07-27 01:07:51,506 - octoprint.plugins.printhistory - INFO - Can't parse additional parameters from /home/pi/.octoprint/uploads/ABS/50mm_15degree_sealing_clip.gcode
2021-07-27 01:07:51,506 - octoprint.plugins.printhistory - INFO - {}
2021-07-27 01:07:51,853 - octoprint.plugins.tracking - INFO - Sent tracking event print_failed, payload: {'origin': 'local', 'file': '6d36d3278f2efa00cd5a40196daef6189ae5af9f', 'elapsed': 4, 'reason': 'cancelled'}

Ill fix the indentation

guysoft commented 3 years ago

Ok, seems to me this is a reason to make a new release - do you want to fix anything else before I tag this?

merlindk commented 3 years ago

yay!!

guysoft commented 3 years ago

Will take that "yay" as a release ready :)