From 05ea08ec806b84856e1fb1243bfa8e0ca5d36905 Mon Sep 17 00:00:00 2001 From: Tumble Date: Thu, 21 Oct 2021 13:31:57 +0100 Subject: [PATCH] files --- beat-saver.desktop | 7 +++++++ beat-saver.sh | 31 +++++++++++++++++++++++++++++++ install.sh | 7 +++++++ 3 files changed, 45 insertions(+) create mode 100644 beat-saver.desktop create mode 100755 beat-saver.sh create mode 100755 install.sh diff --git a/beat-saver.desktop b/beat-saver.desktop new file mode 100644 index 0000000..e52c72b --- /dev/null +++ b/beat-saver.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=Beat Saver One Click (beatsaver://) +Exec=beat-saver.sh %u +StartupNotify=false +MimeType=x-scheme-handler/beatsaver; +Terminal=true \ No newline at end of file diff --git a/beat-saver.sh b/beat-saver.sh new file mode 100755 index 0000000..953ab9d --- /dev/null +++ b/beat-saver.sh @@ -0,0 +1,31 @@ +#!/bin/bash +INPUT=$1 +ID=`basename $INPUT` +URL="https://api.beatsaver.com/download/key/${ID}" + +if [ ! -n "${BEATSABER_DIR}" ]; then + read -p "Press any key to start . . ." +fi + +if [ ! -n "${BEATSABER_DIR}" ]; then +env|grep beat + read -p 'Enter location to BeatSaber: ' BEATSABER_DIR + echo "export BEATSABER_DIR=\"${BEATSABER_DIR}\"">>~/.bash_profile + mkdir -p "${BEATSABER_DIR}/Beat Saber_Data/CustomLevels" +fi + +cd /tmp +mkdir "beatsaver_${ID}" +cd "beatsaver_${ID}" +rm -rf * +wget ${URL} -O map.zip +unzip map.zip -d map +cd map +DIR_NAME="${ID} ($(cat Info.dat | jq -r ._songName))" +cd .. +mv map "${DIR_NAME}" +cp -r "${DIR_NAME}" "${BEATSABER_DIR}/Beat Saber_Data/CustomLevels" + +echo "----------------------------------------------------------------" +echo "Installed: ${DIR_NAME}" +echo "----------------------------------------------------------------" \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..c73ca41 --- /dev/null +++ b/install.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cp beat-saver.desktop ~/.local/share/applications +cp beat-saver.sh ~/.local/share/ + + +sed -i 's/beat-saver.sh/~\/.local\/share\/beat-saver.sh/' ~/.local/share/applications/beat-saver.desktop \ No newline at end of file