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

Small fixes

This commit is contained in:
Krateng 2018-11-27 16:21:33 +01:00
parent 2a352645f3
commit eaf24d70ba
2 changed files with 7 additions and 1 deletions

View File

@ -75,7 +75,7 @@ def getTrackID(artists,title):
@route("/scrobbles")
def get_scrobbles():
keys = request.query
r = db_query(artist=keys.get("artist"))
r = db_query(artist=keys.get("artist"),track=keys.get("track"),since=keys.get("since"),to=keys.get("to"))
return {"list":r} ##json can't be a list apparently???
@ -300,6 +300,11 @@ def db_query(artist=None,track=None,since=0,to=9999999999):
date[:len(sdate)] = sdate
to = int(datetime.datetime(date[0],date[1],date[2],date[3],date[4],tzinfo=datetime.timezone.utc).timestamp())
if (since==None):
since = 0
if (to==None):
to = 9999999999
# this is not meant as a search function. we *can* query the db with a string, but it only works if it matches exactly (and title string simply picks the first track with that name)
if isinstance(artist, str):
artist = ARTISTS.index(artist)

View File

@ -4,6 +4,7 @@ import _thread
import waitress
import urllib.request
import urllib.parse
import sys
MAIN_PORT = 12345