From bc14b1b756d86b3b9bc3a886b6385291f8366971 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 1 Feb 2021 18:29:17 +0100 Subject: [PATCH] Initial import --- stl_thumb_generator.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/stl_thumb_generator.lua b/stl_thumb_generator.lua index d75aef8..7a1320c 100644 --- a/stl_thumb_generator.lua +++ b/stl_thumb_generator.lua @@ -5,15 +5,17 @@ local cmd = 'stl-thumb' local function parse_one_level( path ) for myfile in lfs.dir(path) do - local attr = lfs.attributes (myfile) - if attr.mode == "directory" then - print("Entering sub folder : ", myfile) - parse_one_level( myfile) - elseif string.match(myfile, "%.stl") or string.match(myfile, "%.STL") then - print("Thumbnail for : ", myfile) - local fullname = rootpath .. myfile - local fullcmd = cmd .. " --format JPG --size 512 " .. fullname .. " " .. fullname .. ".jpg" - os.execute( fullcmd ) + if myfile ~= "." and myfile ~= ".." then + local attr = lfs.attributes (myfile) + if attr.mode == "directory" then + print("Entering sub folder : ", myfile) + parse_one_level( myfile) + elseif string.match(myfile, "%.stl") or string.match(myfile, "%.STL") then + print("Thumbnail for : ", myfile) + local fullname = rootpath .. myfile + local fullcmd = cmd .. " --format JPG --size 512 " .. fullname .. " " .. fullname .. ".jpg" + os.execute( fullcmd ) + end end end end