spotify_actions/examples/find_albums.py

27 lines
658 B
Python
Executable File

"""
Find an album using the `spotify_actions` API and echo its contents.
"""
from argparse import ArgumentParser
from spotify_actions.echo import echo_album
from spotify_actions.search import search_albums
from spotify_actions.util import read_credentials
def main() -> None: # pylint: disable=missing-function-docstring
parser = ArgumentParser()
parser.add_argument("-f", "--config", required=True)
parser.add_argument("search_string")
cmdline = parser.parse_args()
client = read_credentials(cmdline.config)
albums = search_albums(client, cmdline.search_string)
echo_album(albums)
if __name__ == "__main__":
main()