implemented the choosing of pages

This commit is contained in:
Hellow2 2023-03-29 17:04:06 +02:00
parent f4047b91c1
commit fcee8c1f84
2 changed files with 6 additions and 3 deletions

View File

@ -21,10 +21,10 @@ SHADY_PAGES: Tuple[Type[Page]] = (
Musify,
)
# this needs to be case insensitive
SHORTHANDS = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
for i, page in enumerate(ALL_PAGES):
page_names[page.__name__] = page
page_names[SHORTHANDS[i]] = page
page_names[page.__name__.lower()] = page
page_names[SHORTHANDS[i].lower()] = page
shorthand_of_page[page] = SHORTHANDS[i]

View File

@ -203,4 +203,7 @@ class Search(Download):
except IndexError:
return self
if query.lower() in page_attributes.page_names:
return self.choose_page(page_attributes.page_names[query.lower()])
return self.search(query=query)