1
0
Fork 0
mirror of https://github.com/Findus23/spotifystats.git synced 2024-09-19 14:43:46 +02:00

add total time listened

This commit is contained in:
Lukas Winkler 2020-07-04 12:48:58 +02:00
parent a59f2599bd
commit e7aa878a6e
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -51,14 +51,18 @@ for file in BASEDIR.glob("StreamingHistory*.json"):
print(f"{len(history)} plays found")
bins = {}
total = 0
for song in history:
if song.date() in bins:
bins[song.date()] += song.min_played
else:
bins[song.date()] = song.min_played
total += song.min_played
plt.bar(bins.keys(), bins.values())
plt.ylabel("minutes")
plt.ylabel("minutes"),
print(f"{total/60:.2f} hours in the last 12 months")
played_songs = []
for song in history: