From b9e754a6bb6b2d0e5c1542afeed9a5ad73850f43 Mon Sep 17 00:00:00 2001 From: Krateng Date: Sun, 10 Mar 2019 17:38:33 +0100 Subject: [PATCH] Minor fixes --- database.py | 15 +++++++++++++-- htmlmodules.py | 2 ++ website/issues.html | 2 +- website/maloja.css | 2 +- website/start.html | 13 ++++++++++++- website/start.py | 8 +++++++- website/topartists.html | 2 +- website/toptracks.html | 2 +- 8 files changed, 38 insertions(+), 8 deletions(-) diff --git a/database.py b/database.py index 0f556ab..c3bfdee 100644 --- a/database.py +++ b/database.py @@ -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 diff --git a/htmlmodules.py b/htmlmodules.py index f914288..c971032 100644 --- a/htmlmodules.py +++ b/htmlmodules.py @@ -40,6 +40,8 @@ def module_scrobblelist(max_=None,pictures=False,shortTimeDesc=False,**kwargs): html += """
""" html += "" + artistLinks(s["artists"]) + "" html += "" + trackLink({"artists":s["artists"],"title":s["title"]}) + "" + # Alternative way: Do it in one cell + #html += "" + artistLinks(s["artists"]) + " — " + trackLink({"artists":s["artists"],"title":s["title"]}) + "" html += "" i += 1 diff --git a/website/issues.html b/website/issues.html index 149d977..4b58bc4 100644 --- a/website/issues.html +++ b/website/issues.html @@ -13,7 +13,7 @@

Possible Issues


with your library -

KEY_ISSUES Issues

+

KEY_ISSUES Issues

Maloja can identify possible problems with consistency or redundancy in your library. After making any changes, you should rebuild your library.
Your API key is required to make any changes to the server:

diff --git a/website/maloja.css b/website/maloja.css index 0edbeb6..c1de9e0 100644 --- a/website/maloja.css +++ b/website/maloja.css @@ -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; diff --git a/website/start.html b/website/start.html index a3a6f65..ba6a86e 100644 --- a/website/start.html +++ b/website/start.html @@ -98,13 +98,24 @@ | 12 weeks | 12 months | 10 years - +

KEY_PULSE_MONTHS + diff --git a/website/start.py b/website/start.py index fa1cc9b..505ce57 100644 --- a/website/start.py +++ b/website/start.py @@ -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) diff --git a/website/topartists.html b/website/topartists.html index 32d0704..e97dc17 100644 --- a/website/topartists.html +++ b/website/topartists.html @@ -3,7 +3,7 @@ - Maloja - Top Artists KEY_RANGE + Maloja - Top Artists diff --git a/website/toptracks.html b/website/toptracks.html index c12899d..272840e 100644 --- a/website/toptracks.html +++ b/website/toptracks.html @@ -3,7 +3,7 @@ - Maloja - Top Tracks in KEY_RANGE + Maloja - Top Tracks