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

View File

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