-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·95 lines (73 loc) · 2.62 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh
if [ `id -u` -ne 0 ]
then
echo "Please run this script with root privileges!"
echo "Try again with sudo."
exit 0
fi
echo "This script will install SpotDownloader"
echo "SpotDownloader will install necessary dependencies for program to work"
echo "Do you wish to continue? (y/n)"
while true; do
read -p "" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit 0;;
* ) echo "Please answer with Yes or No [y|n].";;
esac
done
echo ""
echo "============================================================"
echo ""
echo "Installing necessary dependencies... (This could take a while)"
echo ""
echo "============================================================"
apt-get update
apt-get install -y python-pip git ffmpeg jq python3-pip python3.6
echo "============================================================"
if [ "$?" = "1" ]
then
echo "An unexpected error occured during apt-get!"
exit 0
fi
echo ""
echo "============================================================"
echo ""
echo "Configuring Spotify Credentials..."
echo ""
echo "============================================================"
echo "All this data asked here is needed to access your private playlist. To get started, create an app on https://developers.spotify.com/, and get all the data that will be asked."
echo ""
echo "Tell me your spotify client ID: "
read clientId
echo "Tell me your spotify client SECRET ( It is very secret booo!): "
read clientSecret
echo "Tell me your spotify redirect URI: "
read redirectUri
jq -n --arg id "$clientId" --arg redirect "$redirectUri" \--arg secret "$clientSecret" '{ "SPOTIPY_CLIENT_ID":"\($id)","SPOTIPY_CLIENT_SECRET":"\($secret)","SPOTIPY_REDIRECT_URI":"\($redirect)" }' > temp_keys.json
mv temp_keys.json keys.json
echo "To set them manually (if you need to)"
echo "Open the keys.json file"
echo ""
echo "============================================================"
echo ""
echo "Cloning project from GitHub.."
echo ""
echo "============================================================"
if ! [ -x "$(command -v pip3)" ]; then
echo 'Error: PIP software for python3 (pip3) is not installed. I will install it for you!' >&2
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python3 get-pip.py --user
fi
pip3 install SpotDownloader
if [ "$?" = "1" ]
then
echo "An unexpected error occured during pip install!"
exit 0
fi
echo "============================================================"
echo "Setup was successful."
echo "You can run 'python SpotDownloader.py -h' to see how to start downloading playlists!"
echo "============================================================"
sleep 2
exit 0