print files

This commit is contained in:
Osman Faruk Bayram 2025-07-31 20:54:23 +03:00
parent bfaad76553
commit 7388c1b0dc

View file

@ -8,23 +8,24 @@ import matplotlib.pyplot as plt
DATA_DIR = Path("/var/lib/wanikani-logs")
print("starting the WaniKani service")
def load_data():
records = []
# records = []
for zip_path in sorted(DATA_DIR.glob("wanikani_data_*.zip")):
st.write(f"Processing {zip_path.name}...")
# with zipfile.ZipFile(zip_path) as z:
# for name in z.namelist():
# with z.open(name) as f:
# data = json.load(f)
# date = zip_path.stem.split("_")[-1]
# # Adapt below to match your JSON structure
# record = {
# "date": date,
# "available_lessons": data.get("lessons", {}).get("available", 0),
# "level": data.get("level", 0),
# }
# records.append(record)
with zipfile.ZipFile(zip_path) as z:
for name in z.namelist():
print(f"Processing file: {name}")
# with z.open(name) as f:
# data = json.load(f)
# date = zip_path.stem.split("_")[-1]
# # Adapt below to match your JSON structure
# record = {
# "date": date,
# "available_lessons": data.get("lessons", {}).get("available", 0),
# "level": data.get("level", 0),
# }
# records.append(record)
# return pd.DataFrame(records)
st.title("📈 WaniKani Progress Tracker")
# df = load_data()
df = load_data()
# st.line_chart(df.set_index("date"))