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