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:
parent
a59f2599bd
commit
e7aa878a6e
1 changed files with 5 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue