create a list of all logs file

main
vitrinekast 9 months ago
parent 50933eb419
commit 76858070f5

@ -15,6 +15,12 @@ now = datetime.today()
next_report = now + timedelta(hours=3)
log_file_name = "log_" + now.strftime("%Y-%m-%d_%H:%M:%S") + ".html"
def create_all_logs_file():
list_logs = subprocess.run(["ls", "log-books"], capture_output=True)
with open("/log-books/all.txt", "w") as f:
print(list_logs.stdout.decode('UTF-8').strip(), file=f)
# Execute a command on the command line. Based = used for piped commands
def run_command(command, based = False):
result = subprocess.run(command, capture_output=True, input=based)
@ -95,7 +101,8 @@ with open("book.html", "w") as f:
print(output, file=f)
subprocess.run(["pandoc", "book.html", "-o", "logged_book.epub", "-c", "print.css", "--metadata", "title="+log_file_name], capture_output=True)
print("just generated a new book, also put it in the backlog of logs")
subprocess.run(["cp", "logged_book.epub", "log-books/log_" + now.strftime("%Y-%m-%d_%H:%M:%S") + ".epub"], capture_output=True)
subprocess.run(["cp", "logged_book.epub", "log-books/log_" + now.strftime("%Y-%m-%d_%H%M%S") + ".epub"], capture_output=True)
create_all_logs_file();
print("Finished");
# At the moment, we are not storing logs in the log folder anymore

Loading…
Cancel
Save