added all currently relevant commands and cleaned up the cli.

This commit is contained in:
Hellow 2023-04-12 13:27:42 +02:00
parent 6d78f70e5f
commit 86e58dcfb4
3 changed files with 33 additions and 8 deletions

View File

@ -51,4 +51,8 @@ def real_download():
if __name__ == "__main__":
music_kraken.cli(genre="dsbm")
music_kraken.cli(genre="test", command_list=[
"#a Ghost Bath",
"1",
"ok"
])

View File

@ -57,7 +57,12 @@ def exit_message():
print("Have fun with your music. :3")
def cli(genre: str = None, download_all: bool = False, direct_download_url: str = None):
def cli(
genre: str = None,
download_all: bool = False,
direct_download_url: str = None,
command_list: List[str] = None
):
def get_existing_genre() -> List[str]:
"""
gets the name of all subdirectories of shared.MUSIC_DIR,
@ -175,6 +180,18 @@ def cli(genre: str = None, download_all: bool = False, direct_download_url: str
exit_message()
return
# run one command after another from the command list
if command_list is not None:
for command in command_list:
print(f">> {command}")
if next_search(search, command):
break
print(search)
exit_message()
return
# the actual cli
while True:
if next_search(search, input(">> ")):
break

View File

@ -5,7 +5,11 @@ if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(
description="A simple cli to easily test music_kraken. The full cli is in the making."
description="A simple yet powerful cli to download music with music-kraken.",
epilog="This is a cli for the developers, and it is shipped with music-krakens core.\n"
"While it is a nice and solid cli it will lack some features.\n"
"The proper cli and other frontends will be made or already have been made.\n"
"To see all current frontends check the docs at: https://github.com/HeIIow2/music-downloader"
)
# arguments for debug purposes
@ -22,11 +26,6 @@ if __name__ == "__main__":
)
# general arguments
parser.add_argument(
'-g', '--genre',
help="Specifies the genre. (Will be overwritten by -t)"
)
parser.add_argument(
'-a', '--all',
action="store_true",
@ -34,6 +33,11 @@ if __name__ == "__main__":
"For example weird compilations from musify."
)
parser.add_argument(
'-g', '--genre',
help="Specifies the genre. (Will be overwritten by -t)"
)
parser.add_argument(
'-u', '--url',
help="Downloads the content of given url."