stl-thumb icon indicating copy to clipboard operation
stl-thumb copied to clipboard

thumbnailer not working on ascii encoded files in linux

Open scottw-finao opened this issue 4 years ago • 3 comments

I recently installed 'stl-thumb' as a thumbnailer plugin to the file managers, but I notice that it isn't converting all files with the .stl extension. Upon closer inspection using the shell 'file --mime, the files that are "working" are binary encoded STL files but the ones that are not are ascii encoded STL files. Testing the script from the command line, however, shows that it works on both types of files.

Building a wrapper around the stl-thumb binary script archive so I can drop a log, I can see that it is not even attempting to do anything with the ascii encoded files. So I'm assuming it's something at the OS/file-manager level seeing those files as different.

The modified thumbnailer definition file is currently (stlthumbnailer is my wrapper script that simple logs the command being called then grabs any errors - no log entries show up for the ascii encoded stl files):

[Thumbnailer Entry]
TryExec=stlthumbnailer
Exec=stlthumbnailer -f png -s %s %i %o 
MimeType=model/stl;model/x.stl-ascii;model/x.stl-binary;application/sla;

When I pull up properties for both types of files in the file-manager, the mime types listed for both show up as:

Unknown (model/x.stl-binary)

Checking from the command line with file however shows:

$ file --mime *.stl
binary_test.stl:   application/octet-stream; charset=binary
ascii_test.stl: text/plain; charset=us-ascii

$ file -b --mime *.stl
application/octet-stream; charset=binary
text/plain; charset=us-ascii

Again, the thumbnailer script runs on teh binary encoded file, but doesn't appear to be run at all on the ascii encoded one. So I'm assuming it has either something to do with the mime types or the difference in content. Running the script manually on the ascii encoded file does work fine.

I'm not sure what to tweak to get it working properly.

scottw-finao avatar Jun 25 '20 17:06 scottw-finao

Interesting. Thank you for the detailed troubleshooting you have done. This may not be something that we can fix easily. What distro are you running and what file manager are you using?

Also, do you have any other 3D printing applications installed? For instance, there used to be a problem with Cura where it was overwriting the mimetype for STL files and causing problems. https://github.com/Ultimaker/Cura/issues/4141

unlimitedbacon avatar Jun 28 '20 01:06 unlimitedbacon

It seems like it may be specific to certain file managers. I use cinnamon desktop from the old Mint distributions, now supported stand-alone by the community. It uses a file manager called 'nemo'. I fired up nautilus from gnome and and the thumbnailer works on the vast majority of stl files. About the only exceptions I found seemed to be proprietary formatted STLs from goodness knows what software. (on those I just opened them in something like Meshlab and re-exported them to STL) Switching back to nemo after generating the thumbnails in nautilus allows the thumbnails to be 'seen' in nemo, but changing the file will obviously not generate a new one until nautilus is again opened. I tried a few other file managers under linux and got mixed results. Most notable was dolphin which appears to not re So the question now is what nemo is doing differently from nautilus. In the meantime, I'm using nautilus to browse my 3d printer folders.

scottw-finao avatar Jun 29 '20 14:06 scottw-finao