|
|
@ -5,15 +5,15 @@ import os
|
|
|
|
import fnmatch
|
|
|
|
import fnmatch
|
|
|
|
|
|
|
|
|
|
|
|
#create the log directory
|
|
|
|
#create the log directory
|
|
|
|
path = "/home/xpub/www/html/tl-dr/logs"
|
|
|
|
path = "/home/xpub/www/html/tl-dr/log-books"
|
|
|
|
if not os.path.exists(path):
|
|
|
|
if not os.path.exists(path):
|
|
|
|
os.makedirs(path)
|
|
|
|
os.makedirs(path)
|
|
|
|
# TODO: check sorting of these files (should be chronological)
|
|
|
|
# TODO: check sorting of these files (should be chronological)
|
|
|
|
# Getting the dynamic variables
|
|
|
|
# Getting the dynamic variables
|
|
|
|
log_files = fnmatch.filter(os.listdir(path), '*.html')
|
|
|
|
log_files = fnmatch.filter(os.listdir(path), '*.epub')
|
|
|
|
now = datetime.today()
|
|
|
|
now = datetime.today()
|
|
|
|
next_report = now + timedelta(hours=3)
|
|
|
|
next_report = now + timedelta(hours=3)
|
|
|
|
log_file_name = "log_" + now.strftime("%Y-%m-%d_%H:%M:%S") + ".html"
|
|
|
|
log_file_name = "TL;DR_" + now.strftime("%B %dth %Y")
|
|
|
|
|
|
|
|
|
|
|
|
def create_all_logs_file():
|
|
|
|
def create_all_logs_file():
|
|
|
|
list_logs = subprocess.run(["ls", "/home/xpub/www/html/tl-dr/log-books"], capture_output=True)
|
|
|
|
list_logs = subprocess.run(["ls", "/home/xpub/www/html/tl-dr/log-books"], capture_output=True)
|
|
|
@ -108,7 +108,7 @@ with open("/home/xpub/www/html/tl-dr/book.html", "w") as f:
|
|
|
|
"--epub-embed-font='/home/xpub/www/html/tl-dr/fonts/Cascadia/ttf/CascadiaCode-Light.ttf'"
|
|
|
|
"--epub-embed-font='/home/xpub/www/html/tl-dr/fonts/Cascadia/ttf/CascadiaCode-Light.ttf'"
|
|
|
|
"--epub-embed-font='/home/xpub/www/html/tl-dr/fonts/Ductus/DuctusRegular.woff'"], capture_output=True)
|
|
|
|
"--epub-embed-font='/home/xpub/www/html/tl-dr/fonts/Ductus/DuctusRegular.woff'"], capture_output=True)
|
|
|
|
print("just generated a new book, also put it in the backlog of logs")
|
|
|
|
print("just generated a new book, also put it in the backlog of logs")
|
|
|
|
subprocess.run(["cp", "/home/xpub/www/html/tl-dr/logged_book.epub", "/home/xpub/www/html/tl-dr/log-books/log_" + now.strftime("%Y-%m-%d_%H%M%S") + ".epub"], capture_output=True)
|
|
|
|
subprocess.run(["cp", "/home/xpub/www/html/tl-dr/logged_book.epub", "/home/xpub/www/html/tl-dr/log-books/" + log_file_name + ".epub"], capture_output=True)
|
|
|
|
create_all_logs_file();
|
|
|
|
create_all_logs_file();
|
|
|
|
print("Finished");
|
|
|
|
print("Finished");
|
|
|
|
|
|
|
|
|
|
|
|