-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·95 lines (81 loc) · 2.56 KB
/
run.sh
File metadata and controls
executable file
·95 lines (81 loc) · 2.56 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
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/bash
# Tplayer — Run locally
set -e
CYAN='\033[0;36m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${CYAN}"
echo " ██████╗ ██████╗ ██╗██╗ ██╗"
echo " ██╔══██╗██╔══██╗██║██║ ██║"
echo " ██████╔╝██████╔╝██║██║ ██║"
echo " ██╔══██╗██╔══██╗██║██║ ██║"
echo " ██████╔╝██║ ██║██║███████╗███████╗"
echo " ╚═════╝ ╚═╝ ╚═╝╚═╝╚══════╝╚══════╝"
echo -e "${NC}"
echo -e " ${YELLOW}A beautiful Spotify-like music player for Linux${NC}"
echo ""
# Check prerequisites
check() {
if ! command -v $1 &> /dev/null; then
# Also check common alternate locations
local found=""
for loc in "$HOME/.local/bin/$1" "/usr/local/bin/$1" "/usr/bin/$1"; do
if [ -f "$loc" ]; then
found="$loc"
break
fi
done
if [ -n "$found" ]; then
echo -e " ${GREEN}✓${NC} $2 (at $found)"
return 0
fi
echo -e " ${RED}✗${NC} $2 not found — $3"
return 1
fi
echo -e " ${GREEN}✓${NC} $2"
return 0
}
echo -e " ${YELLOW}Checking prerequisites...${NC}"
MISSING=0
check "node" "Node.js" "install from nodejs.org" || MISSING=1
check "npm" "npm" "included with Node.js" || MISSING=1
check "ffmpeg" "FFmpeg" "sudo apt install ffmpeg" || MISSING=1
check "yt-dlp" "yt-dlp" "pip install yt-dlp" || MISSING=1
if [ $MISSING -eq 1 ]; then
echo ""
echo -e " ${RED}Missing dependencies — install the items above first.${NC}"
exit 1
fi
echo ""
# Node version check
NODE_VER=$(node -v | sed 's/v//' | cut -d. -f1)
if [ "$NODE_VER" -lt 18 ]; then
echo -e " ${RED}✗${NC} Node.js 18+ required (you have $(node -v))"
exit 1
fi
echo -e " ${GREEN}✓${NC} Node.js $(node -v)"
# Install deps if needed
if [ ! -d "node_modules" ]; then
echo ""
echo -e " ${YELLOW}Installing dependencies...${NC}"
npm install
fi
echo ""
# Build
echo -e " ${YELLOW}Building...${NC}"
npm run build
# Check build output
if [ ! -f "out/main/index.js" ] || [ ! -f "out/renderer/index.html" ]; then
echo -e " ${RED}✗${NC} Build failed — output files missing"
exit 1
fi
echo -e " ${GREEN}✓${NC} Build successful"
echo ""
# Launch
echo -e " ${GREEN}Starting Tplayer...${NC}"
echo ""
echo -e " ${YELLOW}Press Ctrl+C to quit${NC}"
echo ""
npm run dev