mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Expanded compare feature slightly
This commit is contained in:
parent
8a80c265cd
commit
a59381d0bf
@ -22,16 +22,18 @@
|
||||
|
||||
table tr td:first-child {
|
||||
text-align: left;
|
||||
padding:20px;
|
||||
padding:10px;
|
||||
width:33%;
|
||||
}
|
||||
table tr td {
|
||||
text-align: center;
|
||||
padding:20px;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
table tr td:last-child {
|
||||
text-align: right;
|
||||
padding:20px;
|
||||
padding:10px;
|
||||
width:33%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@ -41,8 +43,10 @@
|
||||
<tr>
|
||||
<td><h1>KEY_NAME_SELF</h1></td>
|
||||
<td>
|
||||
|
||||
<div class="comparecircle">
|
||||
KEY_MATCH%
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td><h1>KEY_NAME_OTHER</h1></td>
|
||||
@ -50,12 +54,21 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td style="font-size:70%">
|
||||
<td style="font-size:70%;color:grey;">
|
||||
The size of the circle shows matching music taste.
|
||||
The fuzziness of its border indicates differences in quantity.
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<span>Common Favorite</span>
|
||||
<h2 style="margin:7px;">KEY_BESTARTIST_LINK</h2>
|
||||
<img src="KEY_BESTARTIST_IMAGE" style="width:80px;" />
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
import urllib
|
||||
import database
|
||||
import json
|
||||
from htmlgenerators import artistLink
|
||||
from utilities import getArtistImage
|
||||
|
||||
|
||||
def instructions(keys):
|
||||
|
||||
@ -27,9 +30,7 @@ def instructions(keys):
|
||||
artists[a]["other"] -= common
|
||||
artists[a]["common"] = common
|
||||
|
||||
best = sorted((a for a in artists),key=lambda x: artists[x.lower()]["common"],reverse=True)
|
||||
|
||||
|
||||
best = sorted((artists[a]["name"] for a in artists),key=lambda x: artists[x.lower()]["common"],reverse=True)
|
||||
|
||||
result = {
|
||||
"unique_self":sum(artists[a]["self"] for a in artists if artists[a]["common"] == 0),
|
||||
@ -67,7 +68,8 @@ def instructions(keys):
|
||||
pixel_fullmatch = fullmatch * 2.5
|
||||
pixel_partialmatch = (fullmatch+partialmatch) * 2.5
|
||||
|
||||
matchcolor = format(int(min(1,match/50)*255),"x") * 2 + format(int(max(0,match/50-1)*255),"x")
|
||||
matchcolor = format(int(min(1,match/50)*255),"02x") * 2 + format(int(max(0,match/50-1)*255),"02x")
|
||||
|
||||
|
||||
return {
|
||||
"KEY_CIRCLE_CSS":",".join(css),
|
||||
@ -77,4 +79,6 @@ def instructions(keys):
|
||||
"KEY_PARTIALMATCH":str(int(pixel_partialmatch)),
|
||||
"KEY_NAME_SELF":owninfo["name"],
|
||||
"KEY_NAME_OTHER":strangerinfo["name"],
|
||||
"KEY_BESTARTIST_LINK":artistLink(best[0]),
|
||||
"KEY_BESTARTIST_IMAGE":getArtistImage(best[0])
|
||||
},[]
|
||||
|
Loading…
Reference in New Issue
Block a user