Return booklist ordered by title
This commit is contained in:
parent
8abf645945
commit
277a1bad60
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue