Last active
October 6, 2019 16:28
-
-
Save master-of-zen/bb416e927575e3545d0823e0b1dc1665 to your computer and use it in GitHub Desktop.
Book Sort for BookDonkeyBot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sort_books(all_books, booktup) -> list: | |
# Remove books that not match language or extension | |
valid_books = all_books | |
if booktup.lang: | |
for book in list(all_books): | |
if book[2].lower() != booktup.lang.lower(): | |
valid_books.remove(book) | |
if booktup.ext: | |
for book in list(all_books): | |
if book[4].lower() != booktup.ext.lower(): | |
valid_books.remove(book) | |
return valid_books |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment