spotify-cli.pl - Script to interact with Spotify API in various ways.
spotify-cli.pl
perl bin/spotify-cli.pl -i
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.
Your registered Spotify Application Client ID Can be set as environment variable client_id
Your registered Spotify Application Client Secret Can be set as environment variable client_secret
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
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.
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.
callback
Log level used. with default being Info.
Available Commands:
Play - Player -> start_a_users_playback
Pause - Player -> pause_a_users_playback
Next - Player -> skip_users_playback_to_next_track
Previous - Player -> skip_users_playback_to_previous_track
FastForward the current playing track with the passed.
Set the current playing track position to the passed second.
Toggle Shuffle for current Playback context.
Current Track - Player -> get_information_about_the_users_current_playback
Available Devices - Player -> get_a_users_available_devices
Selects a device, That will be used for Player API during this session.
Transfer playback to device and start playing.
Sets the current active device's volume.
Like the current playing song.
Remove the current playing song from Liked.
Current track Audio Features.
Find in Current Contenxt Track with more than the passed danceablitiy leve.
Get a list of available recommendation genres
Get your top tracks | artists. where time_range => s:short_term, m:medium_term, l:long_term
add the track as a seed track (will keep latest selected 2 only)
add the artist as a seed track (will keep latest selected 2 only)
Get you a random track based on passed Genre, Tracks and Artists used as seed, Auto for them to be your top tracks and artists. and manual for selected seeded ones. Also accepts constrains on track features.
Current user Info.
Search for a track
List user's playlists.
Creates a new playlist for user.
Selects a playlist, passing a second parameter will play it too.
Adds the current playing track to a playlist. If no PlaylistID passed it will use selected.
Removes the current playing track from a playlist. If no PlaylistID passed it will use selected.
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.
To install Net::Async::Spotify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::Spotify
CPAN shell
perl -MCPAN -e shell install Net::Async::Spotify
For more information on module installation, please visit the detailed CPAN module installation guide.