Compare commits

..

3 commits

Author SHA1 Message Date
quenousimporte
7e33b51819 remove audio 2026-08-18 09:08:48 +02:00
quenousimporte
9690bfa3b1 fix: remove output folder before starting 2026-08-18 09:07:39 +02:00
quenousimporte
ba418101a9 increase font size 2026-08-18 09:07:18 +02:00

View file

@ -14,7 +14,7 @@ htmltemplate = """<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>{title}</title>
<style>
html {{ margin: 20px; }}
html {{ margin: 20px; font-size: large; }}
body {{ margin: auto; max-width: 800px; text-align: justify; }}
audio {{ height: 14px}}
img {{ width: 100% }}
@ -44,6 +44,7 @@ with open(settingsfile, "r", encoding="utf-8") as file:
htmlhome = "<h1>{}</h1><p>{}</p>".format(index['title'], index['description'])
gmihome = "# {}\n{}".format(index['title'], index['description'])
shutil.rmtree('out')
os.makedirs("out/html", exist_ok=True)
os.makedirs("out/gmi", exist_ok=True)
@ -95,20 +96,6 @@ for folderinfo in index['folders']:
htmlhome += "<li><a href=\"{}\">{}</a>&nbsp;[<a href=\"{}\">epub</a>]</li>".format(outfilename.replace('.md', '.html'),filetitle,outfilename.replace('.md', '.epub'))
gmihome += "\n=> {} {}".format(outfilename.replace('.md', '.gmi').replace(' ', '%20'), filetitle)
elif fileextension == ".wav" or fileextension == ".3gp":
# todo use builtin python library
outfilename = unidecode.unidecode(fileroot) + ".mp3"
subprocess.run(["ffmpeg",
"-i",
os.path.join(folderinfo['folder'], filename),
os.path.join('out/html', outfilename)])
htmlhome += "<li>{}</li><audio controls><source src=\"{}\"></audio>".format(filetitle, outfilename)
elif fileextension == ".mp3":
shutil.copy(os.path.join(folderinfo['folder'], filename), os.path.join('out/html', outfilename))
htmlhome += "<li>{}</li><audio controls><source src=\"{}\"></audio>".format(filetitle, outfilename)
htmlhome += "\n</ul>"
with open("out/html/index.html", "w", encoding="utf-8") as htmlindex: