1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added database call for basic information

This commit is contained in:
Krateng 2019-06-17 16:57:20 +02:00
parent 47f13028c4
commit 90b510bc0a
2 changed files with 17 additions and 0 deletions

View File

@ -225,7 +225,22 @@ def get_scrobbles(**keys):
# return r # return r
return r return r
# info for comparison
@dbserver.get("info")
def info_external(**keys):
result = info()
return result
def info():
totalscrobbles = get_scrobbles_num()
artists = {}
return {
"name":settings.get_settings("NAME"),
"artists":{
chartentry["artist"]:round(chartentry["scrobbles"] * 100 / totalscrobbles,3)
for chartentry in get_charts_artists() if chartentry["scrobbles"]/totalscrobbles >= 0.001}
}

View File

@ -36,6 +36,8 @@ DEFAULT_STEP_PULSE = month
SCROBBLES_GOLD = 250 SCROBBLES_GOLD = 250
SCROBBLES_PLATINUM = 500 SCROBBLES_PLATINUM = 500
SCROBBLES_DIAMOND = 1000 SCROBBLES_DIAMOND = 1000
# name for comparisons
NAME = "Generic Maloja User"
[Misc] [Misc]