create a list of all logs file

main
vitrinekast 8 months ago
parent 50933eb419
commit 76858070f5

@ -15,6 +15,12 @@ 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 = "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 # Execute a command on the command line. Based = used for piped commands
def run_command(command, based = False): def run_command(command, based = False):
result = subprocess.run(command, capture_output=True, input=based) result = subprocess.run(command, capture_output=True, input=based)
@ -95,7 +101,8 @@ with open("book.html", "w") as f:
print(output, file=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) 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") 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"); print("Finished");
# At the moment, we are not storing logs in the log folder anymore # At the moment, we are not storing logs in the log folder anymore

Loading…
Cancel
Save