Compare commits

..

No commits in common. "7e33b5181912d7274419c729a2208824f306467d" and "0ecac665de83e027256fa762ba2f368de5a6a87a" have entirely different histories.

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"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>{title}</title> <title>{title}</title>
<style> <style>
html {{ margin: 20px; font-size: large; }} html {{ margin: 20px; }}
body {{ margin: auto; max-width: 800px; text-align: justify; }} body {{ margin: auto; max-width: 800px; text-align: justify; }}
audio {{ height: 14px}} audio {{ height: 14px}}
img {{ width: 100% }} img {{ width: 100% }}
@ -44,7 +44,6 @@ with open(settingsfile, "r", encoding="utf-8") as file:
htmlhome = "<h1>{}</h1><p>{}</p>".format(index['title'], index['description']) htmlhome = "<h1>{}</h1><p>{}</p>".format(index['title'], index['description'])
gmihome = "# {}\n{}".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/html", exist_ok=True)
os.makedirs("out/gmi", exist_ok=True) os.makedirs("out/gmi", exist_ok=True)
@ -96,6 +95,20 @@ 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')) 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) 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>" htmlhome += "\n</ul>"
with open("out/html/index.html", "w", encoding="utf-8") as htmlindex: with open("out/html/index.html", "w", encoding="utf-8") as htmlindex: