summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorAarontheissueguy2021-02-20 20:03:09 +0100
committerGitHub2021-02-20 20:03:09 +0100
commitebfeb5d51e5e31195053b8ed714762ae6b0d2060 (patch)
treee4bf1a7a59b5e2d7ca5d65abbcd0683d3e0b608a /main.py
Initial commit
Diffstat (limited to 'main.py')
-rw-r--r--main.py45
1 files changed, 45 insertions, 0 deletions
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))