mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Some code reordering
This commit is contained in:
parent
dfe46d0242
commit
91cb26435f
@ -412,7 +412,7 @@ def issues():
|
|||||||
duplicates = []
|
duplicates = []
|
||||||
newartists = []
|
newartists = []
|
||||||
inconsistent = not db_rulestate
|
inconsistent = not db_rulestate
|
||||||
|
# if the user manually edits files while the server is running this won't show, but too lazy to check the rulestate here
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import difflib
|
import difflib
|
||||||
|
@ -84,8 +84,43 @@ table td.time {
|
|||||||
color:gray;
|
color:gray;
|
||||||
}
|
}
|
||||||
table td.artists,td.artist,td.title {
|
table td.artists,td.artist,td.title {
|
||||||
width:350px;
|
width:500px;
|
||||||
|
white-space:nowrap;
|
||||||
|
overflow:hidden;
|
||||||
|
text-overflow:ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
table td.artists div {
|
||||||
|
overflow:hidden;
|
||||||
|
z-index:1;
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tr td.artists div span {
|
||||||
|
//text-overflow:ellipsis;
|
||||||
|
z-index:-2;
|
||||||
|
position:relative;
|
||||||
|
white-space:nowrap;
|
||||||
|
|
||||||
|
}
|
||||||
|
table tr:hover td.artists div span {
|
||||||
|
animation: bounce 3s linear infinite alternate;
|
||||||
|
}
|
||||||
|
@keyframes bounce {
|
||||||
|
0% {
|
||||||
|
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
//transform: translateX(-60px);
|
||||||
|
//margin-left:-60px;
|
||||||
|
margin-left:-100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
table td.amount {
|
table td.amount {
|
||||||
width:50px;
|
width:50px;
|
||||||
text-align:right;
|
text-align:right;
|
||||||
|
@ -9,26 +9,30 @@ def replacedict(keys,dbport):
|
|||||||
#hand down the since and from arguments
|
#hand down the since and from arguments
|
||||||
extrakeys = urllib.parse.urlencode(keys)
|
extrakeys = urllib.parse.urlencode(keys)
|
||||||
|
|
||||||
if keys.get("artist") is not None:
|
|
||||||
info = getArtistInfo(keys.get("artist"))
|
|
||||||
imgurl = info.get("image")
|
|
||||||
else:
|
|
||||||
imgurl = "" #for now
|
|
||||||
|
|
||||||
limitstring = ""
|
limitstring = ""
|
||||||
if keys.get("artist") is not None:
|
|
||||||
#limitstring += "by <a href='/artist?artist=" + urllib.parse.quote(keys.get("artist")) + "'>" + keys.get("artist") + "</a> "
|
|
||||||
limitstring += "by " + artistLink(keys.get("artist"))
|
|
||||||
if keys.get("associated") is not None:
|
|
||||||
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/artistinfo?artist=" + urllib.parse.quote(keys["artist"]))
|
|
||||||
db_data = json.loads(response.read())
|
|
||||||
moreartists = db_data["associated"]
|
|
||||||
limitstring += " <span class='extra'>including " + ", ".join(moreartists) + "</span>"
|
|
||||||
|
|
||||||
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?" + extrakeys)
|
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/scrobbles?" + extrakeys)
|
||||||
db_data = json.loads(response.read())
|
db_data = json.loads(response.read())
|
||||||
scrobbles = db_data["list"]
|
scrobbles = db_data["list"]
|
||||||
|
|
||||||
|
if keys.get("artist") is not None:
|
||||||
|
latestartist = keys.get("artist")
|
||||||
|
limitstring += "by " + artistLink(keys.get("artist"))
|
||||||
|
if keys.get("associated") is not None:
|
||||||
|
response = urllib.request.urlopen("http://localhost:" + str(dbport) + "/artistinfo?artist=" + urllib.parse.quote(keys["artist"]))
|
||||||
|
db_data = json.loads(response.read())
|
||||||
|
moreartists = [artistLink(a) for a in db_data["associated"]]
|
||||||
|
if moreartists != []:
|
||||||
|
limitstring += " <span class='extra'>including " + ", ".join(moreartists) + "</span>"
|
||||||
|
|
||||||
|
else:
|
||||||
|
latestartist = scrobbles[0]["artists"][0]
|
||||||
|
|
||||||
|
info = getArtistInfo(latestartist)
|
||||||
|
imgurl = info.get("image")
|
||||||
|
|
||||||
html = "<table class='list'>"
|
html = "<table class='list'>"
|
||||||
for s in scrobbles:
|
for s in scrobbles:
|
||||||
html += "<tr><td class='time'>"
|
html += "<tr><td class='time'>"
|
||||||
|
@ -5,6 +5,9 @@ import json
|
|||||||
def replacedict(keys,dbport):
|
def replacedict(keys,dbport):
|
||||||
from utilities import getArtistInfo, artistLink
|
from utilities import getArtistInfo, artistLink
|
||||||
|
|
||||||
|
# we don't use the associated key for top tracks so we don't wanna hand it down to functions we're calling
|
||||||
|
keys.pop("associated",None)
|
||||||
|
|
||||||
#hand down the since and from arguments
|
#hand down the since and from arguments
|
||||||
extrakeys = urllib.parse.urlencode(keys,quote_via=urllib.parse.quote,safe="/")
|
extrakeys = urllib.parse.urlencode(keys,quote_via=urllib.parse.quote,safe="/")
|
||||||
|
|
||||||
@ -12,9 +15,11 @@ def replacedict(keys,dbport):
|
|||||||
db_data = json.loads(response.read())
|
db_data = json.loads(response.read())
|
||||||
charts = db_data["list"][:50]
|
charts = db_data["list"][:50]
|
||||||
limitstring = ""
|
limitstring = ""
|
||||||
|
|
||||||
if keys.get("artist") is not None:
|
if keys.get("artist") is not None:
|
||||||
topartist = keys.get("artist")
|
topartist = keys.get("artist")
|
||||||
limitstring += "by " + artistLink(keys.get("artist"))
|
limitstring += "by " + artistLink(keys.get("artist"))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
topartist = charts[0]["track"]["artists"][0] #for now
|
topartist = charts[0]["track"]["artists"][0] #for now
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user