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 += """
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: