This commit is contained in:
Krateng 2020-01-10 04:06:34 +01:00
parent 95534f0f4a
commit fbce600c4e
5 changed files with 113 additions and 3 deletions

View File

@ -7,7 +7,7 @@ author = {
"email":"maloja@krateng.dev",
"github": "krateng"
}
version = 2,2,0
version = 2,2,1
versionstr = ".".join(str(n) for n in version)

View File

@ -208,11 +208,13 @@ def getTrackID(artists,title):
TRACKS_NORMALIZED.append(obj_normalized)
return i
import unicodedata
# function to turn the name into a representation that can be easily compared, ignoring minor differences
remove_symbols = ["'","`",""]
def normalize_name(name):
return "".join(char for char in name.lower() if char not in remove_symbols)
return "".join(char for char in unicodedata.normalize('NFD',name.lower())
if char not in remove_symbols and unicodedata.category(char) != 'Mn')

View File

@ -16,7 +16,7 @@ function search(searchfield) {
function html_to_fragment(html) {
var template = document.createElement("template");
template.innerHTML = resulthtml;
template.innerHTML = html;
return template.content;
}

View File

@ -706,6 +706,29 @@ table.tiles_5x5 td {
}
.summary_rank {
background-size:cover;
background-position:center;
display: inline-block;
}
.summary_rank_1 {
width:300px;
height:300px;
border: 6px solid gold;
}
.summary_rank_2 {
width:250px;
height:250px;
border: 4px solid silver;
}
.summary_rank_3 {
width:240px;
height:240px;
border: 3px solid #cd7f32;
}
/*

85
maloja/web/summary.pyhp Normal file
View File

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Maloja - Summary</title>
<script src="/datechange.js" async></script>
<pyhp include="common/header.html" />
</head>
<body>
<table class="top_info">
<tr>
<td class="image">
<div style="background-image:url('/favicon.png')"></div>
</td>
<td class="text">
<h1>Summary</h1><br/>
<span>
<pyhp echo="limitkeys['timerange'].desc(prefix=False)" />
</span>
<br/><br/>
<pyhp echo="htmlmodules.module_filterselection(_urikeys)" />
</td>
</tr>
</table>
<pyhp save="db.get_charts_artists(**filterkeys,**limitkeys)" as="artists" />
<pyhp save="db.get_charts_tracks(**filterkeys,**limitkeys)" as="tracks" />
<table class="twopart"><tr>
<pyhp for="type" in="(artists,tracks)">
<td>
<pyhp if="type is artists">
<h2><a href='/charts_artists'>Artists</a></h2>
</pyhp>
<pyhp if="type is tracks">
<h2><a href='/charts_tracks'>Tracks</a></h2>
</pyhp>
<pyhp for="r" in="range(min(3,len(type)))">
<pyhp>
entry = type[r]
isartist = type is artists
entity = entry["artist"] if isartist else entry["track"]
image = utilities.getArtistImage(entity,fast=True) if isartist else utilities.getTrackImage(entity['artists'],entity['title'],fast=True)
rank = entry["rank"]
</pyhp>
<div class="summary_rank summary_rank_{r+1}" onclick='window.location.href="{htmlgenerators.link_address(entity)}"'
style='cursor:pointer;background-image:url("{image}");'>
</div>
<!--
<span class='stats'>
#<pyhp echo="rank" />
</span>
<span>
<pyhp echo="htmlgenerators.html_link(entity)" />
</span>
-->
</pyhp>
</td>
<pyhp if="type is artists">
<pyhp include="partial/charts_artists.pyhp" with="{'max_':15}" />
</pyhp>
<pyhp if="type is tracks">
<pyhp include="partial/charts_tracks.pyhp" with="{'max_':15}" />
</pyhp>
</pyhp>
</tr></table>
<pyhp include="common/footer.html" />
</body>
</html>