Open foosel opened 8 years ago
@bryantjk I think what @foosel listed out as a possible solution will work really well, and be a lot simpler to manage going forward. I believe right now we are just looking for the file extension to parse out GCODE and STL files. What she's talking about is using Octoprint's common data models to find machinecode
vs model
files. Here's some more info on this: http://docs.octoprint.org/en/master/api/datamodel.html?highlight=machinecode#file-information
Also, Octoprint has a good support for hooks used in plugins that talks about this a little more: http://docs.octoprint.org/en/master/plugins/hooks.html?highlight=machinecode#octoprint-filemanager-extension-tree
I'd like to recreate the environment @foosel mentioned, but I'm not sure where exactly to create a folder to have that reported by the REST API.
Beyond that however, I have a question. I viewed the references for file name/type properties on the links provided, but I'm not seeing that type property in the API calls I'm making: http://docs.octoprint.org/en/master/api/fileops.html#retrieve-all-files or http://docs.octoprint.org/en/master/api/fileops.html#retrieve-a-specific-file-s-information
I'm not quite sure how to make use of the datamodel from the app unless we're talking about creating a plugin or something to expose type to the REST API?
As a starting point however, starting with 1.0.4 I'll continue using the file extension, but only display .gco/.gcode and .stl file types in the library (rather that listing all and displaying an error when other types are selected).
I'm not sure where exactly to create a folder to have that reported by the REST API.
Folder support is currently only available on OctoPrint version 1.3.0rc1 (or the devel
branch), so in order to create one, you'll need to upgrade to that and use that button:
1.3.0 will be released as stable ASAP, hence I mentioned that issue as your app will run into issues otherwise with stable OctoPrint installs soon.
but I'm not seeing that type property in the API calls I'm making
The examples in the docs need an update it seems. Looking into what goes over the line when accessing /api/files
on current stable versions (incl. 1.2.17) should yield something like this:
Note the "type": "model"
and "type": "machinecode"
right at the end of those unfolded entries there.
What I did
Testing against OctoPrint 1.3.0rc1 I noticed a test folder I'd created earlier showed up in the library listing. I clicked on it.
What I expected to happen
To see the listing of the folder OR the folder to not show up in the list in the first place.
What happened instead
I got told that the app only supports gcode or stl files - no problem with that, but then please don't show me files (or folders...) that are not supported :)
Possible solutions
Evaluate the entry
type
provided in the file listing. You probably only want to list entries that are either markedmodel
ormachinecode
and just ignore everything else for now.