-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·62 lines (55 loc) · 2.32 KB
/
setup.sh
File metadata and controls
executable file
·62 lines (55 loc) · 2.32 KB
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
#!/bin/bash
# ─────────────────────────────────────────────
# Spotify Now Playing Display - Setup Script
# Works on macOS and Raspberry Pi
# ─────────────────────────────────────────────
PORT=8888
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FILE="nowplaying.html"
echo ""
echo " ♫ Spotify Now Playing Display"
echo " ────────────────────────────────"
echo ""
# Check the HTML file exists
if [ ! -f "$DIR/$FILE" ]; then
echo " ✗ $FILE not found in $DIR"
echo " Save the HTML artifact as '$FILE' in the same folder as this script."
exit 1
fi
echo " ✓ Found $FILE"
echo ""
# ─────────────────────────────────────────────
# STEP 1: Spotify App Setup Reminder
# ─────────────────────────────────────────────
echo " Before starting, make sure you've done this:"
echo ""
echo " 1. Go to https://developer.spotify.com/dashboard"
echo " 2. Create an app (any name)"
echo " 3. In app settings, add this Redirect URI:"
echo ""
echo " http://127.0.0.1:$PORT/$FILE"
echo ""
echo " ⚠ Use 127.0.0.1, NOT localhost (Spotify requires it)"
echo ""
echo " 4. Save your Client ID and Client Secret"
echo ""
read -p " Press Enter when ready..."
# ─────────────────────────────────────────────
# STEP 2: Start local server
# ─────────────────────────────────────────────
echo ""
echo " Starting local server on port $PORT..."
echo ""
echo " ➜ Open this in your browser:"
echo ""
echo " http://127.0.0.1:$PORT/$FILE"
echo ""
echo " ⚠ Use 127.0.0.1, NOT localhost"
echo ""
echo " Enter your Client ID & Secret on screen, then authorize."
echo " Once connected, it runs forever (tokens auto-refresh)."
echo ""
echo " Press Ctrl+C to stop the server."
echo ""
cd "$DIR"
python3 -m http.server $PORT --bind 127.0.0.1