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: except:
pass pass
return {"image":None} return {"image":""}
cachedTracks = {} cachedTracks = {}
cachedArtists = {} cachedArtists = {}
@ -211,7 +211,7 @@ def getTrackInfo(artists,title):
obj = (frozenset(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) 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 filepath = "images/tracks/" + filename
# check if custom image exists # check if custom image exists
@ -265,7 +265,7 @@ def getArtistInfo(artist):
obj = artist obj = artist
filename = re.sub("[^a-zA-Z0-9]","",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 = "images/artists/" + filename
#filepath_cache = "info/artists_cache/" + filename #filepath_cache = "info/artists_cache/" + filename

View File

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

View File

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

View File

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