Like to add custom metadata to file and show it is the GUI

Hi,

I plan to add additional data to the file that beside the filament length also information about the spool is shown like (material: PLA, name: Blabla,...)

I checked the API and found set_additional_metadata in the filemanager API (octoprint.filemanager — OctoPrint master documentation). But to avoid creating everything I am sure that there is another plugin adding metainformation to the uploaded file. Does anybody know if there is some out?

Cheers,
Nils

Not sure if it has all the details, but PrintJobHistory in combination with SpoolManager may get you where you want to be? But to answer your question, my thumbnail plugins use this option to add thumbnail url to the metadata and changes the web UI to allow showing the thumbnail in the file list.

Perfect...will take a look.

@fieldOfView added variables to Cura for me to add material name,... in Gcode. I plan to enhance my plugin that it also adds this to the Gcode metadata which can be read from SpoolManager, ... in the future or simply shows for which material the Gcode was generated. That was a feature I missed...

I did some investigation and I have to overwrite the filesViewModel Method getAdditionalData.
https://docs.octoprint.org/en/master/plugins/viewmodels.html#registering-custom-viewmodels

I handled to overwrite the function generated the HTML code but I cannot merge the content. If I tried I does not see the string returned I see an "object Object" Text. I am totally not familiar with JS so what is going wrong? How can I convert the object (if everything is right) to a string that I can add some lines? I am sure this must be very easy. :slight_smile:

You shouldn't have to do that, you should be able to inject your own text bits to the view model and just make sure that their binding is to the original scope. Here's an example for the inline thumbnail.