From ebfeb5d51e5e31195053b8ed714762ae6b0d2060 Mon Sep 17 00:00:00 2001 From: Aarontheissueguy Date: Sat, 20 Feb 2021 20:03:09 +0100 Subject: Initial commit --- main.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 main.py (limited to 'main.py') diff --git a/main.py b/main.py new file mode 100644 index 0000000..7dcee82 --- /dev/null +++ b/main.py @@ -0,0 +1,45 @@ +import os +from os import walk +import os.path +from converters.html_to_md import convert_html_to_md +from converters.md_to_gemini import convert_md_to_gemini +from converters.links_to_gemini import convert_links_to_gemini + +dir = "input" + +def wipe_old(): + for root, dirs, files in os.walk("output"): + for file in files: + os.remove(os.path.join(root, file)) + + return "old stuff is gone" + + +def get_paths(dir): + PathList = [] + for thing in os.listdir(dir): + PathList.append(dir + "/" + thing) + try: + PathList += get_paths(dir + "/" + thing) + except: + pass + return PathList + +def get_html(PathList): + HtmlList = [] + for path in PathList: + if ".html" in path: + HtmlList.append(path) + return HtmlList + + +PathList = get_paths(dir) +HtmlList = get_html(PathList) + + +domain = "aaron.place" #Fill in your domain or leave untouched if you dont have one!!! + +print(wipe_old()) +print(convert_html_to_md(HtmlList)) +print(convert_md_to_gemini()) +print(convert_links_to_gemini(domain)) -- cgit v1.2.3