dots/.bin/sb-anki

23 lines
518 B
Plaintext
Raw Permalink Normal View History

2022-05-11 12:31:24 +02:00
#!/usr/bin/env bash
2022-05-11 12:34:22 +02:00
# Anki review percentage for statusbar
2023-06-14 21:20:24 +02:00
num_to_review=200
2022-05-11 12:31:24 +02:00
# Get current card count from Anki
2024-01-28 21:20:49 +01:00
count=$(curl -s 127.0.0.1:8765 -X POST -d '{"action": "getNumCardsReviewedToday", "version": 6}' | jq '.result')
2022-05-11 12:31:24 +02:00
if [ -z "$count" ]
then
if [ -s /tmp/anki-reviews ]; then
true
else
2023-06-14 21:18:39 +02:00
echo "-1" > /tmp/anki-reviews
2022-05-11 12:31:24 +02:00
fi
else
echo "$count" > /tmp/anki-reviews
fi
num_reviews=$(cat /tmp/anki-reviews)
2023-06-14 21:18:39 +02:00
echo -n -e " Reviews: $(python3 -c "print('{:.2%}'.format($num_reviews/$num_to_review))") "