2025-01-06 23:53:41 +00:00
|
|
|
import pathlib
|
|
|
|
|
|
|
|
|
|
|
|
all_content = []
|
2025-01-08 21:25:47 +00:00
|
|
|
return_count = 0
|
|
|
|
hour_count = 0
|
|
|
|
|
|
|
|
for file in pathlib.Path("logs_plain").glob("*.txt"):
|
|
|
|
with open(file, "r") as f:
|
|
|
|
return_count += f.read().count("[ENTER]")
|
|
|
|
hour_count += 1
|
|
|
|
|
|
|
|
lines_per_hour = return_count // hour_count
|
2025-01-06 23:53:41 +00:00
|
|
|
|
|
|
|
for file in pathlib.Path("logs_summaries").glob("*.txt"):
|
|
|
|
with open(file, "r") as f:
|
|
|
|
all_content.append(f.read())
|
|
|
|
|
|
|
|
with open("logs_summaries/merged.txt", "w") as f:
|
|
|
|
f.write("\n\n".join(all_content))
|
|
|
|
|
|
|
|
html_content = ['<html>',
|
|
|
|
"""
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
width:100%;
|
2025-01-07 22:45:49 +00:00
|
|
|
background-color: #000;
|
2025-01-08 21:25:47 +00:00
|
|
|
color: #fff;
|
2025-01-06 23:53:41 +00:00
|
|
|
}
|
|
|
|
img {
|
|
|
|
width:40%;
|
|
|
|
padding: 4%;
|
|
|
|
float:left;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
""",
|
2025-01-08 21:25:47 +00:00
|
|
|
'<body>',
|
|
|
|
'<b>',
|
|
|
|
f'Total lines written: {return_count}',
|
|
|
|
'<br />',
|
|
|
|
f'Total lines per hour: {lines_per_hour}',
|
2025-01-12 16:54:05 +00:00
|
|
|
'<br />',
|
|
|
|
f'Total hours: {hour_count}',
|
2025-01-08 21:25:47 +00:00
|
|
|
'</b>',
|
|
|
|
'<br>',
|
|
|
|
]
|
2025-01-06 23:53:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
graph_images = list(pathlib.Path(".").glob("*.png"))
|
|
|
|
graph_images.sort(key=lambda graph: graph.name)
|
|
|
|
|
|
|
|
for graph_image in graph_images:
|
|
|
|
html_content.append(f'<img src="{graph_image}"></img>')
|
|
|
|
html_content.append("</body></html>")
|
|
|
|
|
|
|
|
with open("graphs.html", "w") as f:
|
|
|
|
f.write("\n".join(html_content))
|
|
|
|
|
|
|
|
print("graphs.html generated!")
|