Initial import
This commit is contained in:
		
							
								
								
									
										23
									
								
								stl_thumb_generator.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								stl_thumb_generator.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,23 @@ | |||||||
|  | local lfs = require"lfs" | ||||||
|  | local rootpath = '/home/media/modeles_3D/' | ||||||
|  |  | ||||||
|  | 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 | ||||||
|  |       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 | ||||||
|  |  | ||||||
|  | print("Starting ...", os.date() ) | ||||||
|  | parse_one_level(rootpath) | ||||||
|  | print("End ...", os.date() ) | ||||||
|  |  | ||||||
		Reference in New Issue
	
	Block a user