diff --git a/apps/BlockTheSpot/install.bash b/apps/Spotify/wine/install-blockthespot.sh old mode 100644 new mode 100755 similarity index 100% rename from apps/BlockTheSpot/install.bash rename to apps/Spotify/wine/install-blockthespot.sh diff --git a/apps/Spotify/wine/soggfy.sh b/apps/Spotify/wine/soggfy.sh new file mode 100755 index 0000000..72e017a --- /dev/null +++ b/apps/Spotify/wine/soggfy.sh @@ -0,0 +1,60 @@ +#!/usr/bin/bash + +if (( $EUID == 0 )); then + echo "Do not run this script as root." + exit +fi + +[[ -z "${WINEPREFIX}" ]]; WINEPREFIX="$HOME/.wine" +[[ -z "${WINE}" ]]; WINE="wine" + +pfx_arch=$(grep '#arch' "$WINEPREFIX/system.reg" | cut -d "=" -f2) +echo "Wine binary: $WINE" +echo "Detected wineprefix: $WINEPREFIX ($pfx_arch)" + +download_ffmpeg() { + if [[ pfx_arch == "win64" ]]; then + repo_url="https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/latest" + else + repo_url="https://api.github.com/repos/sudo-nautilus/FFmpeg-Builds-Win32/releases/latest" + fi + asset_info=$(curl -s "$repo_url" | jq '.assets | first(.[] | select(.name | match("ffmpeg")))') + asset_name=$(echo $asset_info | jq -r '.name') + echo "Downloading $asset_name..." + curl -OL "$(echo $asset_info | jq -r '.browser_download_url')" + echo "Extracting.." + unzip -j $asset_name "${asset_name%.*}/bin/*" -d "./ffmpeg/" + rm $asset_name +} + +download_soggfy() { + repo_url="https://api.github.com/repos/Rafiuth/Soggfy/releases/latest" + asset_info=$(curl -s "$repo_url" | jq '.assets[0]') + asset_name=$(echo $asset_info | jq -r '.name') + echo "Downloading $asset_name..." + curl -OL "$(echo $asset_info | jq -r '.browser_download_url')" + echo "Extracting.." + unzip -j $asset_name "${asset_name%.*}/*" -d "." + rm $asset_name +} + +if [ ! -f ./Soggfy.js ]; then + echo "Soggfy not found, downloading..." + download_soggfy +fi + +if [ ! -d "./ffmpeg/" ]; then + echo "FFmpeg not found, downloading..." + mkdir ./ffmpeg/ + download_ffmpeg +fi + +echo "Waiting for Spotify to start..." +until _=$(pidof Spotify.exe) +do + sleep 1 +done + +echo "Injecting..." +WINEPREFIX=$WINEPREFIX $WINE Injector.exe +echo "Done."