summaryrefslogtreecommitdiff
path: root/FBGM.py
diff options
context:
space:
mode:
Diffstat (limited to 'FBGM.py')
-rw-r--r--FBGM.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/FBGM.py b/FBGM.py
index 99cb4bf..b269177 100644
--- a/FBGM.py
+++ b/FBGM.py
@@ -1,8 +1,18 @@
from ftplib import parse150
import os, sys
-def txthandler(path):
- f = open(path)
+def txthandler(path, filename):
+ f = open(path, "r")
+ contents = f.read()
+ filename.write('<!DOCTYPE html>'
+'<html lang ="en">'
+ '<head>'
+ '<title>'+contents[0:contents.rfind('\n')]+'</title>'
+ '<link rel="stylesheet" type="text/css" href="stylesheet.css">'
+ '<link rel="icon" type="image/x-icon" href="images/favicon.ico">'
+ '<meta charset="utf-8"/>'
+ '</head>'
+'</html>')
print(f.read())
return 0
@@ -17,17 +27,25 @@ def dochandler(path):
print(f.read())
return 0
-#Attempting to pass docx file in path
-path = 'C:/Users/a big fuck/Downloads/beans.docx'
+#Attempting to pass txt file in path
+path = 'C:/Users/a big fuck/Documents/beansandtoast.txt'
extension = path[path.rfind('.')+1: len(path)]
-print(extension)
+filename = path[path.rfind('/')+1: path.rfind('.')]
+
+
+if os.path.exists(filename+".html") == True:
+ os.remove(filename+".html")
+
+htmlfile = open(filename+".html", "x")
+
+
if extension =='txt':
- txthandler(path)
+ txthandler(path, htmlfile)
elif extension == 'pdf':
pdfhandler(path)