2022-11-15 12:04:44 +00:00
|
|
|
import music_kraken
|
2022-11-09 21:52:32 +00:00
|
|
|
|
2022-10-14 14:55:23 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-04-12 11:02:19 +00:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(
|
2023-04-12 11:27:42 +00:00
|
|
|
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"
|
2023-04-12 11:02:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# arguments for debug purposes
|
|
|
|
parser.add_argument(
|
|
|
|
'-v', '--verbose',
|
|
|
|
action="store_true",
|
|
|
|
help="Sets the logging level to debug."
|
|
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
'-t', '--test',
|
|
|
|
action="store_true",
|
|
|
|
help="For the sake of testing. Equals: '-v -g test'"
|
|
|
|
)
|
|
|
|
|
|
|
|
# general arguments
|
|
|
|
parser.add_argument(
|
|
|
|
'-a', '--all',
|
|
|
|
action="store_true",
|
|
|
|
help="If set it will download EVERYTHING the music downloader can find.\n"
|
|
|
|
"For example weird compilations from musify."
|
|
|
|
)
|
|
|
|
|
2023-04-12 11:27:42 +00:00
|
|
|
parser.add_argument(
|
|
|
|
'-g', '--genre',
|
|
|
|
help="Specifies the genre. (Will be overwritten by -t)"
|
|
|
|
)
|
|
|
|
|
2023-04-12 11:13:02 +00:00
|
|
|
parser.add_argument(
|
|
|
|
'-u', '--url',
|
|
|
|
help="Downloads the content of given url."
|
|
|
|
)
|
|
|
|
|
2023-04-12 11:02:19 +00:00
|
|
|
arguments = parser.parse_args()
|
|
|
|
|
|
|
|
if arguments.verbose or arguments.test:
|
|
|
|
import logging
|
|
|
|
print("Setting logging-level to DEBUG")
|
|
|
|
logging.getLogger().setLevel(logging.DEBUG)
|
|
|
|
|
|
|
|
# getting the genre
|
|
|
|
genre: str = arguments.genre
|
|
|
|
if arguments.test:
|
|
|
|
genre = "test"
|
|
|
|
|
2023-04-14 09:22:47 +00:00
|
|
|
try:
|
|
|
|
music_kraken.cli(
|
|
|
|
genre=genre,
|
|
|
|
download_all=arguments.all,
|
|
|
|
direct_download_url=arguments.url
|
|
|
|
)
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
print("\n\nRaise an issue if I fucked up:\nhttps://github.com/HeIIow2/music-downloader/issues")
|
|
|
|
music_kraken.exit_message()
|