-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·105 lines (92 loc) · 2.52 KB
/
setup.sh
File metadata and controls
executable file
·105 lines (92 loc) · 2.52 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
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# Plex Tuner Setup Script
# This script sets up a Python virtual environment and installs dependencies
set -e # Exit on error
echo "🎵 Plex Tuner Setup"
echo "==================="
echo ""
# Check Python version
if ! command -v python3 &> /dev/null; then
echo "❌ Error: python3 is not installed"
echo "Please install Python 3.7 or higher"
exit 1
fi
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1,2)
echo "✓ Found Python $PYTHON_VERSION"
# Check if venv already exists
if [ -d "venv" ]; then
echo "⚠️ Virtual environment already exists"
read -p "Do you want to recreate it? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Removing existing virtual environment..."
rm -rf venv
else
echo "Using existing virtual environment"
fi
fi
# Create virtual environment if it doesn't exist
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
echo "✓ Virtual environment created"
fi
# Activate virtual environment
echo "Activating virtual environment..."
source venv/bin/activate
# Upgrade pip
echo "Upgrading pip..."
pip install --upgrade pip --quiet
# Install dependencies
echo "Installing dependencies..."
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt
echo "✓ Dependencies installed"
else
echo "⚠️ Warning: requirements.txt not found"
fi
# Check for system dependencies (Raspberry Pi specific)
if [ -f "/proc/device-tree/model" ]; then
MODEL=$(cat /proc/device-tree/model)
if [[ $MODEL == *"Raspberry Pi"* ]]; then
echo ""
echo "📱 Raspberry Pi detected"
echo "Make sure I2C is enabled:"
echo " sudo raspi-config"
echo " → Interface Options → I2C → Enable"
echo ""
echo "To install system dependencies, run:"
echo " sudo apt-get update"
echo " sudo apt-get install python3-dev i2c-tools"
fi
fi
# Create presets.json if it doesn't exist
if [ ! -f "presets.json" ]; then
echo "Creating presets.json..."
cat > presets.json << 'EOF'
{
"1": {},
"2": {},
"3": {},
"4": {},
"5": {},
"6": {},
"7": {},
"8": {}
}
EOF
echo "✓ presets.json created"
fi
echo ""
echo "✅ Setup complete!"
echo ""
echo "To run the application:"
echo " 1. Activate the virtual environment:"
echo " source venv/bin/activate"
echo ""
echo " 2. Run the application:"
echo " python3 plex_tuner.py"
echo ""
echo " 3. Open the web UI:"
echo " http://localhost:5000"
echo ""