Return booklist ordered by title

This commit is contained in:
giomba 2018-10-21 12:26:28 +02:00
parent 8abf645945
commit 277a1bad60
1 changed files with 5 additions and 4 deletions

View File

@ -130,17 +130,18 @@ def getHTML(library):
# Our nice XML/HTML tree
return tree
# Filter results using following filter functions
##################################################
# Filter results using following filter functions and order by title
####################################################################
def filter(library, title='', author=''):
# print ("<pre>" + json.dumps(library, indent=4) + "</pre>")
result = list()
for i in library:
if filterTitle(i, title) and filterAuthor(i, author):
result.append(i)
return result
sortedResult = sorted(library, key=lambda k: k.get('title', ''))
return sortedResult
# Filter by title
def filterTitle(book, filter):