From 07d950e97027df56d06e8628952e5cc4579a932d Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Tue, 18 Oct 2022 21:45:44 +0200 Subject: [PATCH] added feature in the py :) --- tools/esp8266/html/convert.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/esp8266/html/convert.py b/tools/esp8266/html/convert.py index 36877dec..f56ad580 100755 --- a/tools/esp8266/html/convert.py +++ b/tools/esp8266/html/convert.py @@ -1,6 +1,7 @@ import re import os import gzip +import glob from pathlib import Path @@ -62,10 +63,19 @@ def convert2Header(inFile, compress): f.write("#endif /*__{}_{}_H__*/\n".format(define, define2)) f.close() -convert2Header("index.html", True) -convert2Header("setup.html", True) -convert2Header("visualization.html", True) -convert2Header("update.html", True) -convert2Header("serial.html", True) -convert2Header("style.css", True) -convert2Header("api.js", True) +# delete all files in the 'h' dir, but ignore 'favicon_ico_gz.h' +dir = './html/h' +for f in os.listdir(dir): + if not f.startswith('favicon_ico_gz'): + os.remove(os.path.join(dir, f)) + +# grab all files with following extensions +os.chdir('./html') +types = ('*.html', '*.css', '*.js') # the tuple of file types +files_grabbed = [] +for files in types: + files_grabbed.extend(glob.glob(files)) + +# go throw the array +for val in files_grabbed: + convert2Header(val, True) \ No newline at end of file