Add Spotify Version Handling (#14)

This commit is contained in:
jetfir3 2022-11-21 11:49:05 -05:00 committed by GitHub
parent 8240a1d884
commit 8bab1a81cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
SPOTX_VERSION="1.1.84.716-1"
# Dependencies check # Dependencies check
command -v perl >/dev/null || { echo -e "\nperl was not found, exiting...\n" >&2; exit 1; } command -v perl >/dev/null || { echo -e "\nperl was not found, exiting...\n" >&2; exit 1; }
command -v unzip >/dev/null || { echo -e "\nunzip was not found, exiting...\n" >&2; exit 1; } command -v unzip >/dev/null || { echo -e "\nunzip was not found, exiting...\n" >&2; exit 1; }
@ -34,6 +36,9 @@ echo "SpotX-Linux by @SpotX-CLI"
echo "**************************" echo "**************************"
echo echo
# Report SpotX version
echo -e "SpotX-Linux version: ${SPOTX_VERSION}\n"
# Locate install directory # Locate install directory
if [ -z ${INSTALL_PATH+x} ]; then if [ -z ${INSTALL_PATH+x} ]; then
INSTALL_PATH=$(readlink -e `type -p spotify` 2>/dev/null | rev | cut -d/ -f2- | rev) INSTALL_PATH=$(readlink -e `type -p spotify` 2>/dev/null | rev | cut -d/ -f2- | rev)
@ -63,6 +68,15 @@ else
echo -e "No xpui found in directory provided with -P.\nPlease confirm directory and try again or re-install Spotify.\nExiting...\n" echo -e "No xpui found in directory provided with -P.\nPlease confirm directory and try again or re-install Spotify.\nExiting...\n"
exit; fi; fi exit; fi; fi
# Find client version
CLIENT_VERSION=$("${INSTALL_PATH}"/spotify --version | cut -dn -f2- | rev | cut -d. -f2- | rev)
# Version function for version comparison
function ver { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
# Report Spotify version
echo -e "\nSpotify version: ${CLIENT_VERSION}\n"
# Path vars # Path vars
CACHE_PATH="${HOME}/.cache/spotify/" CACHE_PATH="${HOME}/.cache/spotify/"
XPUI_PATH="${INSTALL_PATH}/Apps" XPUI_PATH="${INSTALL_PATH}/Apps"