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

No more internal communication via HTTP

This commit is contained in:
Krateng
2019-02-21 09:43:35 +01:00
parent efd4b89da1
commit 46d0874dfc
10 changed files with 22 additions and 138 deletions

View File

@@ -2,9 +2,9 @@ import urllib
import database
def instructions(keys,dbport):
def instructions(keys):
from utilities import getArtistInfo, getTrackInfo
from htmlgenerators import clean, artistLink, artistLinks, trackLink, scrobblesTrackLink, keysToUrl, pickKeys, getTimeDesc, getRangeDesc, scrobblesLink, KeySplit
from htmlgenerators import artistLinks, keysToUrl, KeySplit
from htmlmodules import module_scrobblelist, module_pulse
@@ -19,44 +19,9 @@ def instructions(keys,dbport):
pos = "#" + str(data["position"])
#response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(limitkeys))
#db_data = json.loads(response.read())
#scrobbles = db_data["list"]
# build list
# html = "<table class='list'>"
# for s in scrobbles:
# html += "<tr>"
# html += "<td class='time'>" + getTimeDesc(s["time"]) + "</td>"
# html += "<td class='artists'>" + artistLinks(s["artists"]) + "</td>"
# html += "<td class='title'>" + trackLink({"artists":s["artists"],"title":s["title"]}) + "</td>"
# html += "</tr>"
# html += "</table>"
html_scrobbles, _, _ = module_scrobblelist(track=track,max_=100)
# pulse
# response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/pulse?step=year&trail=1&" + keysToUrl(limitkeys))
# db_data = json.loads(response.read())
# terms = db_data["list"]
# build list
# maxbar = max([t["scrobbles"] for t in terms])
# html_pulse = "<table class='list'>"
# for t in terms:
# fromstr = "/".join([str(e) for e in t["from"]])
# tostr = "/".join([str(e) for e in t["to"]])
# html_pulse += "<tr>"
# #html += "<td>" + fromstr + "</td>"
# #html += "<td>" + tostr + "</td>"
# html_pulse += "<td>" + getRangeDesc(t["from"],t["to"]) + "</td>"
# html_pulse += "<td class='amount'>" + scrobblesLink({"since":fromstr,"to":tostr},amount=t["scrobbles"],track=trackobject) + "</td>"
# html_pulse += "<td class='bar'>" + scrobblesLink({"since":fromstr,"to":tostr},percent=t["scrobbles"]*100/maxbar,track=trackobject) + "</td>"
# html_pulse += "</tr>"
# html_pulse += "</table>"
html_pulse = module_pulse(track=track,step="year",stepn=1,trail=1)