From 86e58dcfb4dfcfbdbd8bbe29cbf8ef59859c57bf Mon Sep 17 00:00:00 2001 From: Hellow Date: Wed, 12 Apr 2023 13:27:42 +0200 Subject: [PATCH] added all currently relevant commands and cleaned up the cli. --- src/actual_donwload.py | 6 +++++- src/music_kraken/__init__.py | 19 ++++++++++++++++++- src/music_kraken/__main__.py | 16 ++++++++++------ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/actual_donwload.py b/src/actual_donwload.py index 2c2888f..8d446be 100644 --- a/src/actual_donwload.py +++ b/src/actual_donwload.py @@ -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" + ]) diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index b5f15fd..4e19530 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -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 diff --git a/src/music_kraken/__main__.py b/src/music_kraken/__main__.py index 854a3de..1306471 100644 --- a/src/music_kraken/__main__.py +++ b/src/music_kraken/__main__.py @@ -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."