diff --git a/log-books/all.txt b/log-books/all.txt new file mode 100644 index 0000000..b7ac4b6 --- /dev/null +++ b/log-books/all.txt @@ -0,0 +1,14 @@ +all.txt +log_2024-03-25_13:21:53.epub +log_2024-03-25_13:50:25.epub +log_2024-03-25_13:51:15.epub +log_2024-03-25_14:09:27-Copy1.epub +log_2024-03-25_14:09:27.epub +log_2024-03-25_14:25:33.epub +log_2024-03-25_14:33:25.epub +log_2024-03-25_14:38:03.epub +log_2024-03-25_14:57:36.epub +log_2024-03-25_15:50:29.epub +log_2024-03-25_162717.epub +log_2024-03-25_162734.epub +log_2024-03-25_163412.epub diff --git a/script.py b/script.py index f7212c7..6efaa9a 100644 --- a/script.py +++ b/script.py @@ -16,9 +16,9 @@ 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) + list_logs = subprocess.run(["ls", "/home/xpub/www/html/tl-dr/log-books"], capture_output=True) - with open("/log-books/all.txt", "w") as f: + with open("/home/xpub/www/html/tl-dr/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 @@ -60,7 +60,7 @@ kitchen_services = run_command(["sudo", "journalctl", "-S", "today", "-u", "kitc # loading the jinja template environment print("Filling the template"); -env = Environment(loader=FileSystemLoader("templates")) +env = Environment(loader=FileSystemLoader("/home/xpub/www/html/tl-dr/templates")) # loading the template (use template.jinja when generating the html webview) template = env.get_template("book.jinja") @@ -97,15 +97,15 @@ output = template.render( print("Output the files"); # Export the html as book.html, which is used as an input for pandoc -with open("book.html", "w") as f: +with open("/home/xpub/www/html/tl-dr/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) + subprocess.run(["pandoc", "/home/xpub/www/html/tl-dr/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", "/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) create_all_logs_file(); print("Finished"); # At the moment, we are not storing logs in the log folder anymore # with open(log_file_name, "w") as f: # print(output, file=f) - \ No newline at end of file +