From cdc6923a251096eab02e8844e85e5269a7751630 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Wed, 19 Feb 2025 17:48:54 +0100 Subject: [PATCH] convert audio files (need ffmpeg) --- publish.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/publish.py b/publish.py index 3636141..051ea25 100644 --- a/publish.py +++ b/publish.py @@ -3,6 +3,7 @@ import re import markdown import yaml import shutil +import subprocess htmltemplate = """ @@ -76,9 +77,19 @@ for folderinfo in index['folders']: htmlhome += "
  • {}
  • ".format(filename.replace('.md', '.html'), filetitle) gmihome += "\n=> {} {}".format(filename.replace('.md', '.gmi').replace(' ', '%20'), filetitle) - else: + elif fileextension == ".wav" or fileextension == ".3gp": # sounds + # todo: add a property for dest file (to remove accents) + + # todo use builtin library + subprocess.run(["ffmpeg", + "-i", + os.path.join(folderinfo['folder'], filename), + os.path.join('out/html', fileroot + ".mp3")]) + htmlhome += "
  • {}
  • ".format(filetitle, filename) + + elif fileextension == ".mp3": shutil.copy(os.path.join(folderinfo['folder'], filename), 'out/html') htmlhome += "
  • {}
  • ".format(filetitle, filename)