diff --git a/database.py b/database.py
index ff490fc..8dd86ce 100644
--- a/database.py
+++ b/database.py
@@ -158,17 +158,17 @@ def get_scrobbles_external():
ckeys["artists"], ckeys["title"] = keys.getall("artist"), keys.get("title")
ckeys["since"], ckeys["to"], ckeys["within"] = keys.get("since"), keys.get("to"), keys.get("in")
ckeys["associated"] = (keys.get("associated")!=None)
- ckeys["max"] = keys.get("max")
+ ckeys["max_"] = keys.get("max")
result = get_scrobbles(**ckeys)
return {"list":result}
def get_scrobbles(**keys):
- r = db_query(**{k:keys[k] for k in keys if k in ["artists","title","since","to","within","associated"]})
+ r = db_query(**{k:keys[k] for k in keys if k in ["artist","artists","title","since","to","within","associated","track"]})
r.reverse()
- if keys.get("max") is not None:
- return r[:int(keys.get("max"))]
+ if keys.get("max_") is not None:
+ return r[:int(keys.get("max_"))]
else:
return r
@@ -327,7 +327,7 @@ def get_pulse(step="month",stepn=1,trail=3,**keys):
#d_current_end = getNext(d_current,step,stepn * trail)
d_current_end = getEnd(d_current,step,stepn * trail)
#res = db_aggregate(since=d_current,to=d_current_end)
- res = len(db_query(since=d_current,to=d_current_end,**{k:keys[k] for k in keys if k in ["artists","title","associated"]}))
+ res = len(db_query(since=d_current,to=d_current_end,**{k:keys[k] for k in keys if k in ["artists","artist","track","title","associated"]}))
results.append({"from":d_current,"to":d_current_end,"scrobbles":res})
d_current = getNext(d_current,step,stepn)
if isPast(d_current_end,d_end):
@@ -841,17 +841,35 @@ def sync():
# Queries the database
-def db_query(artists=None,title=None,track=None,since=None,to=None,within=None,associated=False):
+def db_query(artist=None,artists=None,title=None,track=None,since=None,to=None,within=None,associated=False):
+# print(artists)
+# print(title)
+# print(track)
+# print(since)
+# print(to)
+# print(within)
+# print(associated)
+
(since, to) = getTimestamps(since,to,within)
# this is not meant as a search function. we *can* query the db with a string, but it only works if it matches exactly
# if a title is specified, we assume that a specific track (with the exact artist combination) is requested
# if not, duplicate artist arguments are ignored
- artist = None
+ #artist = None
- # artists to numbers
- artists = set([(ARTISTS.index(a) if isinstance(a,str) else a) for a in artists])
+ if artist is not None and isinstance(artist,str):
+ artist = ARTISTS.index(artist)
+
+ # artists to numbers
+ if artists is not None:
+ artists = set([(ARTISTS.index(a) if isinstance(a,str) else a) for a in artists])
+
+ # track to number
+ if track is not None and isinstance(track,dict):
+ trackartists = set([(ARTISTS.index(a) if isinstance(a,str) else a) for a in track["artists"]])
+ track = TRACKS.index((frozenset(trackartists),track["title"]))
+ artists = None
#check if track is requested via title
if title!=None and track==None:
@@ -860,8 +878,9 @@ def db_query(artists=None,title=None,track=None,since=None,to=None,within=None,a
# if we're not looking for a track (either directly or per title artist arguments, which is converted to track above)
# we only need one artist
- elif track==None and len(artists) != 0:
+ elif artist is None and track is None and artists is not None and len(artists) != 0:
artist = artists.pop()
+
# right now we always request everything by name, maybe we don't actually need the request by number, but i'll leave it in for now
diff --git a/htmlgenerators.py b/htmlgenerators.py
index b8a8e23..dcf3d1a 100644
--- a/htmlgenerators.py
+++ b/htmlgenerators.py
@@ -108,6 +108,71 @@ def getRangeDesc(timeA,timeB,inclusiveB=True):
return getTimeDesc(timeA) + " to " + getTimeDesc(timeB)
+
+
+# finds out if we want an artist or a track
+#def interpretURLKeys(keys):
+# if "title" in keys:
+# return {"track":{"artists":keys.getall("artist"),"title":keys.get("title")}}
+# if "artist" in keys:
+# return {"artist":keys.get("artist")}
+#
+# return {}
+
+# alright this is the last one
+# one ultimate method to rule them all
+# one method to take html keys and convert them into internal keys
+# it renames them, interprets what's being asked, removes duplicates
+# it gets rid of multidicts
+# it does fecking everything
+# it's the best
+# fantastic
+def KeySplit(keys):
+
+ # output:
+ # 1 keys that define the filtered object like artist or track
+ # 2 keys that define time limits of the whole thing
+ # 3 keys that define interal time ranges
+ # 4 keys that define amount limits
+
+ # 1
+ if "title" in keys:
+ resultkeys1 = {"track":{"artists":keys.getall("artist"),"title":keys.get("title")}}
+ elif "artist" in keys:
+ resultkeys1 = {"artist":keys.get("artist")}
+ if "associated" in keys: resultkeys1["associated"] = True
+ else:
+ resultkeys1 = {}
+
+ # 2
+ resultkeys2 = {}
+ if "since" in keys: resultkeys2["since"] = keys.get("since")
+ elif "from" in keys: resultkeys2["since"] = keys.get("from")
+ elif "start" in keys: resultkeys2["since"] = keys.get("start")
+ #
+ if "to" in keys: resultkeys2["to"] = keys.get("to")
+ elif "until" in keys: resultkeys2["to"] = keys.get("until")
+ elif "end" in keys: resultkeys2["to"] = keys.get("end")
+ #
+ if "in" in keys: resultkeys2["within"] = keys.get("in")
+ elif "within" in keys: resultkeys2["within"] = keys.get("within")
+ elif "during" in keys: resultkeys2["within"] = keys.get("during")
+
+
+ #3
+ resultkeys3 = {}
+ if "step" in keys: [resultkeys3["step"],resultkeys3["stepn"]] = (keys["step"].split("-") + [1])[:2]
+ if "stepn" in keys: resultkeys3["stepn"] = keys["stepn"] #overwrite if explicitly given
+ if "stepn" in resultkeys3: resultkeys3["stepn"] = int(resultkeys3["stepn"]) #in both cases, convert it here
+ if "trail" in keys: resultkeys3["trail"] = int(keys["trail"])
+
+
+ #4
+ resultkeys4 = {}
+ if "max" in keys: resultkeys4["max_"] = int(keys["max"])
+
+ return resultkeys1, resultkeys2, resultkeys3, resultkeys4
+
# limit a multidict to only the specified keys
# would be a simple constructor expression, but multidicts apparently don't let me do that
diff --git a/htmlmodules.py b/htmlmodules.py
new file mode 100644
index 0000000..eb513ba
--- /dev/null
+++ b/htmlmodules.py
@@ -0,0 +1,140 @@
+from htmlgenerators import *
+import database
+from utilities import getArtistsInfo, getTracksInfo
+
+
+def getpictures(ls,result,tracks=False):
+ from utilities import getArtistsInfo, getTracksInfo
+ if tracks:
+ for element in getTracksInfo(ls):
+ result.append(element.get("image"))
+ else:
+ for element in getArtistsInfo(ls):
+ result.append(element.get("image"))
+
+
+# artist=None,track=None,since=None,to=None,within=None,associated=False,max_=None,pictures=False
+def module_scrobblelist(max_=None,pictures=False,shortTimeDesc=False,**kwargs):
+
+ kwargs_filter = pickKeys(kwargs,"artist","track","associated")
+ kwargs_time = pickKeys(kwargs,"since","to","within")
+
+ scrobbles = database.get_scrobbles(**kwargs_time,**kwargs_filter) #we're getting all scrobbles for the number and only filtering them on site
+ if pictures:
+ scrobbleswithpictures = scrobbles if max_ is None else scrobbles[:max_]
+ scrobbleimages = [e.get("image") for e in getTracksInfo(scrobbleswithpictures)] #will still work with scrobble objects as they are a technically a subset of track objects
+
+ representative = scrobbles[0] if scrobbles is not [] else None
+
+ # build list
+ i = 0
+ html = "
"
+ for s in scrobbles:
+ i += 1
+ if max_ is not None and i>=max_:
+ break
+
+ html += ""
+ html += "" + getTimeDesc(s["time"],short=shortTimeDesc) + " | "
+ if pictures:
+ html += """ | """
+ html += "" + artistLinks(s["artists"]) + " | "
+ html += "" + trackLink({"artists":s["artists"],"title":s["title"]}) + " | "
+ html += "
"
+
+
+ html += "
"
+
+ return (html,len(scrobbles),representative)
+
+
+def module_pulse(max_=None,**kwargs):
+
+ kwargs_filter = pickKeys(kwargs,"artist","track","associated")
+ kwargs_time = pickKeys(kwargs,"since","to","within","step","stepn","trail")
+
+ ranges = database.get_pulse(**kwargs_time,**kwargs_filter)
+
+ maxbar = max([t["scrobbles"] for t in ranges])
+ maxbar = max(maxbar,1)
+
+ #build list
+ html = ""
+ for t in ranges:
+ fromstr = "/".join([str(e) for e in t["from"]])
+ tostr = "/".join([str(e) for e in t["to"]])
+ html += ""
+ html += "" + getRangeDesc(t["from"],t["to"]) + " | "
+ html += "" + scrobblesLink({"since":fromstr,"to":tostr},amount=t["scrobbles"],**kwargs_filter) + " | "
+ html += "" + scrobblesLink({"since":fromstr,"to":tostr},percent=t["scrobbles"]*100/maxbar,**kwargs_filter) + " | "
+ html += "
"
+ html += "
"
+
+
+ return html
+
+def module_trackcharts(max_=None,**kwargs):
+
+ kwargs_filter = pickKeys(kwargs,"artist","associated")
+ kwargs_time = pickKeys(kwargs,"since","to","within")
+
+ tracks = database.get_charts_tracks(**kwargs_filter,**kwargs_time)
+
+ if tracks != []:
+ maxbar = tracks[0]["scrobbles"]
+ representative = tracks[0]["track"]
+ else:
+ representative = None
+
+
+ i = 0
+ html = ""
+ for e in tracks:
+ i += 1
+ if max_ is not None and i>max_:
+ break
+ html += ""
+ html += "#" + str(i) + " | "
+ html += "" + artistLinks(e["track"]["artists"]) + " | "
+ html += "" + trackLink(e["track"]) + " | "
+ html += "" + scrobblesTrackLink(e["track"],kwargs_time,amount=e["scrobbles"]) + " | "
+ html += "" + scrobblesTrackLink(e["track"],kwargs_time,percent=e["scrobbles"]*100/maxbar) + " | "
+ html += "
"
+ html += "
"
+
+ return (html,representative)
+
+
+def module_artistcharts(max_=None,**kwargs):
+
+ kwargs_filter = pickKeys(kwargs,"associated") #not used right now
+ kwargs_time = pickKeys(kwargs,"since","to","within")
+
+ artists = database.get_charts_artists(**kwargs_filter,**kwargs_time)
+
+
+ if artists != []:
+ maxbar = artists[0]["scrobbles"]
+ representative = artists[0]["artist"]
+ else:
+ representative = None
+
+ i = 0
+ html = ""
+ for e in artists:
+ i += 1
+ if max_ is not None and i>max_:
+ break
+ html += ""
+ html += "#" + str(i) + " | "
+ html += "" + artistLink(e["artist"])
+ if (e["counting"] != []):
+ html += " "
+ html += " | "
+ html += "" + scrobblesArtistLink(e["artist"],kwargs_time,amount=e["scrobbles"],associated=True) + " | "
+ html += "" + scrobblesArtistLink(e["artist"],kwargs_time,percent=e["scrobbles"]*100/maxbar,associated=True) + " | "
+ html += "
"
+
+ html += "
"
+
+ return (html, representative)
diff --git a/website/artist.html b/website/artist.html
index 65142dd..5ea4ff1 100644
--- a/website/artist.html
+++ b/website/artist.html
@@ -14,7 +14,7 @@
- KEY_ARTISTNAME KEY_POSITION
+ KEY_ARTISTNAME KEY_POSITION
KEY_ASSOCIATED
KEY_SCROBBLES Scrobbles
diff --git a/website/artist.py b/website/artist.py
index 06bd0fa..7a6b15c 100644
--- a/website/artist.py
+++ b/website/artist.py
@@ -5,8 +5,10 @@ import json
def instructions(keys,dbport):
from utilities import getArtistInfo
from htmlgenerators import clean, artistLink, artistLinks, trackLink, scrobblesTrackLink, getRangeDesc, scrobblesLink
+ from htmlmodules import module_pulse, module_trackcharts
- clean(keys)
+ allowedkeys = {"artist":keys.get("artist")}
+# clean(keys)
info = getArtistInfo(keys["artist"])
imgurl = info.get("image")
#desc = info.get("info")
@@ -27,47 +29,12 @@ def instructions(keys,dbport):
includestr = "associated: "
includestr += artistLinks(included)
-
-
-
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/tracks?artist=" + urllib.parse.quote(keys["artist"]))
- db_data = json.loads(response.read())
-
- if db_data["list"] != []: maxbar = db_data["list"][0]["scrobbles"]
- html = ""
- for e in db_data["list"]:
- html += ""
- html += "" + artistLinks(e["track"]["artists"]) + " | "
- html += "" + trackLink(e["track"]) + " | "
- html += "" + scrobblesTrackLink(e["track"],{},amount=e["scrobbles"]) + " | "
- html += "" + scrobblesTrackLink(e["track"],{},percent=e["scrobbles"]*100/maxbar) + " | "
- html += " "
- html += " "
-
-
- # pulse
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/pulse?step=year&trail=1&artist=" + urllib.parse.quote(keys["artist"]))
- db_data = json.loads(response.read())
- terms = db_data["list"]
-
- # build list
- maxbar = max([t["scrobbles"] for t in terms])
-
- html_pulse = ""
- for t in terms:
- fromstr = "/".join([str(e) for e in t["from"]])
- tostr = "/".join([str(e) for e in t["to"]])
- html_pulse += ""
- #html += "" + fromstr + " | "
- #html += "" + tostr + " | "
- html_pulse += "" + getRangeDesc(t["from"],t["to"]) + " | "
- html_pulse += "" + scrobblesLink({"since":fromstr,"to":tostr},amount=t["scrobbles"],artist=keys["artist"]) + " | "
- html_pulse += "" + scrobblesLink({"since":fromstr,"to":tostr},percent=t["scrobbles"]*100/maxbar,artist=keys["artist"]) + " | "
- html_pulse += " "
- html_pulse += " "
-
-
- replace = {"KEY_ARTISTNAME":keys["artist"],"KEY_ENC_ARTISTNAME":urllib.parse.quote(keys["artist"]),"KEY_IMAGEURL":imgurl, "KEY_DESCRIPTION":"","KEY_TRACKLIST":html,"KEY_SCROBBLES":scrobbles,"KEY_POSITION":pos,"KEY_ASSOCIATED":includestr,"KEY_PULSE":html_pulse}
+ html_tracks, _ = module_trackcharts(**allowedkeys)
+
+
+ html_pulse = module_pulse(**allowedkeys,step="year",stepn=1,trail=1)
+
+ replace = {"KEY_ARTISTNAME":keys["artist"],"KEY_ENC_ARTISTNAME":urllib.parse.quote(keys["artist"]),"KEY_IMAGEURL":imgurl, "KEY_DESCRIPTION":"","KEY_TRACKLIST":html_tracks,"KEY_SCROBBLES":scrobbles,"KEY_POSITION":pos,"KEY_ASSOCIATED":includestr,"KEY_PULSE":html_pulse}
return (replace,pushresources)
diff --git a/website/pulse.py b/website/pulse.py
index df33202..3401a3a 100644
--- a/website/pulse.py
+++ b/website/pulse.py
@@ -4,29 +4,24 @@ import json
def instructions(keys,dbport):
from utilities import getArtistInfo, getTrackInfo
- from htmlgenerators import getTimeDesc, artistLink, artistLinks, trackLink, scrobblesLink, keysToUrl, pickKeys, clean, getRangeDesc
+ from htmlgenerators import getTimeDesc, artistLink, artistLinks, trackLink, scrobblesLink, keysToUrl, getRangeDesc, KeySplit
+ from htmlmodules import module_pulse
- clean(keys)
- timekeys = pickKeys(keys,"since","to","in","step","trail")
- limitkeys = pickKeys(keys,"artist","title","associated")
+ filterkeys, timekeys, delimitkeys, _ = KeySplit(keys)
- # Get scrobble data
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/pulse?" + keysToUrl(limitkeys,timekeys))
- db_data = json.loads(response.read())
- terms = db_data["list"]
# describe the scope (and creating a key for the relevant artist or track)
limitstring = ""
- limitkey = {}
- if keys.get("title") is not None:
- limitkey["track"] = {"artists":keys.getall("artist"),"title":keys.get("title")}
- limitstring += "of " + trackLink(limitkey["track"]) + " "
- limitstring += "by " + artistLinks(keys.getall("artist"))
+ #limitkey = {}
+ if filterkeys.get("track") is not None:
+ #limitkey["track"] = {"artists":keys.getall("artist"),"title":keys.get("title")}
+ limitstring += "of " + trackLink(filterkeys["track"]) + " "
+ limitstring += "by " + artistLinks(filterkeys["track"]["artists"])
- elif keys.get("artist") is not None:
- limitkey["artist"], limitkey["associated"] = keys.get("artist"), (keys.get("associated")!=None)
- limitstring += "of " + artistLink(keys.get("artist"))
- if keys.get("associated") is not None:
+ elif filterkeys.get("artist") is not None:
+ #limitkey["artist"], limitkey["associated"] = keys.get("artist"), (keys.get("associated")!=None)
+ limitstring += "of " + artistLink(filterkeys.get("artist"))
+ if filterkeys.get("associated"):
response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/artistinfo?artist=" + urllib.parse.quote(keys["artist"]))
db_data = json.loads(response.read())
moreartists = db_data["associated"]
@@ -35,9 +30,9 @@ def instructions(keys,dbport):
# get image
- if limitkeys.get("title") is not None:
- imgurl = getTrackInfo(limitkeys.getall("artist"),limitkeys.get("title")).get("image")
- elif keys.get("artist") is not None:
+ if filterkeys.get("track") is not None:
+ imgurl = getTrackInfo(filterkeys.get("track")["artists"],filterkeys.get("track")["title"]).get("image")
+ elif filterkeys.get("artist") is not None:
imgurl = getArtistInfo(keys.get("artist")).get("image")
#elif (len(scrobbles) != 0):
# imgurl = getTrackInfo(scrobbles[0]["artists"],scrobbles[0]["title"]).get("image")
@@ -49,23 +44,9 @@ def instructions(keys,dbport):
- # build list
- maxbar = max([t["scrobbles"] for t in terms])
+ html_pulse = module_pulse(**filterkeys,**timekeys,**delimitkeys)
- html = ""
- for t in terms:
- fromstr = "/".join([str(e) for e in t["from"]])
- tostr = "/".join([str(e) for e in t["to"]])
- html += ""
- #html += "" + fromstr + " | "
- #html += "" + tostr + " | "
- html += "" + getRangeDesc(t["from"],t["to"]) + " | "
- html += "" + scrobblesLink({"since":fromstr,"to":tostr},amount=t["scrobbles"],**limitkey) + " | "
- html += "" + scrobblesLink({"since":fromstr,"to":tostr},percent=t["scrobbles"]*100/maxbar,**limitkey) + " | "
- html += " "
- html += " "
-
- replace = {"KEY_PULSE_TABLE":html,"KEY_IMAGEURL":imgurl,"KEY_LIMITS":limitstring}
+ replace = {"KEY_PULSE_TABLE":html_pulse,"KEY_IMAGEURL":imgurl,"KEY_LIMITS":limitstring}
return (replace,pushresources)
diff --git a/website/scrobbles.py b/website/scrobbles.py
index a08a05b..4d396d8 100644
--- a/website/scrobbles.py
+++ b/website/scrobbles.py
@@ -4,16 +4,11 @@ import json
def instructions(keys,dbport):
from utilities import getArtistInfo, getTrackInfo
- from htmlgenerators import getTimeDesc, artistLink, artistLinks, trackLink, keysToUrl, pickKeys, clean
+ from htmlgenerators import getTimeDesc, artistLink, artistLinks, trackLink, keysToUrl, KeySplit
+ from htmlmodules import module_scrobblelist
- clean(keys)
- timekeys = pickKeys(keys,"since","to","in","max")
- limitkeys = pickKeys(keys,"artist","title","associated")
- # Get scrobble data
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(limitkeys,timekeys))
- db_data = json.loads(response.read())
- scrobbles = db_data["list"]
+ filterkeys, timekeys, _, amountkeys = KeySplit(keys)
# describe the scope
limitstring = ""
@@ -30,33 +25,25 @@ def instructions(keys,dbport):
if moreartists != []:
limitstring += " "
+
+
+ html, amount, rep = module_scrobblelist(**filterkeys,**timekeys,**amountkeys)
# get image
- if limitkeys.get("title") is not None:
- imgurl = getTrackInfo(limitkeys.getall("artist"),limitkeys.get("title")).get("image")
- elif keys.get("artist") is not None:
+ if filterkeys.get("track") is not None:
+ imgurl = getTrackInfo(filterkeys.get("track")["artists"],filterkeys.get("track")["title"]).get("image")
+ elif filterkeys.get("artist") is not None:
imgurl = getArtistInfo(keys.get("artist")).get("image")
- elif (len(scrobbles) != 0):
- imgurl = getTrackInfo(scrobbles[0]["artists"],scrobbles[0]["title"]).get("image")
- #imgurl = getArtistInfo(scrobbles[0]["artists"][0]).get("image")
+ elif rep is not None:
+ imgurl = getTrackInfo(rep["artists"],rep["title"]).get("image")
else:
imgurl = ""
+
pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
-
- # build list
- html = ""
- for s in scrobbles:
- html += ""
- html += "" + getTimeDesc(s["time"]) + " | "
- #html += """ | """
- html += "" + artistLinks(s["artists"]) + " | "
- html += "" + trackLink({"artists":s["artists"],"title":s["title"]}) + " | "
- html += " "
- html += " "
- replace = {"KEY_SCROBBLELIST":html,"KEY_SCROBBLES":str(len(scrobbles)),"KEY_IMAGEURL":imgurl,"KEY_LIMITS":limitstring}
+ replace = {"KEY_SCROBBLELIST":html,"KEY_SCROBBLES":str(amount),"KEY_IMAGEURL":imgurl,"KEY_LIMITS":limitstring}
return (replace,pushresources)
diff --git a/website/start.html b/website/start.html
index 138cd87..c9fc7da 100644
--- a/website/start.html
+++ b/website/start.html
@@ -8,7 +8,7 @@
-
+
@@ -58,7 +58,7 @@
-
+
@@ -116,98 +116,9 @@
This year KEY_SCROBBLES_YEAR
All Time KEY_SCROBBLES_TOTAL
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
- KEY_SCROBBLE_TIME |
- |
- KEY_SCROBBLE_ARTISTS |
- KEY_SCROBBLE_TITLE |
-
-
+
+ KEY_SCROBBLES
+
@@ -220,70 +131,9 @@
Years
-->
-
-
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
- KEY_PULSE_TERM |
- KEY_PULSE_AMOUNT |
- KEY_PULSE_BAR |
-
-
+
+ KEY_PULSE
+
diff --git a/website/start.py b/website/start.py
index 17fb521..0965ccc 100644
--- a/website/start.py
+++ b/website/start.py
@@ -4,6 +4,8 @@ from threading import Thread
from datetime import datetime
#import database
+from htmlmodules import module_scrobblelist, module_pulse
+
def getpictures(ls,result,tracks=False):
from utilities import getArtistsInfo, getTracksInfo
@@ -60,19 +62,21 @@ def instructions(keys,dbport):
# get scrobbles
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?max=50")
- db_data = json.loads(response.read())
- scrobblelist = db_data["list"]
- #scrobblelist = database.get_scrobbles(max=50)
- scrobbletrackobjects = scrobblelist #ignore the extra time attribute, the format should still work
- scrobbleartists = [", ".join([artistLink(a) for a in s["artists"]]) for s in scrobblelist]
- scrobbletitles = [s["title"] for s in scrobblelist]
- scrobbletimes = [getTimeDesc(s["time"],short=True) for s in scrobblelist]
- scrobbleimages = []
- t3 = Thread(target=getpictures,args=(scrobbletrackobjects,scrobbleimages,),kwargs={"tracks":True})
- t3.start()
- #scrobbleimages = [info.get("image") for info in getTracksInfo(scrobbletrackobjects)]
- scrobbletracklinks = [trackLink(t) for t in scrobbletrackobjects]
+# response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?max=50")
+# db_data = json.loads(response.read())
+# scrobblelist = db_data["list"]
+# #scrobblelist = database.get_scrobbles(max=50)
+# scrobbletrackobjects = scrobblelist #ignore the extra time attribute, the format should still work
+# scrobbleartists = [", ".join([artistLink(a) for a in s["artists"]]) for s in scrobblelist]
+# scrobbletitles = [s["title"] for s in scrobblelist]
+# scrobbletimes = [getTimeDesc(s["time"],short=True) for s in scrobblelist]
+# scrobbleimages = []
+# t3 = Thread(target=getpictures,args=(scrobbletrackobjects,scrobbleimages,),kwargs={"tracks":True})
+# t3.start()
+# #scrobbleimages = [info.get("image") for info in getTracksInfo(scrobbletrackobjects)]
+# scrobbletracklinks = [trackLink(t) for t in scrobbletrackobjects]
+
+ html_scrobbles, _, _ = module_scrobblelist(max_=15,shortTimeDesc=True,pictures=True)
# get stats
@@ -101,33 +105,36 @@ def instructions(keys,dbport):
# this is literally the ugliest piece of code i have written in my entire feckin life
# good lord
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/pulse?step=month&trail=1&since=" + dts)
- db_data = json.loads(response.read())
- terms = db_data["list"]
+# response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/pulse?step=month&trail=1&since=" + dts)
+# db_data = json.loads(response.read())
+# terms = db_data["list"]
- maxbar = max([t["scrobbles"] for t in terms])
- #pulse_fromdates = ["/".join([str(e) for e in t["from"]]) for t in terms]
- #pulse_todates = ["/".join([str(e) for e in t["to"]]) for t in terms]
- pulse_rangedescs = [getRangeDesc(t["from"],t["to"]) for t in terms]
- pulse_amounts = [scrobblesLink({"since":"/".join([str(e) for e in t["from"]]),"to":"/".join([str(e) for e in t["to"]])},amount=t["scrobbles"]) for t in terms]
- pulse_bars = [scrobblesLink({"since":"/".join([str(e) for e in t["from"]]),"to":"/".join([str(e) for e in t["to"]])},percent=t["scrobbles"]*100/maxbar) for t in terms]
-
+# maxbar = max([t["scrobbles"] for t in terms])
+# #pulse_fromdates = ["/".join([str(e) for e in t["from"]]) for t in terms]
+# #pulse_todates = ["/".join([str(e) for e in t["to"]]) for t in terms]
+# pulse_rangedescs = [getRangeDesc(t["from"],t["to"]) for t in terms]
+# pulse_amounts = [scrobblesLink({"since":"/".join([str(e) for e in t["from"]]),"to":"/".join([str(e) for e in t["to"]])},amount=t["scrobbles"]) for t in terms]
+# pulse_bars = [scrobblesLink({"since":"/".join([str(e) for e in t["from"]]),"to":"/".join([str(e) for e in t["to"]])},percent=t["scrobbles"]*100/maxbar) for t in terms]
+ html_pulse = module_pulse(max_=12,since=dts,step="month",trail=1)
t1.join()
t2.join()
- t3.join()
+ #t3.join()
- pushresources = [{"file":img,"type":"image"} for img in artistimages + trackimages + scrobbleimages if img.startswith("/")]
-
+ #pushresources = [{"file":img,"type":"image"} for img in artistimages + trackimages + scrobbleimages if img.startswith("/")]
+ pushresources = []
replace = {"KEY_ARTISTIMAGE":artistimages,"KEY_ARTISTNAME":artisttitles,"KEY_ARTISTLINK":artistlinks,"KEY_POSITION_ARTIST":posrange,
"KEY_TRACKIMAGE":trackimages,"KEY_TRACKNAME":tracktitles,"KEY_TRACKLINK":tracklinks,"KEY_POSITION_TRACK":posrange,
"KEY_SCROBBLES_TODAY":scrobbles_today,"KEY_SCROBBLES_MONTH":scrobbles_month,"KEY_SCROBBLES_YEAR":scrobbles_year,"KEY_SCROBBLES_TOTAL":scrobbles_total,
- "KEY_SCROBBLE_TIME":scrobbletimes,"KEY_SCROBBLE_ARTISTS":scrobbleartists,"KEY_SCROBBLE_TITLE":scrobbletracklinks,"KEY_SCROBBLE_IMAGE":scrobbleimages,
- "KEY_PULSE_TERM":pulse_rangedescs,"KEY_PULSE_AMOUNT":pulse_amounts,"KEY_PULSE_BAR":pulse_bars}
+ #"KEY_SCROBBLE_TIME":scrobbletimes,"KEY_SCROBBLE_ARTISTS":scrobbleartists,"KEY_SCROBBLE_TITLE":scrobbletracklinks,"KEY_SCROBBLE_IMAGE":scrobbleimages,
+ "KEY_SCROBBLES":html_scrobbles,
+ #"KEY_PULSE_TERM":pulse_rangedescs,"KEY_PULSE_AMOUNT":pulse_amounts,"KEY_PULSE_BAR":pulse_bars
+ "KEY_PULSE":html_pulse
+ }
return (replace,pushresources)
diff --git a/website/topartists.html b/website/topartists.html
index cf941c3..4205426 100644
--- a/website/topartists.html
+++ b/website/topartists.html
@@ -16,7 +16,7 @@
|
Top Artists
in KEY_RANGE
- KEY_SCROBBLES Scrobbles
+
|
diff --git a/website/topartists.py b/website/topartists.py
index 45387fa..cefc89d 100644
--- a/website/topartists.py
+++ b/website/topartists.py
@@ -4,47 +4,60 @@ import json
def instructions(keys,dbport):
from utilities import getArtistInfo
- from htmlgenerators import artistLink, artistLinks, trackLink, scrobblesArtistLink, keysToUrl, pickKeys, clean
+ from htmlgenerators import KeySplit
+ from htmlmodules import module_artistcharts
- clean(keys)
- timekeys = pickKeys(keys,"since","to","in")
- limitkeys = pickKeys(keys)
+# clean(keys)
+# timekeys = pickKeys(keys,"since","to","in")
+# limitkeys = pickKeys(keys)
+
+ _, timekeys, _, amountkeys = KeySplit(keys)
# get chart data
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/artists?" + keysToUrl(timekeys,limitkeys))
- db_data = json.loads(response.read())
- charts = db_data["list"][:50]
- topartist = charts[0]["artist"]
+# response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/artists?" + keysToUrl(timekeys,limitkeys))
+# db_data = json.loads(response.read())
+# charts = db_data["list"][:50]
+# topartist = charts[0]["artist"]
+
+# info = getArtistInfo(topartist)
+# imgurl = info.get("image")
- info = getArtistInfo(topartist)
- imgurl = info.get("image")
- pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
# get total amount of scrobbles
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(timekeys,limitkeys))
- db_data = json.loads(response.read())
- scrobblelist = db_data["list"]
- scrobbles = len(scrobblelist)
+ #response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(timekeys,limitkeys))
+ #db_data = json.loads(response.read())
+ #scrobblelist = db_data["list"]
+ #scrobbles = len(scrobblelist)
+ html_charts, rep = module_artistcharts(**amountkeys,**timekeys)
+
+ if rep is not None:
+ imgurl = getArtistInfo(rep).get("image")
+ else:
+ imgurl = ""
+ pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
+
# build list
- maxbar = charts[0]["scrobbles"]
-
- i = 1
- html = ""
- for e in charts:
- html += ""
- html += "#" + str(i) + " | "
- html += "" + artistLink(e["artist"])
- if (e["counting"] != []):
- html += " "
- html += " | "
- html += "" + scrobblesArtistLink(e["artist"],timekeys,amount=e["scrobbles"],associated=True) + " | "
- html += "" + scrobblesArtistLink(e["artist"],timekeys,percent=e["scrobbles"]*100/maxbar,associated=True) + " | "
- html += " "
- i += 1
- html += " "
+# maxbar = charts[0]["scrobbles"]
+#
+# i = 1
+# html = ""
+# for e in charts:
+# html += ""
+# html += "#" + str(i) + " | "
+# html += "" + artistLink(e["artist"])
+# if (e["counting"] != []):
+# html += " "
+# html += " | "
+# html += "" + scrobblesArtistLink(e["artist"],timekeys,amount=e["scrobbles"],associated=True) + " | "
+# html += "" + scrobblesArtistLink(e["artist"],timekeys,percent=e["scrobbles"]*100/maxbar,associated=True) + " | "
+# html += " "
+# i += 1
+# html += " "
- replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_SCROBBLES":str(scrobbles),"KEY_ARTISTLIST":html}
+
+
+ replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_ARTISTLIST":html_charts}
return (replace,pushresources)
diff --git a/website/toptracks.html b/website/toptracks.html
index 8ef9d6b..4df6b34 100644
--- a/website/toptracks.html
+++ b/website/toptracks.html
@@ -16,7 +16,7 @@
Top Tracks
KEY_LIMITS
- KEY_SCROBBLES Scrobbles
+
|
diff --git a/website/toptracks.py b/website/toptracks.py
index e888360..ec0bc8e 100644
--- a/website/toptracks.py
+++ b/website/toptracks.py
@@ -4,57 +4,70 @@ import json
def instructions(keys,dbport):
from utilities import getArtistInfo, getTrackInfo
- from htmlgenerators import artistLink, artistLinks, trackLink, scrobblesTrackLink, keysToUrl, pickKeys, clean
+ from htmlgenerators import artistLink, KeySplit
+ from htmlmodules import module_trackcharts
- clean(keys)
- timekeys = pickKeys(keys,"since","to","in")
- limitkeys = pickKeys(keys,"artist")
+# clean(keys)
+# timekeys = pickKeys(keys,"since","to","in")
+# limitkeys = pickKeys(keys,"artist")
- # get chart data
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/charts/tracks?" + keysToUrl(timekeys,limitkeys))
- db_data = json.loads(response.read())
- charts = db_data["list"][:50]
+ filterkeys, timekeys, _, amountkeys = KeySplit(keys)
+
+
limitstring = ""
- if keys.get("artist") is not None:
- topartist = keys.get("artist")
- #limitstring += "by " + ", ".join([artistLink(a) for a in keys.getall("artist")])
- limitstring = "by " + artistLink(keys.get("artist"))
- info = getArtistInfo(topartist)
- imgurl = info.get("image")
- else:
- #topartist = charts[0]["track"]["artists"][0] #for now
- info = getTrackInfo(charts[0]["track"]["artists"],charts[0]["track"]["title"])
- imgurl = info.get("image")
-
- pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
+ if filterkeys.get("artist") is not None:
+ topartist = filterkeys.get("artist")
+# #limitstring += "by " + ", ".join([artistLink(a) for a in keys.getall("artist")])
+ limitstring = "by " + artistLink(filterkeys.get("artist"))
+# info = getArtistInfo(topartist)
+# imgurl = info.get("image")
+# else:
+# #topartist = charts[0]["track"]["artists"][0] #for now
+# info = getTrackInfo(charts[0]["track"]["artists"],charts[0]["track"]["title"])
+# imgurl = info.get("image")
+
+
# get total amount of scrobbles
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(timekeys,limitkeys))
- db_data = json.loads(response.read())
- scrobblelist = db_data["list"]
- scrobbles = len(scrobblelist)
+# response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(timekeys,limitkeys))
+# db_data = json.loads(response.read())
+# scrobblelist = db_data["list"]
+# scrobbles = len(scrobblelist)
+ html_charts, rep = module_trackcharts(**amountkeys,**timekeys,**filterkeys)
+
+
+ if filterkeys.get("artist") is not None:
+ imgurl = getArtistInfo(filterkeys.get("artist")).get("image")
+ limitstring = "by " + artistLink(filterkeys.get("artist"))
+ elif rep is not None:
+ imgurl = getTrackInfo(rep["artists"],rep["title"]).get("image")
+ else:
+ imgurl = ""
+
+ pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
+
# build list
- maxbar = charts[0]["scrobbles"]
-
- i = 1
- html = ""
- for e in charts:
- html += ""
- html += "#" + str(i) + " | "
- html += "" + artistLinks(e["track"]["artists"]) + " | "
- html += "" + trackLink(e["track"]) + " | "
- html += "" + scrobblesTrackLink(e["track"],timekeys,amount=e["scrobbles"]) + " | "
- html += "" + scrobblesTrackLink(e["track"],timekeys,percent=e["scrobbles"]*100/maxbar) + " | "
- html += " "
- i += 1
- html += " "
+# maxbar = charts[0]["scrobbles"]
+#
+# i = 1
+# html = ""
+# for e in charts:
+# html += ""
+# html += "#" + str(i) + " | "
+# html += "" + artistLinks(e["track"]["artists"]) + " | "
+# html += "" + trackLink(e["track"]) + " | "
+# html += "" + scrobblesTrackLink(e["track"],timekeys,amount=e["scrobbles"]) + " | "
+# html += "" + scrobblesTrackLink(e["track"],timekeys,percent=e["scrobbles"]*100/maxbar) + " | "
+# html += " "
+# i += 1
+# html += " "
- replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_SCROBBLES":str(scrobbles),"KEY_TRACKLIST":html,"KEY_LIMITS":limitstring}
+ replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,"KEY_TRACKLIST":html_charts,"KEY_LIMITS":limitstring}
return (replace,pushresources)
diff --git a/website/track.html b/website/track.html
index 07da268..9891c7f 100644
--- a/website/track.html
+++ b/website/track.html
@@ -15,7 +15,7 @@
KEY_ARTISTS
- KEY_TRACKTITLE KEY_POSITION
+ KEY_TRACKTITLE KEY_POSITION
KEY_SCROBBLES Scrobbles
diff --git a/website/track.py b/website/track.py
index cf358bc..9731892 100644
--- a/website/track.py
+++ b/website/track.py
@@ -1,63 +1,67 @@
import urllib
import json
+import database
def instructions(keys,dbport):
from utilities import getArtistInfo, getTrackInfo
- from htmlgenerators import clean, artistLink, artistLinks, trackLink, scrobblesTrackLink, keysToUrl, pickKeys, getTimeDesc, getRangeDesc, scrobblesLink
+ from htmlgenerators import clean, artistLink, artistLinks, trackLink, scrobblesTrackLink, keysToUrl, pickKeys, getTimeDesc, getRangeDesc, scrobblesLink, KeySplit
+ from htmlmodules import module_scrobblelist, module_pulse
- clean(keys)
- limitkeys = pickKeys(keys,"artist","title")
- trackobject = {"artists":limitkeys.getall("artist"),"title":limitkeys.get("title")}
- info = getTrackInfo(keys.getall("artist"),keys.get("title"))
- imgurl = info.get("image")
+
+ filterkeys, _, _, _ = KeySplit(keys)
+
+ track = filterkeys.get("track")
+ imgurl = getTrackInfo(track["artists"],track["title"]).get("image")
pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
- response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/trackinfo?" + keysToUrl(limitkeys))
- db_data = json.loads(response.read())
- scrobblesnum = str(db_data["scrobbles"])
- pos = "#" + str(db_data["position"])
+ data = database.trackInfo(track["artists"],track["title"])
+ scrobblesnum = str(data["scrobbles"])
+ 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"]
+ #response = urllib.request.urlopen("http://[::1]:" + str(dbport) + "/scrobbles?" + keysToUrl(limitkeys))
+ #db_data = json.loads(response.read())
+ #scrobbles = db_data["list"]
# build list
- html = ""
- for s in scrobbles:
- html += ""
- html += "" + getTimeDesc(s["time"]) + " | "
- html += "" + artistLinks(s["artists"]) + " | "
- html += "" + trackLink({"artists":s["artists"],"title":s["title"]}) + " | "
- html += " "
- html += " "
-
+# html = ""
+# for s in scrobbles:
+# html += ""
+# html += "" + getTimeDesc(s["time"]) + " | "
+# html += "" + artistLinks(s["artists"]) + " | "
+# html += "" + trackLink({"artists":s["artists"],"title":s["title"]}) + " | "
+# html += " "
+# html += " "
+
+ 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"]
+# 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])
+# maxbar = max([t["scrobbles"] for t in terms])
- html_pulse = ""
- for t in terms:
- fromstr = "/".join([str(e) for e in t["from"]])
- tostr = "/".join([str(e) for e in t["to"]])
- html_pulse += ""
- #html += "" + fromstr + " | "
- #html += "" + tostr + " | "
- html_pulse += "" + getRangeDesc(t["from"],t["to"]) + " | "
- html_pulse += "" + scrobblesLink({"since":fromstr,"to":tostr},amount=t["scrobbles"],track=trackobject) + " | "
- html_pulse += "" + scrobblesLink({"since":fromstr,"to":tostr},percent=t["scrobbles"]*100/maxbar,track=trackobject) + " | "
- html_pulse += " "
- html_pulse += " "
+# html_pulse = ""
+# for t in terms:
+# fromstr = "/".join([str(e) for e in t["from"]])
+# tostr = "/".join([str(e) for e in t["to"]])
+# html_pulse += ""
+# #html += "" + fromstr + " | "
+# #html += "" + tostr + " | "
+# html_pulse += "" + getRangeDesc(t["from"],t["to"]) + " | "
+# html_pulse += "" + scrobblesLink({"since":fromstr,"to":tostr},amount=t["scrobbles"],track=trackobject) + " | "
+# html_pulse += "" + scrobblesLink({"since":fromstr,"to":tostr},percent=t["scrobbles"]*100/maxbar,track=trackobject) + " | "
+# html_pulse += " "
+# html_pulse += " "
+ html_pulse = module_pulse(track=track,step="year",stepn=1,trail=1)
- replace = {"KEY_TRACKTITLE":limitkeys.get("title"),"KEY_ARTISTS":artistLinks(limitkeys.getall("artist")),"KEY_SCROBBLES":scrobblesnum,"KEY_IMAGEURL":imgurl,
- "KEY_SCROBBLELINK":keysToUrl(limitkeys),"KEY_SCROBBLELIST":html,"KEY_POSITION":pos,"KEY_PULSE":html_pulse}
+
+ replace = {"KEY_TRACKTITLE":track.get("title"),"KEY_ARTISTS":artistLinks(track.get("artists")),"KEY_SCROBBLES":scrobblesnum,"KEY_IMAGEURL":imgurl,
+ "KEY_SCROBBLELINK":keysToUrl(keys),"KEY_SCROBBLELIST":html_scrobbles,"KEY_POSITION":pos,"KEY_PULSE":html_pulse}
return (replace,pushresources)
| | |