music-kraken-core/src/actual_donwload.py

53 lines
1.0 KiB
Python
Raw Normal View History

from music_kraken import pages
2023-03-29 11:39:55 +00:00
def cli():
2023-03-30 08:07:42 +00:00
def next_search(search: pages.Search, query: str):
query: str = query.strip()
parsed: str = query.lower()
if parsed == ".":
return
if parsed == "..":
search.goto_previous()
return
if parsed.isdigit():
search.choose_index(int(parsed))
return
page = search.get_page_from_query(parsed)
if page is not None:
search.choose_page(page)
return
# if everything else is not valid search
search.search(query)
2023-03-29 11:39:55 +00:00
search = pages.Search()
2023-03-29 18:56:57 +00:00
2023-03-29 11:39:55 +00:00
while True:
2023-03-30 08:07:42 +00:00
next_search(search, input(">> "))
2023-03-29 11:39:55 +00:00
print(search)
def search_pages():
2023-03-29 11:39:55 +00:00
search = pages.Search()
print("metadata", search.pages)
print("audio", search.audio_pages)
2023-03-29 18:56:57 +00:00
print()
2023-03-28 16:40:56 +00:00
print(search)
2023-03-29 18:56:57 +00:00
2023-03-29 10:00:40 +00:00
search.choose(pages.Musify)
2023-03-29 18:56:57 +00:00
2023-03-29 10:00:40 +00:00
print()
print(search)
2023-03-29 18:56:57 +00:00
2023-03-29 10:00:40 +00:00
search.choose(0)
2023-03-29 09:53:55 +00:00
print(search)
if __name__ == "__main__":
2023-03-29 11:39:55 +00:00
cli()