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

48 lines
1.1 KiB
Python
Raw Normal View History

2018-12-17 18:33:26 +03:00
import urllib
2019-03-29 21:44:42 +03:00
def instructions(keys):
2019-03-12 13:39:36 +03:00
from utilities import getArtistImage
from urihandler import compose_querystring, uri_to_internal
from htmlmodules import module_artistcharts, module_filterselection, module_artistcharts_tiles
2019-03-03 00:55:22 +03:00
from malojatime import range_desc
from doreah.settings import get_settings
2019-03-29 21:44:42 +03:00
_, timekeys, _, amountkeys = uri_to_internal(keys)
2019-03-29 21:44:42 +03:00
limitstring = timekeys["timerange"].desc(prefix=True)
2019-03-29 21:44:42 +03:00
2019-04-01 19:43:08 +03:00
html_filterselector = module_filterselection(keys)
2019-03-29 21:44:42 +03:00
html_charts, rep = module_artistcharts(**amountkeys,**timekeys)
2019-03-29 21:44:42 +03:00
if rep is not None:
2019-03-12 13:39:36 +03:00
imgurl = getArtistImage(rep)
else:
imgurl = ""
2019-03-29 21:44:42 +03:00
2019-09-21 21:51:49 +03:00
html_tiles = ""
if get_settings("CHARTS_DISPLAY_TILES"):
2019-09-21 21:51:49 +03:00
html_tiles = module_artistcharts_tiles(timerange=timekeys["timerange"])
imgurl = "favicon.png"
2019-09-21 21:51:49 +03:00
imgdiv = '<div style="background-image:url('+imgurl+')"></div>'
pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
2019-03-29 21:44:42 +03:00
2018-12-17 18:33:26 +03:00
replace = {
2019-09-21 21:51:49 +03:00
"KEY_TOPARTIST_IMAGEDIV":imgdiv,
"KEY_ARTISTCHART":html_tiles,
"KEY_ARTISTLIST":html_charts,
"KEY_RANGE":limitstring,
"KEY_FILTERSELECTOR":html_filterselector
}
2018-12-17 18:33:26 +03:00
return (replace,pushresources)