Jet test flatpak 1 (#9)

* Search for Spotify directory if not found in PATH
* Update install.sh
* Confirm directory provided with `-P` exists
* Confirm xpui exists in `-P` directory
This commit is contained in:
jetfir3 2022-10-27 15:57:16 -04:00 committed by GitHub
parent c103ab7895
commit 10b877cf7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 17 deletions

View File

@ -10,9 +10,9 @@
*** ***
<center> <center>
<h4 align="center">A multi-featured adblocker for the Spotify desktop client for Linux.</h4> <h4 align="center">A multi-featured adblocker for the Spotify Linux application.</h4>
<p align="center"> <p align="center">
<strong>Last updated:</strong> 20 October 2022<br> <strong>Last updated:</strong> 27 October 2022<br>
<strong>Last tested version:</strong> 1.1.84.716 <strong>Last tested version:</strong> 1.1.84.716
</p> </p>
</center> </center>

View File

@ -27,9 +27,35 @@ while getopts 'cefP:p' flag; do
esac esac
done done
# path vars # Credits
echo
echo "**************************"
echo "SpotX-Linux by @SpotX-CLI"
echo "**************************"
echo
# 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); fi INSTALL_PATH=$(readlink -e `type -p spotify` 2>/dev/null | rev | cut -d/ -f2- | rev)
if [[ -d "${INSTALL_PATH}" ]]; then
echo "Spotify directory found in PATH: ${INSTALL_PATH}"
elif [[ ! -d "${INSTALL_PATH}" ]]; then
echo -e "\nSpotify not found in PATH. Searching for Spotify directory..."
INSTALL_PATH=$(timeout 10 find / -type f -path "*/spotify/Apps/*" -name "xpui.spa" -size -7M -size +3M -print -quit 2>/dev/null | rev | cut -d/ -f3- | rev)
if [[ -d "${INSTALL_PATH}" ]]; then
echo "Spotify directory found: ${INSTALL_PATH}"
elif [[ ! -d "${INSTALL_PATH}" ]]; then
echo "Spotify directory not found. Set directory path with -P flag.\nExiting...\n"
exit; fi; fi
else
if [[ ! -d "${INSTALL_PATH}" ]]; then
echo -e "Directory path set by -P was not found.\nExiting...\n"
exit
elif [[ ! -f "${INSTALL_PATH}/Apps/xpui.spa" ]]; then
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
# Path vars
CACHE_PATH="${HOME}/.cache/spotify/" CACHE_PATH="${HOME}/.cache/spotify/"
XPUI_PATH="${INSTALL_PATH}/Apps" XPUI_PATH="${INSTALL_PATH}/Apps"
XPUI_DIR="${XPUI_PATH}/xpui" XPUI_DIR="${XPUI_PATH}/xpui"
@ -87,21 +113,9 @@ CONNECT_2='s|connect-picker.unavailable-to-control|spotify-connect|'
CONNECT_3='s|(className:.,disabled:)(..)|$1false|' CONNECT_3='s|(className:.,disabled:)(..)|$1false|'
CONNECT_4='s/return (..isDisabled)(\?(..createElement|\(.{1,10}\))\(..,)/return false$2/' CONNECT_4='s/return (..isDisabled)(\?(..createElement|\(.{1,10}\))\(..,)/return false$2/'
# Credits
echo
echo "**************************"
echo "SpotX-Linux by @SpotX-CLI"
echo "**************************"
echo
# Detect client in PATH
if [[ ! -d "${INSTALL_PATH}" ]]; then
echo -e "\nSpotify path not found.\nSet directory path with -P flag.\nExiting...\n"
exit; fi
# xpui detection # xpui detection
if [[ ! -f "${XPUI_SPA}" ]]; then if [[ ! -f "${XPUI_SPA}" ]]; then
echo - e "\nxpui not found!\nReinstall Spotify then try again.\nExiting...\n" echo -e "\nxpui not found!\nReinstall Spotify then try again.\nExiting...\n"
exit exit
else else
if [[ ! -w "${XPUI_PATH}" ]]; then if [[ ! -w "${XPUI_PATH}" ]]; then