Fix Top Songs: accumulate play counts per scrape, deduplicate only stat card

song_counts tallies how many times each song appears across all runs
(powers the Top Songs ranking). total_scraped uses the unique seen
set separately so the stat card stays deduplicated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 4.6 committed 2026-08-25 16:22:27 -04:00
1 parent 8f28d9c9ce
commit 389376e43e
1 file changed
+2 -3
+2 -3
View File
@@ -68,9 +68,8 @@ def load_recent_stats(db_path=None):
sname = song.get("source", "Unknown")
title = song.get("title", "?")
artist = song.get("artist", "?")
k = (artist, title)
if k not in scraped_seen:
scraped_seen.add(k)
scraped_seen.add((artist, title))
# accumulate play count every scrape (powers Top Songs ranking)
stats["song_counts"].setdefault(sname, {})
dk = f"{artist} - {title}"
stats["song_counts"][sname][dk] = stats["song_counts"][sname].get(dk, 0) + 1