mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added web views for top artist / track pulse (no idea what to call it)
This commit is contained in:
29
website/chartsartists.html
Normal file
29
website/chartsartists.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Maloja - Favorite Artists</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
<div style="background-image:url('KEY_TOPARTIST_IMAGEURL')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>Favorite Artists</h1><br/>
|
||||
<span>KEY_LIMITS</span>
|
||||
<!--<p class="stats">KEY_SCROBBLES Scrobbles</p>-->
|
||||
<br/><br/>
|
||||
KEY_FILTERSELECTOR
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
KEY_ARTISTLIST
|
||||
|
||||
</body>
|
||||
</html>
|
||||
39
website/chartsartists.py
Normal file
39
website/chartsartists.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import urllib
|
||||
|
||||
|
||||
def instructions(keys):
|
||||
from utilities import getArtistImage, getTrackImage
|
||||
from htmlgenerators import artistLink, KeySplit
|
||||
from htmlmodules import module_topartists, module_filterselection
|
||||
from malojatime import range_desc
|
||||
|
||||
_, timekeys, delimitkeys, _ = KeySplit(keys)
|
||||
|
||||
|
||||
limitstring = ""
|
||||
|
||||
html_filterselector = module_filterselection(keys,delimit=True)
|
||||
|
||||
html_charts, rep = module_topartists(**timekeys, **delimitkeys)
|
||||
|
||||
|
||||
#if filterkeys.get("artist") is not None:
|
||||
# imgurl = getArtistImage(filterkeys.get("artist"))
|
||||
# limitstring = "by " + artistLink(filterkeys.get("artist"))
|
||||
if rep is not None:
|
||||
imgurl = getArtistImage(rep)
|
||||
else:
|
||||
imgurl = ""
|
||||
|
||||
limitstring += " " + range_desc(**timekeys)
|
||||
|
||||
pushresources = [{"file":imgurl,"type":"image"}] if imgurl.startswith("/") else []
|
||||
|
||||
|
||||
|
||||
replace = {"KEY_TOPARTIST_IMAGEURL":imgurl,
|
||||
"KEY_ARTISTLIST":html_charts,
|
||||
"KEY_LIMITS":limitstring,
|
||||
"KEY_FILTERSELECTOR":html_filterselector}
|
||||
|
||||
return (replace,pushresources)
|
||||
29
website/chartstracks.html
Normal file
29
website/chartstracks.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Maloja - Favorite Tracks</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
<td class="image">
|
||||
<div style="background-image:url('KEY_TOPTRACK_IMAGEURL')"></div>
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>Favorite Tracks</h1><br/>
|
||||
<span>KEY_LIMITS</span>
|
||||
<!--<p class="stats">KEY_SCROBBLES Scrobbles</p>-->
|
||||
<br/><br/>
|
||||
KEY_FILTERSELECTOR
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
KEY_TRACKLIST
|
||||
|
||||
</body>
|
||||
</html>
|
||||
36
website/chartstracks.py
Normal file
36
website/chartstracks.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import urllib
|
||||
|
||||
|
||||
def instructions(keys):
|
||||
from utilities import getArtistImage, getTrackImage
|
||||
from htmlgenerators import artistLink, KeySplit
|
||||
from htmlmodules import module_toptracks, module_filterselection
|
||||
from malojatime import range_desc
|
||||
|
||||
filterkeys, timekeys, delimitkeys, _ = KeySplit(keys)
|
||||
|
||||
|
||||
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 = ""
|
||||
|
||||
limitstring += " " + range_desc(**timekeys)
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user