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

Minor design changes

This commit is contained in:
Krateng 2018-12-29 00:08:00 +01:00
parent 39873e9297
commit 6082094a3e
7 changed files with 17 additions and 21 deletions

View File

@ -1,5 +0,0 @@
*.png
*.jpg
*.jpeg
*.txt
!default.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1,4 +0,0 @@
*.png
*.jpg
*.jpeg
*.txt

View File

@ -200,7 +200,7 @@ def apirequest(artists=None,artist=None,title=None):
except:
pass
return {"image":None}
return {"image":""}
cachedTracks = {}
cachedArtists = {}
@ -211,7 +211,7 @@ def getTrackInfo(artists,title):
obj = (frozenset(artists),title)
filename = "-".join([re.sub("[^a-zA-Z0-9]","",artist) for artist in artists]) + "_" + re.sub("[^a-zA-Z0-9]","",title)
if filename = "": filename = str(hash(obj))
if filename == "": filename = str(hash(obj))
filepath = "images/tracks/" + filename
# check if custom image exists
@ -265,7 +265,7 @@ def getArtistInfo(artist):
obj = artist
filename = re.sub("[^a-zA-Z0-9]","",artist)
if filename = "": filename = str(hash(obj))
if filename == "": filename = str(hash(obj))
filepath = "images/artists/" + filename
#filepath_cache = "info/artists_cache/" + filename

View File

@ -3,7 +3,7 @@ import json
def replacedict(keys,dbport):
from utilities import getArtistInfo
from utilities import getArtistInfo, getTrackInfo
from htmlgenerators import getTimeDesc, artistLink, artistLinks, trackLink, keysToUrl, pickKeys, clean
clean(keys)
@ -31,8 +31,10 @@ def replacedict(keys,dbport):
limitstring += " <span class='extra'>including " + artistLinks(moreartists) + "</span>"
# get representative artist for image
if keys.get("artist") is not None:
# get image
if limitkeys.get("title") is not None:
imgurl = getTrackInfo(limitkeys.getall("artist"),limitkeys.get("title")).get("image")
elif keys.get("artist") is not None:
imgurl = getArtistInfo(keys.get("artist")).get("image")
elif (len(scrobbles) != 0):
imgurl = getArtistInfo(scrobbles[0]["artists"][0]).get("image")

View File

@ -3,7 +3,7 @@ import json
def replacedict(keys,dbport):
from utilities import getArtistInfo
from utilities import getArtistInfo, getTrackInfo
from htmlgenerators import artistLink, artistLinks, trackLink, scrobblesTrackLink, keysToUrl, pickKeys, clean
clean(keys)
@ -20,11 +20,13 @@ def replacedict(keys,dbport):
topartist = keys.get("artist")
#limitstring += "by " + ", ".join([artistLink(a) for a in keys.getall("artist")])
limitstring = "by " + artistLink(keys.get("artist"))
else:
topartist = charts[0]["track"]["artists"][0] #for now
info = getArtistInfo(topartist)
imgurl = info.get("image")
else:
#topartist = charts[0]["track"]["artists"][0] #for now
info = getTrackInfo(charts[0]["track"]["artists"],charts[0]["track"]["title"])
imgurl = info.get("image")
# get total amount of scrobbles

View File

@ -14,8 +14,9 @@
<div style="background-image:url('KEY_IMAGEURL')"></div>
</td>
<td class="text">
<h1>KEY_TRACKTITLE</h1> <span class="rank"><a href="/toptracks">KEY_POSITION</a></span><br/>
<span>KEY_ARTISTS</span>
<span>KEY_ARTISTS</span><br/>
<h1>KEY_TRACKTITLE</h1> <span class="rank"><a href="/toptracks">KEY_POSITION</a></span>
<p class="stats"><a href="/scrobbles?KEY_SCROBBLELINK">KEY_SCROBBLES Scrobbles</a></p>
<p class="desc"></p>