Robo3D / Robo-iOS-Beta

1 stars 0 forks source link

Folders are listed, albeit unsupported in Library #21

Open foosel opened 8 years ago

foosel commented 8 years ago

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 marked model or machinecode and just ignore everything else for now.

AllenMcAfee commented 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

bryantjk commented 8 years ago

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).

foosel commented 8 years ago

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:

image

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:

image

Note the "type": "model" and "type": "machinecode" right at the end of those unfolded entries there.