From 898f586905b6b800c059d82697ac27f0ae3ea9fd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Mon, 20 Jul 2020 00:45:31 +0100 Subject: [PATCH] updated spotify_playlist_id_to_name.sh --- spotify_playlist_id_to_name.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/spotify_playlist_id_to_name.sh b/spotify_playlist_id_to_name.sh index 36e23308..a2c6b941 100755 --- a/spotify_playlist_id_to_name.sh +++ b/spotify_playlist_id_to_name.sh @@ -20,7 +20,10 @@ set -euo pipefail [ -n "${DEBUG:-}" ] && set -x srcdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck disable=SC2034 +# shellcheck disable=SC1090 +. "$srcdir/lib/spotify.sh" + +# shellcheck disable=SC2034,SC2154 usage_description=" Uses Spotify API to translate a Spotify public playlist ID to a name @@ -28,6 +31,8 @@ If a spotify playlist name is given instead of an ID, returns it as is A single playlist ID can be given as an argument, or a list can be passed via stdin +$usage_auth_msg + Needed by several other adjacent spotify tools Caveat: due to limitations of the Spotify API, this only works for public playlists @@ -37,9 +42,6 @@ Caveat: due to limitations of the Spotify API, this only works for public playli # shellcheck disable=SC2034 usage_args=" []" -# shellcheck disable=SC1090 -. "$srcdir/lib/utils.sh" - help_usage "$@" playlist_id_to_name(){ @@ -59,10 +61,7 @@ playlist_id_to_name(){ fi } -if [ -z "${SPOTIFY_ACCESS_TOKEN:-}" ]; then - SPOTIFY_ACCESS_TOKEN="$("$srcdir/spotify_api_token.sh")" - export SPOTIFY_ACCESS_TOKEN -fi +spotify_token if [ $# -gt 0 ]; then playlist_id="$1"