Event for octoprint.filemanager.analysis


#1

Hello, everybody,
I'm writing a script that monitors my prints on my printer using the events provided by Octoprint. Of course I also want to track the used filament. Now I have seen that after printing, not directly the used filament is indicated. Only after the octoprint.filemanager.analysis has run. Now my question is whether there is an event for this? So that I can retrieve the information again by restapi.

Many thanks and kind regards


#2

Sounds like this is what you're after, I'm guessing.


#3

Thanks for your feedback. Yeah, I'm using that. To my procedure, I have defined it in config.yaml so that it starts a python script after a print job which queries the REST Api GET /api/job. The output is directly after the print job:

progress:
    printTime: 8838
    printTimeLeft: 199
    filepos: 1286627
    completion: 100
    printTimeLeftOrigin: estimate
state: 'Operational'
job:
    lastPrintTime: 8838.380916118622
    estimatedPrintTime: None
    averagePrintTime: 8838.380916118622
    file:
        date: 1531818471
        size: 1286627
        path: Slic3r/Headset_Halterung.gcode
        origin: local
        name: Headset_Halterung.gcode
    filament: None

Only after the filemanager.analysis has run, the filament information is stored in the return of the restApi

2018-07-17 11:35:17,919 - octoprint.filemanager.analysis - INFO - Starting analysis of local:Slic3r/Headset_Halterung.gcode
2018-07-17 11:35:18,026 - octoprint.filemanager.analysis - INFO - Invoking analysis command: /home/pi/oprint/bin/python2 -m octoprint analysis gcode --speed-x=10200 --speed-y=10200 --max-t=10 --throttle=0.0 --throttle-lines=100 /home/pi/.octoprint/uploads/Slic3r/Headset_Halterung.gcode
2018-07-17 11:38:14,030 - octoprint.filemanager.analysis - INFO - Analysis of entry local:Slic3r/Headset_Halterung.gcode finished, needed 176.11s

    averagePrintTime: 8838.380916118622
    lastPrintTime: 8838.380916118622
    filament:
        tool0:
            volume: 24.876429360612516
            length: 10342.417499997622
    file:
        path: Slic3r/Headset_Halterung.gcode
        size: 1286627
        display: Headset_Halterung.gcode
        name: Headset_Halterung.gcode
        origin: local
        date: 1531818471
    estimatedPrintTime: 6523.860684570136
progress:
    printTimeLeft: 199
    completion: 100
    printTimeLeftOrigin: estimate
    filepos: 1286627
    printTime: 8838
state: Operational

#4

Take a look at the MetadataAnalysisFinished event:

http://docs.octoprint.org/en/master/events/index.html#file-handling


#5

That was the solution, thank you very much for the hints!