implementedexample cli

This commit is contained in:
Hellow2 2023-03-29 13:39:55 +02:00
parent c846f33082
commit 3238f944b3
2 changed files with 12 additions and 7 deletions

View File

@ -1,8 +1,16 @@
from music_kraken import pages
def cli():
search = pages.Search()
while True:
search.next_input(input(">> "))
print(search)
def search_pages():
search = pages.Search("#a Happy Days")
search = pages.Search()
print("metadata", search.pages)
print("audio", search.audio_pages)
@ -18,5 +26,7 @@ def search_pages():
print(search)
if __name__ == "__main__":
search_pages()
cli()

View File

@ -100,13 +100,11 @@ class MultiPageOptions:
class Search(Download):
def __init__(
self,
query: str,
pages: Tuple[Type[Page]] = page_attributes.ALL_PAGES,
exclude_pages: Set[Type[Page]] = set(),
exclude_shady: bool = False,
max_displayed_options: int = 10,
option_digits: int = 3,
dry: bool = False,
) -> None:
super().__init__(
pages=pages,
@ -121,9 +119,6 @@ class Search(Download):
self._current_option: MultiPageOptions = self.next_options
if not dry:
self.search(query)
def __repr__(self):
return self._current_option.__repr__()