some optimisations and fixes

This commit is contained in:
tumble1999 2022-02-12 23:33:18 +00:00
parent 87a19292d9
commit e11dc01420
No known key found for this signature in database
GPG Key ID: 651CA998E1105BFA
2 changed files with 42 additions and 16 deletions

View File

@ -1,29 +1,21 @@
#!/bin/bash
#!/bin/sh
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
fi
mkdir -p "${BEATSABER_DIR}/Beat Saber_Data/CustomLevels" -v
cd /tmp
mkdir "beatsaver_${ID}" -v
cd "beatsaver_${ID}"
rm -rf *
wget ${URL} -O map.zip
unzip map.zip -d map -v
unzip map.zip -d map
cd map
DIR_NAME="${ID} ($(cat Info.dat | jq -r ._songName))"
ls
INFO=`cat Info.dat info.dat | jq -r ._songName`
echo $INFO
DIR_NAME="${ID} (${INFO})"
cd ..
mv map "${DIR_NAME}" -v
mv -v map "${DIR_NAME}"
cp -r "${DIR_NAME}" "${BEATSABER_DIR}/Beat Saber_Data/CustomLevels" -v
echo "----------------------------------------------------------------"

View File

@ -1,7 +1,41 @@
#!/bin/bash
#!/bin/sh
install_deps() {
echo "Installing dependacies"
# Debian
if which apt 1> /dev/null 2> /dev/null; then
echo "installing wget, unzip and jq from apt (sudo apt install wget unzip jq)"
sudo apt install wget unzip jq
return
fi
# Arch
if which pacman 1> /dev/null 2> /dev/null; then
echo "installing wget, unzip and jq from pacman (sudo pacman -S --needed wget unzip jq)"
sudo pacman -S --needed wget unzip jq
return
fi
echo "Linux distro not supported (yet)"
lsb_release -a
exit 1
}
install_deps
if [ ! -n "${BEATSABER_DIR}" ]; then
env|grep beat
read -p 'Enter location to BeatSaber: ' BEATSABER_DIR
echo "export BEATSABER_DIR=\"${BEATSABER_DIR}\"">>~/.bash_profile
fi
echo "Creating BeatSave Custom Folder"
mkdir -p "${BEATSABER_DIR}/Beat Saber_Data/CustomLevels" -v
echo "copying oneclick files"
cp beat-saver.desktop ~/.local/share/applications -v
cp beat-saver.sh ~/.local/share/ -v
sed -i 's/beat-saver.sh/~\/.local\/share\/beat-saver.sh/' ~/.local/share/applications/beat-saver.desktop
echo "Done"