NAME

spotify-cli.pl - Script to interact with Spotify API in various ways.

SYNOPSIS

perl bin/spotify-cli.pl -i

DESCRIPTION

This script allows you to interact with Spotify API in multiple different ways. Providing you with a convinent way to query Spotify API by either the set of predefined commands or inline requests.

OPTIONS

-c, --client-id=Spotify App Client ID

Your registered Spotify Application Client ID Can be set as environment variable client_id

-s, --client-secret=Spotify APP Client Secret

Your registered Spotify Application Client Secret Can be set as environment variable client_secret

-t, --access-token=Spotify Client Access Token

Optional, if passed there will be no need to obtain token and requests can be directly called using it. Can be set as environment variable access_token

-i, --interactive

If exists it will run this script in interactive mode, where it will continuously wait for a command to perform. However manual handling for Authentication process.

-w, --web-server

If exists it will make the script run in interactive mode, with an HTTP Webserver running in background listening to port 80 on localhost. So it can process Spotify callback GET requests automatically. and can be extended to receive commands. Note: define http://localhost/callback as a Redirect URI in your Spotify App settings. Also if running in Docker, then run container with -p 127.0.0.1:80:80/tcp option.

-l debug, --log-level=info

Log level used. with default being Info.

COMMANDS

Available Commands:

CMD => p

Play - Player -> start_a_users_playback

CMD => pu

Pause - Player -> pause_a_users_playback

CMD => n

Next - Player -> skip_users_playback_to_next_track

CMD => b

Previous - Player -> skip_users_playback_to_previous_track

CMD => c

Current Track - Player -> get_information_about_the_users_current_playback

CMD => d

Available Devices - Player -> get_a_users_available_devices

CMD => t device_id

Transfer playback to device and start playing.

CMD => v volume_percent

Sets the current active device's volume.

CMD => l

Like the current playing song.

CMD => ul

Remove the current playing song from Liked.

CMD => f

Current track Audio Features.

CMD => api_name method_name %args

Generic - Where it will take first argument as API name, second would be the method name. And whaterve comes after that would be a key value arguments.