2019-04-02 15:17:19 +03:00
|
|
|
import urllib
|
|
|
|
|
|
|
|
|
|
|
|
def instructions(keys):
|
|
|
|
from utilities import getArtistImage, getTrackImage
|
2019-04-08 14:04:31 +03:00
|
|
|
from htmlgenerators import artistLink
|
|
|
|
from urihandler import compose_querystring, uri_to_internal
|
2019-04-02 15:17:19 +03:00
|
|
|
from htmlmodules import module_toptracks, module_filterselection
|
|
|
|
from malojatime import range_desc
|
|
|
|
|
2019-04-08 14:04:31 +03:00
|
|
|
filterkeys, timekeys, delimitkeys, _ = uri_to_internal(keys)
|
2019-04-02 15:17:19 +03:00
|
|
|
|
|
|
|
|
|
|
|
limitstring = ""
|
|
|
|
|
|
|
|
html_filterselector = module_filterselection(keys,delimit=True)
|
|
|
|
|
|
|
|
html_charts, rep = module_toptracks(**timekeys, **delimitkeys) ### **filterkeys implementing?
|
|
|
|
|
|
|
|
|
|
|
|
#if filterkeys.get("artist") is not None:
|
|
|
|
# imgurl = getArtistImage(filterkeys.get("artist"))
|
|
|
|
# limitstring = "by " + artistLink(filterkeys.get("artist"))
|
|
|
|
if rep is not None:
|
|
|
|
imgurl = getTrackImage(rep["artists"],rep["title"])
|
|
|
|
else:
|
|
|
|
imgurl = ""
|
|
|
|
|
2019-04-10 16:45:50 +03:00
|
|
|
limitstring += " " + timekeys["timerange"].desc(prefix=True)
|
2019-04-02 15:17:19 +03:00
|
|
|
|
|
|
|
pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
replace = {"KEY_TOPTRACK_IMAGEURL":imgurl,"KEY_TRACKLIST":html_charts,"KEY_LIMITS":limitstring,"KEY_FILTERSELECTOR":html_filterselector}
|
|
|
|
|
|
|
|
return (replace,pushresources)
|