Minor fixes

This commit is contained in:
Krateng 2019-03-10 17:38:33 +01:00
parent 1fac2ca965
commit b9e754a6bb
8 changed files with 38 additions and 8 deletions

View File

@ -8,6 +8,7 @@ from cleanup import *
from utilities import *
from malojatime import *
import sys
import unicodedata
dbserver = Bottle()
@ -843,13 +844,15 @@ def db_search(query,type=None):
if type=="ARTIST":
results = []
for a in ARTISTS:
if query.lower() in a.lower():
#if query.lower() in a.lower():
if simplestr(query) in simplestr(a):
results.append(a)
if type=="TRACK":
results = []
for t in TRACKS:
if query.lower() in t[1].lower():
#if query.lower() in t[1].lower():
if simplestr(query) in simplestr(t[1]):
results.append(getTrackObject(t))
return results
@ -859,6 +862,14 @@ def db_search(query,type=None):
## Useful functions
####
# makes a string usable for searching (special characters are blanks, accents and stuff replaced with their real part)
def simplestr(input,ignorecapitalization=True):
norm = unicodedata.normalize("NFKD",input)
norm = [c for c in norm if not unicodedata.combining(c)]
norm = [c if len(c.encode())==1 else " " for c in norm]
clear = ''.join(c for c in norm)
if ignorecapitalization: clear = clear.lower()
return clear

View File

@ -40,6 +40,8 @@ def module_scrobblelist(max_=None,pictures=False,shortTimeDesc=False,**kwargs):
html += """<td class='icon'><div style="background-image:url('""" + scrobbleimages[i] + """')"></div></td>"""
html += "<td class='artists'>" + artistLinks(s["artists"]) + "</td>"
html += "<td class='title'>" + trackLink({"artists":s["artists"],"title":s["title"]}) + "</td>"
# Alternative way: Do it in one cell
#html += "<td class='title'><span>" + artistLinks(s["artists"]) + "</span> — " + trackLink({"artists":s["artists"],"title":s["title"]}) + "</td>"
html += "</tr>"
i += 1

View File

@ -13,7 +13,7 @@
<td class="text">
<h1>Possible Issues</h1><br/>
<span>with your library</span>
<p class="stats"><a href="/scrobbles?artist=KEY_ENC_ARTISTNAME">KEY_ISSUES Issues</a></p>
<p class="stats">KEY_ISSUES Issues</p>
<p>Maloja can identify possible problems with consistency or redundancy in your library. After making any changes, you should <a class="textlink" onclick='fullrebuild()'>rebuild your library</a>.<br/>
Your API key is required to make any changes to the server: <input id='apikey' onchange='checkAPIkey()' style='width:300px;'/></p>

View File

@ -59,7 +59,7 @@ div.footer {
position:fixed;
height:20px;
/**width:100%;**/
background-color:rgba(10,10,10,0.3);
background-color:rgba(10,10,10,0.9);
bottom:0px;
left:0px;
right:0px;

View File

@ -98,13 +98,24 @@
| <span onclick="showRange('pulse','weeks')" class="stat_selector_pulse" id="selector_pulse_weeks">12 weeks</span>
| <span onclick="showRange('pulse','months')" class="stat_selector_pulse" id="selector_pulse_months" style="opacity:0.5;">12 months</span>
| <span onclick="showRange('pulse','years')" class="stat_selector_pulse" id="selector_pulse_years">10 years</span>
<!--
### this is for extra views of the current canonical week / month / year
<br/>
<span onclick="showRange('pulse','week')" class="stat_selector_pulse" id="selector_pulse_week">This Week</span>
| <span onclick="showRange('pulse','month')" class="stat_selector_pulse" id="selector_pulse_month">This Month</span>
| <span onclick="showRange('pulse','year')" class="stat_selector_pulse" id="selector_pulse_year"">This Year</span>
-->
<br/><br/>
<span class="stat_module_pulse" id="pulse_months">KEY_PULSE_MONTHS</span>
<span class="stat_module_pulse" id="pulse_days" style="display:none;">KEY_PULSE_DAYS</span>
<span class="stat_module_pulse" id="pulse_years" style="display:none;">KEY_PULSE_YEARS</span>
<span class="stat_module_pulse" id="pulse_weeks" style="display:none;">KEY_PULSE_WEEKS</span>
<!--
<span class="stat_module_pulse" id="pulse_week" style="display:none;">KEY_PULSE_WEEK</span>
<span class="stat_module_pulse" id="pulse_month" style="display:none;">KEY_PULSE_MONTH</span>
<span class="stat_module_pulse" id="pulse_year" style="display:none;">KEY_PULSE_YEAR</span>
-->
</div>

View File

@ -62,6 +62,11 @@ def instructions(keys):
html_pulse_weeks = module_pulse(max_=12,since=first_week,step="week",trail=1)
html_pulse_months = module_pulse(max_=12,since=first_month,step="month",trail=1)
html_pulse_years = module_pulse(max_=10,since=first_year,step="year",trail=1)
#html_pulse_week = module_pulse(max_=7,since=weekstart,step="day",trail=1)
#html_pulse_month = module_pulse(max_=30,since=[dt.year,dt.month],step="day",trail=1)
#html_pulse_year = module_pulse(max_=12,since=[dt.year],step="month",trail=1)
@ -77,7 +82,8 @@ def instructions(keys):
#"KEY_SCROBBLE_TIME":scrobbletimes,"KEY_SCROBBLE_ARTISTS":scrobbleartists,"KEY_SCROBBLE_TITLE":scrobbletracklinks,"KEY_SCROBBLE_IMAGE":scrobbleimages,
"KEY_SCROBBLES":html_scrobbles,
#"KEY_PULSE_TERM":pulse_rangedescs,"KEY_PULSE_AMOUNT":pulse_amounts,"KEY_PULSE_BAR":pulse_bars
"KEY_PULSE_MONTHS":html_pulse_months,"KEY_PULSE_YEARS":html_pulse_years,"KEY_PULSE_DAYS":html_pulse_days,"KEY_PULSE_WEEKS":html_pulse_weeks
"KEY_PULSE_MONTHS":html_pulse_months,"KEY_PULSE_YEARS":html_pulse_years,"KEY_PULSE_DAYS":html_pulse_days,"KEY_PULSE_WEEKS":html_pulse_weeks,
#"KEY_PULSE_YEAR":html_pulse_year,"KEY_PULSE_MONTH":html_pulse_month,"KEY_PULSE_WEEK":html_pulse_week
}
return (replace,pushresources)

View File

@ -3,7 +3,7 @@
<html>
<head>
<meta charset="UTF-8" />
<title>Maloja - Top Artists KEY_RANGE</title>
<title>Maloja - Top Artists</title>
</head>
<body>

View File

@ -3,7 +3,7 @@
<html>
<head>
<meta charset="UTF-8" />
<title>Maloja - Top Tracks in KEY_RANGE</title>
<title>Maloja - Top Tracks</title>
</head>
<body>