Include only local content in nodeinfo stats, added downloads count

This commit is contained in:
Eliot Berriot 2020-02-14 10:21:48 +01:00
parent 8d59d8f27a
commit f146c0ae91
No known key found for this signature in database
GPG key ID: 6B501DFD73514E14
5 changed files with 16 additions and 6 deletions

View file

@ -17,6 +17,7 @@ def get():
"artists": get_artists(),
"track_favorites": get_track_favorites(),
"listenings": get_listenings(),
"downloads": get_downloads(),
"music_duration": get_music_duration(),
}
@ -43,15 +44,19 @@ def get_track_favorites():
def get_tracks():
return models.Track.objects.count()
return models.Track.objects.local().count()
def get_albums():
return models.Album.objects.count()
return models.Album.objects.local().count()
def get_artists():
return models.Artist.objects.count()
return models.Artist.objects.local().count()
def get_downloads():
return models.Track.objects.aggregate(d=Sum("downloads_count"))["d"] or 0
def get_music_duration():