Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnail images don't work in OctoPrint 1.9 release candidates #214

Open
gbeatty opened this issue May 10, 2023 · 16 comments
Open

Thumbnail images don't work in OctoPrint 1.9 release candidates #214

gbeatty opened this issue May 10, 2023 · 16 comments

Comments

@gbeatty
Copy link

gbeatty commented May 10, 2023

The OctoPi builds of OctoPrint 1.9 release candidates 1 through 5 all seem to cause problems for the thumbnail images in PrintJobHistory. All thumbnails show up as the broken link image. Rolling back to 1.8 stable fixes the problem

@pandel
Copy link

pandel commented May 17, 2023

+1

Flask has deprecated the cache_timeout parameter in send_file method, which still seems to be used in the current PrintJobHistoryAPI (line 443).

See also: https://flask.palletsprojects.com/en/2.3.x/api/?highlight=send_file#flask.send_file

Hopefully this will be removed soon.

EDIT:
In the meantime you can fix it yourself by editing the file (make a backup before)

/home/pi/oprint/lib/python3.7/site-packages/octoprint_PrintJobHistory/api/PrintJobHistoryAPI.py

Change line 443 to this:

return send_file(absoluteFilename, mimetype='image/jpg')

Be careful to not remove any whitespace before or after the line! Just remove the , cache_timeout=1 part and restart Octoprint. You're done!

@dojohnso
Copy link

I can confirm @pandel 's solution above resolves the issue of thumbnails not showing up in Octoprint 1.9 (official release version for me)

@dojohnso
Copy link

Not sure if this is still being maintained, but I created a PR to fix this

PR: #216

@clarkiej
Copy link

clarkiej commented May 28, 2023

I had the same problem. I had reimaged with the latest 1.9 release candidate with the new camera stack and restored my plugin backup and had the broken links. I made the change to PrintJobHistoryAPI.py, (my Pi is running Python 3.9):
1

The change brought back all of the broken thumb nails:

4

but any new completed print just shows "No image available" even though the preview is in the gcode and can be read by the file listing:
3

@pandel
Copy link

pandel commented May 29, 2023

@clarkiej strange, that must be something different. In my case, the fix did not interfere with new thumbnails, they appear just fine.

@clarkiej
Copy link

clarkiej commented Jun 2, 2023

After 5 days of "No Image Available" the last two prints I have done have added the image to PrintJobHistory. No rhyme or reason, nothing has been changed, no updates run. No changes to Octoprint. The Pi had been rebooted a number of times without causing the images to appear for over 20 print jobs. Fingers crossed it has sorted itself out internally. I will let you know if it continues.
4

Update 2023-06-04: PrintJobHistory is continuing to imbed the thumbnails into completed prints:
image

All is right with the world again.

@eacxx
Copy link

eacxx commented Jun 3, 2023

One more happy user :)
OctoPrint release 1.9.0
Thank you @pandel

@JeremiahGillis
Copy link

JeremiahGillis commented Jun 29, 2023

but any new completed print just shows "No image available" even though the preview is in the gcode and can be read by the file listing:

I have this exact same issue with OctoPrint 1.9.1 using the new camera stack. My camera stream and snapshot test work fine in the Classic Webcam plugins in settings.

I applied the fix to make my old thumbnails display. All new jobs do not display the thumbnails. They do no not exist in the snapshots directory.

image

Here is a log:

2023-06-28 19:07:47,754 - octoprint.filemanager.analysis - INFO - Starting analysis of local:RoofWireClips.gcode
2023-06-28 19:07:47,781 - octoprint.filemanager.analysis - INFO - Invoking analysis command: /home/pi/oprint/bin/python -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/RoofWireClips.gcode
2023-06-28 19:07:47,920 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: RoofWireClips.gcode, owner: _api, user: _api
2023-06-28 19:07:48,343 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
2023-06-28 19:07:48,490 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: RoofWireClips.gcode, owner: _api, user: _api
2023-06-28 19:07:48,832 - octoprint.plugins.pluginmanager - INFO - Loaded plugin repository data from disk, was still valid
2023-06-28 19:07:49,047 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2023-06-28 19:07:49,109 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
2023-06-28 19:07:49,334 - octoprint.plugins.PrintJobHistory - INFO - PrintJob 'RoofWireClips.gcode' started!
2023-06-28 19:07:49,414 - octoprint.plugins.PrintJobHistory - INFO - Try reading Temperature from PreHeat-Plugin...
2023-06-28 19:07:49,449 - octoprint.plugins.PrintJobHistory - WARNING - ... PreHeat Button Plugin not installed/enabled
2023-06-28 19:07:52,040 - octoprint.plugins.pluginmanager - INFO - Loaded notice data from disk, was still valid
2023-06-28 19:08:49,554 - octoprint.plugins.PrintJobHistory - INFO - Temperature read from Printer Bed: '60.0' Tool tool0: '230.0' after a delay of '60' seconds
2023-06-28 19:17:04,526 - octoprint.util.comm - INFO - Finished in 556.419 s.
2023-06-28 19:17:04,527 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Finishing"
2023-06-28 19:17:04,533 - octoprint.filemanager.analysis - INFO - Starting analysis of local:RoofWireClips.gcode
2023-06-28 19:17:04,564 - octoprint.filemanager.analysis - INFO - Invoking analysis command: /home/pi/oprint/bin/python -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/RoofWireClips.gcode
2023-06-28 19:17:04,579 - octoprint.printer.standard.job - INFO - Print job done - origin: local, path: RoofWireClips.gcode, owner: _api
2023-06-28 19:17:04,791 - octoprint.util.comm - INFO - Changing monitoring state from "Finishing" to "Operational"
2023-06-28 19:17:04,804 - octoprint.plugins.PrintJobHistory - INFO - PrintJob finished!
2023-06-28 19:17:04,824 - octoprint.plugins.PrintJobHistory - INFO - Print result:success, CaptureMode:always
2023-06-28 19:17:04,826 - octoprint.plugins.PrintJobHistory - INFO - ----- Start capturing print job data... -----
2023-06-28 19:17:04,948 - octoprint.plugins.PrintJobHistory.SlicerSettingsParser - INFO - Start parsing Slicer-Settings
2023-06-28 19:17:08,056 - octoprint.filemanager.analysis - INFO - Analysis of entry local:RoofWireClips.gcode finished, needed 3.52s
2023-06-28 19:17:08,332 - octoprint.plugins.PrintJobHistory.SlicerSettingsParser - INFO - Finished parsing Slicer-Settings
2023-06-28 19:17:08,334 - octoprint.plugins.PrintJobHistory - INFO - ----- Start grab Image/thumbnail... -----
2023-06-28 19:17:08,337 - octoprint.settings - WARNING - DeprecationWarning: Detected access to deprecated settings path ['webcam', 'snapshot'], returned value is derived from compatibility overlay. Please use the webcam system introduced with 1.9.0, this compatibility layer will be removed in a future release.
2023-06-28 19:17:08,354 - octoprint.plugins.PrintJobHistory - INFO - Try reading Thumbnail
2023-06-28 19:17:08,359 - octoprint.plugins.PrintJobHistory - WARNING - Thumbnail not found in print metadata
2023-06-28 19:17:08,360 - octoprint.plugins.PrintJobHistory - WARNING - Thumbnail not found for cameraManager
2023-06-28 19:17:08,362 - octoprint.plugins.PrintJobHistory - INFO - ----- Start reading filament -----
2023-06-28 19:17:08,372 - octoprint.plugins.PrintJobHistory - INFO - Try reading filament from FilamentManager...
2023-06-28 19:17:08,381 - octoprint.plugins.PrintJobHistory - INFO -  reading for 'tool0',  Spool: 'Green Grass', Material: 'Pro PLA', Vendor: '3D-Fuel'
2023-06-28 19:17:08,391 - octoprint.plugins.PrintJobHistory - INFO - tool0: usedLength='234.4435199999996'; usedWeight='0.6879613543437313'; usedCost='0.015644241197776448'
2023-06-28 19:17:08,392 - octoprint.plugins.PrintJobHistory - INFO - total: usedTotalLength='234.4435199999996'; usedTotaWeight='0.6879613543437313'; usedTotalCost='0.015644241197776448'
2023-06-28 19:17:08,394 - octoprint.plugins.PrintJobHistory - INFO - ----- Start reading costs -----
2023-06-28 19:17:08,397 - octoprint.plugins.PrintJobHistory - INFO - Costs could not captured, because CostEstimation-Plugin not installed/enabled
2023-06-28 19:17:08,399 - octoprint.plugins.PrintJobHistory - INFO - ----- Try storing printjob model ----
2023-06-28 19:17:08,451 - octoprint.plugins.PrintJobHistory - INFO - ----- ... End PrintJob captured! -----
2023-06-28 19:17:08,509 - octoprint.plugins.filamentmanager - INFO - Updating Filament usage for octoprint configured toolcount: 1
2023-06-28 19:17:08,510 - octoprint.plugins.filamentmanager - INFO - Filament tracked toolcount: 1
2023-06-28 19:17:08,511 - octoprint.plugins.filamentmanager - INFO - Filament tracked values: [234.4435199999996]
2023-06-28 19:17:08,511 - octoprint.plugins.filamentmanager - INFO - Filament used: 234.4435199999996 mm (tool0)
2023-06-28 19:17:08,542 - octoprint.plugins.filamentmanager - INFO - Updated remaining filament on spool 'Green Grass - Pro PLA (3D-Fuel)' from 990.443816626269g to 989.7558552719253g (-0.6879613543437699g)
2023-06-28 19:17:08,855 - octoprint.server.util.flask - WARNING - lastmodified is not timezone aware, cannot check against If-Modified-Since. In the future this will become an error!
2023-06-28 19:17:09,477 - octoprint.server.util.flask - WARNING - lastmodified is not timezone aware, cannot check against If-Modified-Since. In the future this will become an error!

@JeremiahGillis
Copy link

JeremiahGillis commented Jun 29, 2023

Very strange, now it is working correctly on the fourth print. I did not install any new plugins or reboot the system. It looks like the user changed from _api to ggoldfingerd.

image

Here are updated logs with it working:

2023-06-28 19:49:05,184 - octoprint.plugins.PrintJobHistory - INFO - Plugin-State:
| PreHeat=missing (None)
| filamentmanager=enabled (1.9.1)
| DisplayLayerProgress=missing (None)
| SpoolManager=missing (None)
| UltimakerFormat=missing (None)
| PrusaSlicerThumbnail=missing (None)
| costestimation=missing (None)

2023-06-28 19:49:05,298 - octoprint.server.util.flask - INFO - Passively logging in user ggoldfingerd from 192.168.1.123
2023-06-28 19:49:05,299 - octoprint.access.users - INFO - Logged in user: ggoldfingerd
2023-06-28 19:49:09,936 - octoprint.server.util.flask - WARNING - lastmodified is not timezone aware, cannot check against If-Modified-Since. In the future this will become an error!
2023-06-28 19:49:10,123 - octoprint.server.util.sockjs - INFO - User ggoldfingerd logged in on the socket from client 192.168.1.123
2023-06-28 19:49:10,866 - octoprint.server.util.flask - WARNING - lastmodified is not timezone aware, cannot check against If-Modified-Since. In the future this will become an error!
2023-06-28 19:49:20,885 - octoprint.printer.standard.job - INFO - Print job selected - origin: local, path: RoofWireClips.gcode, owner: ggoldfingerd, user: ggoldfingerd
2023-06-28 19:49:20,974 - octoprint.util.comm - INFO - Starting job on behalf of user ggoldfingerd
2023-06-28 19:49:20,983 - octoprint.util.comm - INFO - Changing monitoring state from "Operational" to "Starting"
2023-06-28 19:49:20,995 - octoprint.printer.standard.job - INFO - Print job started - origin: local, path: RoofWireClips.gcode, owner: ggoldfingerd, user: ggoldfingerd
2023-06-28 19:49:21,103 - octoprint.plugins.pluginmanager - INFO - Loaded plugin repository data from disk, was still valid
2023-06-28 19:49:21,229 - octoprint.util.comm - INFO - M110 detected, setting current line number to 0
2023-06-28 19:49:21,283 - octoprint.util.comm - INFO - Changing monitoring state from "Starting" to "Printing"
2023-06-28 19:49:21,280 - octoprint.plugins.PrintJobHistory - INFO - PrintJob 'RoofWireClips.gcode' started!
2023-06-28 19:49:24,003 - octoprint.plugins.pluginmanager - INFO - Loaded notice data from disk, was still valid
2023-06-28 19:49:24,075 - octoprint.util.comm - INFO - Printer seems to support the busy protocol, will adjust timeouts and set busy interval accordingly
2023-06-28 19:49:38,564 - octoprint.util.comm - INFO - Telling the printer to set the busy interval to our "communicationBusy" timeout - 1s = 2s
2023-06-28 19:50:21,389 - octoprint.plugins.PrintJobHistory - INFO - Temperature read from Printer Bed: '60.0' Tool tool0: '230.0' after a delay of '60' seconds
2023-06-28 19:56:44,411 - octoprint.util.comm - INFO - Finished in 443.436 s.
2023-06-28 19:56:44,413 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Finishing"
2023-06-28 19:56:44,430 - octoprint.printer.standard.job - INFO - Print job done - origin: local, path: RoofWireClips.gcode, owner: ggoldfingerd
2023-06-28 19:56:44,573 - octoprint.plugins.PrintJobHistory - INFO - PrintJob finished!
2023-06-28 19:56:44,583 - octoprint.plugins.PrintJobHistory - INFO - Print result:success, CaptureMode:always
2023-06-28 19:56:44,595 - octoprint.plugins.PrintJobHistory - INFO - ----- Start capturing print job data... -----
2023-06-28 19:56:44,628 - octoprint.plugins.PrintJobHistory.SlicerSettingsParser - INFO - Start parsing Slicer-Settings
2023-06-28 19:56:44,644 - octoprint.util.comm - INFO - Changing monitoring state from "Finishing" to "Operational"
2023-06-28 19:56:44,979 - octoprint.plugins.PrintJobHistory.SlicerSettingsParser - DEBUG -  Slicer-Settings:
2023-06-28 19:56:44,980 - octoprint.plugins.PrintJobHistory.SlicerSettingsParser - DEBUG - {'generated by': ' generated by PrusaSlicer 2.6.0+win64 on 2023-06-29 at 01:07:26 UTC\n', 'external perimeters extrusion width': '0.65mm', 'perimeters extrusion width': '0.65mm', 'infill extrusion width': '0.65mm', 'solid infill extrusion width': '0.65mm', 'top infill extrusion width': '0.60mm', 'first layer extrusion width': '0.65mm', 'prusaslicer_config': 'end', 'z_offset': '0', 'xy_size_compensation': '0', 'wiping_volumes_matrix': '0', 'wiping_volumes_extruders': '70,70', 'wipe_tower_y': '125', 'wipe_tower_x': '170', 'wipe_tower_width': '60', 'wipe_tower_rotation_angle': '0', 'wipe_tower_no_sparse_layers': '0', 'wipe_tower_extruder': '0', 'wipe_tower_extra_spacing': '100%', 'wipe_tower_cone_angle': '0', 'wipe_tower_brim_width': '2', 'wipe_tower_bridging': '10', 'wipe_tower': '1', 'wipe_into_objects': '0', 'wipe_into_infill': '0', 'wipe': '1', 'wall_transition_length': '100%', 'wall_transition_filter_deviation': '25%', 'wall_transition_angle': '10', 'wall_distribution_count': '1', 'variable_layer_height': '1', 'use_volumetric_e': '0', 'use_relative_e_distances': '1', 'use_firmware_retraction': '0', 'travel_speed_z': '12', 'travel_speed': '180', 'travel_acceleration': '0', 'top_solid_min_thickness': '0.9', 'top_solid_layers': '6', 'top_solid_infill_speed': '45', 'top_solid_infill_acceleration': '0', 'top_infill_extrusion_width': '0.6', 'top_fill_pattern': 'monotoniclines', 'toolchange_gcode': '', 'thumbnails_format': 'PNG', 'thumbnails': '', 'threads': '32', 'thin_walls': '0', 'thick_bridges': '0', 'template_custom_gcode': '', 'temperature': '225', 'support_tree_top_rate': '15%', 'support_tree_tip_diameter': '0.8', 'support_tree_branch_distance': '1', 'support_tree_branch_diameter_double_wall': '0', 'support_tree_branch_diameter_angle': '5', 'support_tree_branch_diameter': '2', 'support_tree_angle_slow': '25', 'support_tree_angle': '40', 'support_material_xy_spacing': '80%', 'support_material_with_sheath': '0', 'support_material_threshold': '50', 'support_material_synchronize_layers': '0', 'support_material_style': 'grid', 'support_material_speed': '50', 'support_material_spacing': '2', 'support_material_pattern': 'rectilinear', 'support_material_interface_speed': '80%', 'support_material_interface_spacing': '0.3', 'support_material_interface_pattern': 'rectilinear', 'support_material_interface_layers': '2', 'support_material_interface_extruder': '0', 'support_material_interface_contact_loops': '0', 'support_material_extrusion_width': '0.55', 'support_material_extruder': '0', 'support_material_enforce_layers': '0', 'support_material_contact_distance': '0.22', 'support_material_closing_radius': '2', 'support_material_buildplate_only': '0', 'support_material_bottom_interface_layers': '0', 'support_material_bottom_contact_distance': '0', 'support_material_auto': '1', 'support_material_angle': '0', 'support_material': '0', 'start_gcode': 'M862.3 P "[printer_model]" ; printer model check\\nM862.1 P[nozzle_diameter] ; nozzle diameter check\\nM115 U3.8.1 ; tell printer latest fw version\\nG90 ; use absolute coordinates\\nM83 ; extruder relative mode\\nM104 S[first_layer_temperature] ; set extruder temp\\nM140 S[first_layer_bed_temperature] ; set bed temp\\nM190 S[first_layer_bed_temperature] ; wait for bed temp\\nM109 S[first_layer_temperature] ; wait for extruder temp\\nM916 Y40; lower Y axis crash sensitivity\\nG28 W ; home all without mesh bed level\\nG80 ; mesh bed leveling\\nG1 Y-3.0 F1000.0 ; go outside print area\\nG92 E0.0\\nG1 X60.0 E9.0 F1000.0 ; intro line\\nG1 X100.0 E12.5 F1000.0 ; intro line\\nG92 E0.0\\nM221 S{if layer_height<0.075}100{else}95{endif}', 'start_filament_gcode': '"M900 K0.04"', 'standby_temperature_delta': '-5', 'staggered_inner_seams': '0', 'spiral_vase': '0', 'solid_infill_speed': '70', 'solid_infill_extrusion_width': '0.65', 'solid_infill_extruder': '1', 'solid_infill_every_layers': '0', 'solid_infill_below_area': '0', 'solid_infill_acceleration': '0', 'small_perimeter_speed': '25', 'slowdown_below_layer_time': '20', 'slicing_mode': 'regular', 'slice_closing_radius': '0.049', 'skirts': '1', 'skirt_height': '3', 'skirt_distance': '2', 'single_extruder_multi_material_priming': '0', 'single_extruder_multi_material': '0', 'silent_mode': '1', 'seam_position': 'aligned', 'retract_speed': '35', 'retract_restart_extra_toolchange': '0', 'retract_restart_extra': '0', 'retract_lift_below': '209', 'retract_lift_above': '0', 'retract_lift': '0.35', 'retract_length_toolchange': '4', 'retract_length': '0.8', 'retract_layer_change': '1', 'retract_before_wipe': '0%', 'retract_before_travel': '1', 'resolution': '0', 'remaining_times': '1', 'raft_layers': '0', 'raft_first_layer_expansion': '3', 'raft_first_layer_density': '90%', 'raft_expansion': '1.5', 'raft_contact_distance': '0.2', 'printer_vendor': '', 'printer_variant': '0.4', 'printer_technology': 'FFF', 'printer_settings_id': 'Original Prusa i3 MK3S 0.6 OctoPrint', 'printer_notes': 'Don\'t remove the following keywords! These keywords are used in the "compatible printer" condition of the print and filament profiles to link the particular print and filament profiles to this printer profile.\\nPRINTER_VENDOR_PRUSA3D\\nPRINTER_MODEL_MK3\\n', 'printer_model': 'MK3S', 'print_settings_id': '0.15mm DETAIL @0.6 nozzle MK3', 'post_process': '', 'physical_printer_settings_id': 'MK3S', 'perimeters': '2', 'perimeter_speed': '45', 'perimeter_generator': 'arachne', 'perimeter_extrusion_width': '0.65', 'perimeter_extruder': '1', 'perimeter_acceleration': '800', 'pause_print_gcode': 'M601', 'parking_pos_retraction': '92', 'overhangs': '1', 'overhang_speed_3': '25', 'overhang_speed_2': '20', 'overhang_speed_1': '15', 'overhang_speed_0': '15', 'overhang_fan_speed_3': '0', 'overhang_fan_speed_2': '0', 'overhang_fan_speed_1': '0', 'overhang_fan_speed_0': '0', 'output_filename_format': '{input_filename_base}_{nozzle_diameter[initial_tool]}n_{layer_height}mm_{printing_filament_types}_{printer_model}_{print_time}.gcode', 'ooze_prevention': '0', 'only_retract_when_crossing_perimeters': '0', 'nozzle_diameter': '0.6', 'notes': '', 'mmu_segmented_region_max_width': '0', 'min_skirt_length': '4', 'min_print_speed': '15', 'min_layer_height': '0.07', 'min_feature_size': '25%', 'min_fan_speed': '100', 'min_bead_width': '85%', 'max_volumetric_speed': '0', 'max_volumetric_extrusion_rate_slope_positive': '0', 'max_volumetric_extrusion_rate_slope_negative': '0', 'max_print_speed': '100', 'max_print_height': '210', 'max_layer_height': '0.25', 'max_fan_speed': '100', 'machine_min_travel_rate': '0,0', 'machine_min_extruding_rate': '0,0', 'machine_max_jerk_z': '0.4,0.4', 'machine_max_jerk_y': '8,8', 'machine_max_jerk_x': '8,8', 'machine_max_jerk_e': '4.5,4.5', 'machine_max_feedrate_z': '12,12', 'machine_max_feedrate_y': '200,100', 'machine_max_feedrate_x': '200,100', 'machine_max_feedrate_e': '120,120', 'machine_max_acceleration_z': '1000,1000', 'machine_max_acceleration_y': '1000,960', 'machine_max_acceleration_x': '1000,960', 'machine_max_acceleration_travel': '1500,1250', 'machine_max_acceleration_retracting': '1250,1250', 'machine_max_acceleration_extruding': '1250,1250', 'machine_max_acceleration_e': '5000,5000', 'machine_limits_usage': 'emit_to_gcode', 'layer_height': '0.15', 'layer_gcode': ';AFTER_LAYER_CHANGE\\n;[layer_z]', 'ironing_type': 'top', 'ironing_speed': '15', 'ironing_spacing': '0.1', 'ironing_flowrate': '15%', 'ironing': '0', 'interface_shells': '0', 'inherits_cummulative': ';"Prusament PLA";"Original Prusa i3 MK3S"', 'infill_speed': '70', 'infill_overlap': '15%', 'infill_first': '0', 'infill_extrusion_width': '0.65', 'infill_extruder': '1', 'infill_every_layers': '1', 'infill_anchor_max': '15', 'infill_anchor': '2.5', 'infill_acceleration': '1000', 'host_type': 'octoprint', 'high_current_on_filament_swap': '0', 'gcode_substitutions': '', 'gcode_resolution': '0.0125', 'gcode_label_objects': '1', 'gcode_flavor': 'marlin', 'gcode_comments': '0', 'gap_fill_speed': '40', 'gap_fill_enabled': '1', 'fuzzy_skin_thickness': '0.3', 'fuzzy_skin_point_dist': '0.8', 'fuzzy_skin': 'none', 'full_fan_speed_layer': '0', 'first_layer_temperature': '230', 'first_layer_speed_over_raft': '30', 'first_layer_speed': '20', 'first_layer_height': '0.2', 'first_layer_extrusion_width': '0.65', 'first_layer_bed_temperature': '60', 'first_layer_acceleration_over_raft': '0', 'first_layer_acceleration': '800', 'fill_pattern': 'gyroid', 'fill_density': '15%', 'fill_angle': '45', 'filament_vendor': 'Prusa Polymers', 'filament_unloading_speed_start': '100', 'filament_unloading_speed': '90', 'filament_unload_time': '0', 'filament_type': 'PLA', 'filament_toolchange_delay': '0', 'filament_spool_weight': '0', 'filament_soluble': '0', 'filament_settings_id': '"3D-Fuel Pro PLA Custom"', 'filament_ramming_parameters': '"120 100 6.6 6.8 7.2 7.6 7.9 8.2 8.7 9.4 9.9 10.0| 0.05 6.6 0.45 6.8 0.95 7.8 1.45 8.3 1.95 9.7 2.45 10 2.95 7.6 3.45 7.6 3.95 7.6 4.45 7.6 4.95 7.6"', 'filament_notes': '"Affordable filament for everyday printing in premium quality manufactured in-house by Josef Prusa"', 'filament_minimal_purge_on_wipe_tower': '15', 'filament_max_volumetric_speed': '15', 'filament_loading_speed_start': '3', 'filament_loading_speed': '28', 'filament_load_time': '0', 'filament_diameter': '1.75', 'filament_density': '1.24', 'filament_cost': '22.744', 'filament_cooling_moves': '4', 'filament_cooling_initial_speed': '2.2', 'filament_cooling_final_speed': '3.4', 'filament_colour': '#A0A0A0', 'fan_below_layer_time': '100', 'fan_always_on': '1', 'extrusion_width': '0.65', 'extrusion_multiplier': '1.05', 'extrusion_axis': 'E', 'extruder_offset': '0x0', 'extruder_colour': '""', 'extruder_clearance_radius': '45', 'extruder_clearance_height': '20', 'extra_perimeters_on_overhangs': '0', 'extra_perimeters': '0', 'extra_loading_move': '-2', 'external_perimeters_first': '0', 'external_perimeter_speed': '35', 'external_perimeter_extrusion_width': '0.65', 'external_perimeter_acceleration': '0', 'end_gcode': 'G4 ; wait\\nM221 S100\\nM104 S0 ; turn off temperature\\nM140 S0 ; turn off heatbed\\nM107 ; turn off fan\\n{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+30, max_print_height)}{endif} ; Move print head up\\nG1 X0 Y200 F3000 ; home X axis\\nM84 ; disable motors', 'end_filament_gcode': '"; Filament-specific end gcode"', 'enable_dynamic_overhang_speeds': '1', 'enable_dynamic_fan_speeds': '0', 'elefant_foot_compensation': '0.2', 'duplicate_distance': '6', 'draft_shield': 'disabled', 'dont_support_bridges': '0', 'disable_fan_first_layers': '1', 'deretract_speed': '0', 'default_print_profile': '0.15mm QUALITY @MK3', 'default_filament_profile': '"Prusament PLA"', 'default_acceleration': '1000', 'cooling_tube_retraction': '91.5', 'cooling_tube_length': '5', 'cooling': '1', 'complete_objects': '0', 'compatible_printers_condition_cummulative = "printer_notes=~/.*PRINTER_VENDOR_PRUSA3D.*/ and printer_notes=~/.*PRINTER_MODEL_MK3.*/ and nozzle_diameter[0]=': '0.6";', 'color_change_gcode': 'M600', 'brim_width': '0', 'brim_type': 'outer_only', 'brim_separation': '0.1', 'bridge_speed': '25', 'bridge_flow_ratio': '1', 'bridge_fan_speed': '100', 'bridge_angle': '0', 'bridge_acceleration': '1000', 'bottom_solid_min_thickness': '0.6', 'bottom_solid_layers': '5', 'bottom_fill_pattern': 'monotonic', 'between_objects_gcode': '', 'before_layer_gcode': ';BEFORE_LAYER_CHANGE\\nG92 E0.0\\n;[layer_z]\\n\\n', 'bed_temperature': '60', 'bed_shape': '0x0,250x0,250x210,0x210', 'bed_custom_texture': '', 'bed_custom_model': '', 'avoid_crossing_perimeters_max_detour': '0', 'avoid_crossing_perimeters': '0', 'avoid_crossing_curled_overhangs': '0', 'autoemit_temperature_commands': '1', 'estimated first layer printing time (silent mode)': '24s', 'estimated first layer printing time (normal mode)': '24s', 'estimated printing time (silent mode)': '6m 24s', 'estimated printing time (normal mode)': '6m 18s', 'total filament cost': '0.02', 'total filament used [g]': '0.70', 'filament cost': '0.02', 'filament used [g]': '0.70', 'filament used [cm3]': '0.56', 'filament used [mm]': '234.44'}
2023-06-28 19:56:44,983 - octoprint.plugins.PrintJobHistory.SlicerSettingsParser - INFO - Finished parsing Slicer-Settings
2023-06-28 19:56:44,988 - octoprint.plugins.PrintJobHistory - INFO - ----- Start grab Image/thumbnail... -----
2023-06-28 19:56:44,990 - octoprint.settings - WARNING - DeprecationWarning: Detected access to deprecated settings path ['webcam', 'snapshot'], returned value is derived from compatibility overlay. Please use the webcam system introduced with 1.9.0, this compatibility layer will be removed in a future release.
2023-06-28 19:56:45,009 - octoprint.plugins.PrintJobHistory - INFO - Try reading Thumbnail
2023-06-28 19:56:45,013 - octoprint.plugins.PrintJobHistory - WARNING - Thumbnail not found in print metadata
2023-06-28 19:56:45,018 - octoprint.plugins.PrintJobHistory - WARNING - Thumbnail not found for cameraManager
2023-06-28 19:56:45,021 - octoprint.plugins.PrintJobHistory - INFO - Try capturing snapshot asyc
2023-06-28 19:56:45,026 - octoprint.settings - WARNING - DeprecationWarning: Detected access to deprecated settings path ['webcam', 'snapshot'], returned value is derived from compatibility overlay. Please use the webcam system introduced with 1.9.0, this compatibility layer will be removed in a future release.
2023-06-28 19:56:45,028 - octoprint.plugins.PrintJobHistory - INFO - ----- Start reading filament -----
2023-06-28 19:56:45,032 - octoprint.plugins.PrintJobHistory.CameraManager - INFO - Try taking snapshot '/home/pi/.octoprint/data/PrintJobHistory/snapshots/20230628-194921.jpg' from 'http://127.0.0.1:8080/?action=snapshot'
2023-06-28 19:56:45,042 - octoprint.plugins.PrintJobHistory - INFO - Try reading filament from FilamentManager...
2023-06-28 19:56:45,090 - octoprint.plugins.PrintJobHistory - INFO -  reading for 'tool0',  Spool: 'Green Grass', Material: 'Pro PLA', Vendor: '3D-Fuel'
2023-06-28 19:56:45,128 - octoprint.plugins.PrintJobHistory - INFO - tool0: usedLength='234.4435199999996'; usedWeight='0.6879613543437313'; usedCost='0.015644241197776448'
2023-06-28 19:56:45,139 - octoprint.plugins.PrintJobHistory - INFO - total: usedTotalLength='234.4435199999996'; usedTotaWeight='0.6879613543437313'; usedTotalCost='0.015644241197776448'
2023-06-28 19:56:45,148 - octoprint.plugins.PrintJobHistory - INFO - ----- Start reading costs -----
2023-06-28 19:56:45,163 - octoprint.plugins.PrintJobHistory - INFO - Costs could not captured, because CostEstimation-Plugin not installed/enabled
2023-06-28 19:56:45,164 - octoprint.plugins.PrintJobHistory - INFO - ----- Try storing printjob model ----
2023-06-28 19:56:45,229 - octoprint.plugins.PrintJobHistory - INFO - ----- ... End PrintJob captured! -----
2023-06-28 19:56:45,290 - octoprint.plugins.filamentmanager - INFO - Updating Filament usage for octoprint configured toolcount: 1
2023-06-28 19:56:45,291 - octoprint.plugins.filamentmanager - INFO - Filament tracked toolcount: 1
2023-06-28 19:56:45,291 - octoprint.plugins.filamentmanager - INFO - Filament tracked values: [234.4435199999996]
2023-06-28 19:56:45,292 - octoprint.plugins.filamentmanager - INFO - Filament used: 234.4435199999996 mm (tool0)
2023-06-28 19:56:45,326 - octoprint.plugins.PrintJobHistory.CameraManager - INFO - Process snapshot image
2023-06-28 19:56:45,334 - octoprint.plugins.filamentmanager - INFO - Updated remaining filament on spool 'Green Grass - Pro PLA (3D-Fuel)' from 989.7558552719253g to 989.0678939175816g (-0.6879613543436562g)
2023-06-28 19:56:45,518 - octoprint.server.util.flask - WARNING - lastmodified is not timezone aware, cannot check against If-Modified-Since. In the future this will become an error!
2023-06-28 19:56:45,653 - octoprint.server.util.flask - WARNING - lastmodified is not timezone aware, cannot check against If-Modified-Since. In the future this will become an error!

@Titius-Sicanus
Copy link

I've been having problems detecting thumbnails when printing was completed for a long time.
Some were mined while others were not.
Eventually I found that the thumbnail not extracting depends on the file name.
If the file name contains spaces or special characters then the thumbnail is not extracted.
The only characters I've found allowed are the minus sign (-) and the underscore character (_)

While I find the decision not to allow the presence of special characters in the file name to be partially acceptable, I find the ban on the use of space unacceptable.

@CowwolfeSoftware
Copy link

+1

Flask has deprecated the cache_timeout parameter in send_file method, which still seems to be used in the current PrintJobHistoryAPI (line 443).

See also: https://flask.palletsprojects.com/en/2.3.x/api/?highlight=send_file#flask.send_file

Hopefully this will be removed soon.

EDIT: In the meantime you can fix it yourself by editing the file (make a backup before)

/home/pi/oprint/lib/python3.7/site-packages/octoprint_PrintJobHistory/api/PrintJobHistoryAPI.py

Change line 443 to this:

return send_file(absoluteFilename, mimetype='image/jpg')

Be careful to not remove any whitespace before or after the line! Just remove the , cache_timeout=1 part and restart Octoprint. You're done!

After putting in this fix, I found that my history images are now upside down (flipped). I do have the setting for my camera set to flip horizontally and vertically so that they appear correctly when I monitor my camera. The new images stored and my history images are now upside down.

image

@morris2009
Copy link

FYI: The fix worked for me!
tnx!

@HarikrishnanBalagopal
Copy link

HarikrishnanBalagopal commented Aug 2, 2023

+1

Flask has deprecated the cache_timeout parameter in send_file method, which still seems to be used in the current PrintJobHistoryAPI (line 443).

See also: https://flask.palletsprojects.com/en/2.3.x/api/?highlight=send_file#flask.send_file

Hopefully this will be removed soon.

EDIT: In the meantime you can fix it yourself by editing the file (make a backup before)

/home/pi/oprint/lib/python3.7/site-packages/octoprint_PrintJobHistory/api/PrintJobHistoryAPI.py

Change line 443 to this:

return send_file(absoluteFilename, mimetype='image/jpg')

Be careful to not remove any whitespace before or after the line! Just remove the , cache_timeout=1 part and restart Octoprint. You're done!

I have the same issue, here's the logs from /home/pi/.octoprint/logs/octoprint.log

2023-08-02 11:54:17,735 - octoprint - ERROR - Exception on /plugin/PrintJobHistory/printJobSnapshot/20230802-113600.jpg [GET]
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.9/site-packages/flask/app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/pi/oprint/lib/python3.9/site-packages/flask/app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/pi/oprint/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/pi/oprint/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint/util/__init__.py", line 1686, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.9/site-packages/octoprint_PrintJobHistory/api/PrintJobHistoryAPI.py", line 443, in get_snapshot
    return send_file(absoluteFilename, mimetype='image/jpg', cache_timeout=1)
TypeError: send_file() got an unexpected keyword argument 'cache_timeout'

@HarikrishnanBalagopal
Copy link

Depending on your Python version you will have to change the path
/home/pi/oprint/lib/python3.7/site-packages/octoprint_PrintJobHistory/api/PrintJobHistoryAPI.py
to
/home/pi/oprint/lib/python3.9/site-packages/octoprint_PrintJobHistory/api/PrintJobHistoryAPI.py
for Python 3.9 for example

@dojohnso
Copy link

dojohnso commented Aug 2, 2023

I'm told @OllisGit is back from a dev sabbatical so hopefully my PR will see some movement, along with other bugs.

@dojohnso
Copy link

@gbeatty @pandel @clarkiej

Sorry for the spam hit but wanted to make sure folks see this. I think i solved the new issue found around file names breaking thumbnails. please see this PR and comment as necessary. #226

can't wait to see what's next that I need to fix for this..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants