Skip to content

New feature: listening statistics and trophies - #172

Open
NicolasHartmann wants to merge 10 commits into
rstewa:mainfrom
NicolasHartmann:feature/listening-stats-upstream
Open

NicolasHartmann wants to merge 10 commits into
rstewa:mainfrom
NicolasHartmann:feature/listening-stats-upstream

Conversation

@NicolasHartmann

@NicolasHartmann NicolasHartmann commented Nov 14, 2026 •

Copy link
Copy Markdown

New feature: listening statistics and trophies

Audibly now records how long you listen and shows it on two new pages in the navigation menu: Statistics and Trophies.

Statistics

  • Current title: time listened and time saved by listening faster than 1×.
  • All time: the same two numbers across the whole library.
  • Daily / Monthly / Yearly charts: the last five days you listened, every month with data, and every year, each with its average.
  • In my library: the number of titles.
stats-daily stats-monthly stats-yearly

Trophies

14 trophies, each with a bronze, silver and gold tier. A locked trophy is shown as an outline. Clicking a trophy shows the goal of the next tier and the progress towards it. When a tier is reached while listening, the app shows a notification.

Trophy Counts
Marathoner total hours listened
Time Bender hours saved by faster playback
Finisher audiobooks finished
Collector titles in the library
Daily Habit days in a row with listening
Night Owl hours listened at night
Early Bird hours listened early in the morning
Weekend Warrior hours listened on one weekend
Binge Day hours listened on one day
Speed Reader hours listened at 2× or faster
Sprint different audiobooks finished within 7 days
Juggler different audiobooks listened to on one day
Regular listening days in one month
Around the Clock different hours of the day with listening
trophies trophy-dialog

The numbers in the screenshots are sample data.

How it works

  • Listening time is real time, taken from the player's position updates while a book is playing. Time saved is the audio covered minus the real time, and never negative.
  • Seeks, pauses and switching books are not counted. Reaching the end only counts as finishing a book that was listened to for at least a minute.
  • The data is stored per day, hour and audiobook in its own SQLite file, stats.db, in the app's local folder. The library database and its migrations are not touched.
  • Writes are batched (every 30 seconds, on pause, on book change and on exit). A failing statistics file is logged and never interrupts playback.

What changes in the project

  • New library Audibly.Stats with all the logic, and Audibly.Stats.Tests with 85 xunit tests. This is the first test project in the solution; I am happy to drop it from the PR if you prefer.
  • New dependency: Microsoft.Data.Sqlite (in Audibly.Stats only).
  • In the app: two pages, two controls (bar chart, trophy badge), a small service, two menu items in AppShell, and a few calls in PlayerViewModel that report position, pause and seek.

Testing

This PR is independent of my other open PRs.

🤖 Generated with Claude Code

Darkybald and others added 10 commits November 14, 2026 19:37
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…hies

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Reaching the end only counts as finishing a book while playing and
  after at least a minute of listening to it; seeking to the end no
  longer unlocks Finisher or Sprint
- Library count uses the whole library, not the list a search or filter
  is currently showing
- Opening the trophies page stores and announces tiers reached without
  playback, so Collector cannot fall back when the library shrinks
- Flush listening time when the app exits from the mini player

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Every seek interrupts the listening count, so short forward jumps
  (a nearby Read Along word) no longer add listening time
- Newly reached trophy tiers are saved in one transaction
- A stats.db that keeps failing is logged once per outage, and the
  time waiting to be saved is merged instead of growing with each flush
- Sprint counts each audiobook once per 7-day window
- Trophies show what the library alone earned when the history cannot
  be read
- Trophies page shows only the latest of several quick reloads; both
  pages log instead of throwing when a reload fails

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants