-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·108 lines (92 loc) · 2.81 KB
/
setup.sh
File metadata and controls
executable file
·108 lines (92 loc) · 2.81 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
106
107
108
#!/bin/bash
# Quick setup script for Plex-iPod sync tool
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
VENV_DIR="$SCRIPT_DIR/venv"
echo "======================================================"
echo "Plex to iPod Sync Tool - Setup"
echo "======================================================"
echo ""
# Check Python version
echo "Checking Python version..."
if ! command -v python3 &> /dev/null; then
echo "✗ Error: Python 3 not found"
echo " Please install Python 3.7 or higher"
exit 1
fi
PYTHON_VERSION=$(python3 --version | awk '{print $2}')
echo "✓ Found Python $PYTHON_VERSION"
echo ""
# Create virtual environment
if [ -d "$VENV_DIR" ]; then
echo "✓ Virtual environment already exists"
else
echo "Creating virtual environment..."
python3 -m venv "$VENV_DIR"
if [ $? -ne 0 ]; then
echo "✗ Error creating virtual environment"
exit 1
fi
echo "✓ Virtual environment created"
fi
echo ""
# Activate virtual environment
source "$VENV_DIR/bin/activate"
# Upgrade pip
echo "Upgrading pip..."
pip install --upgrade pip > /dev/null 2>&1
# Install dependencies
echo "Installing Python dependencies in virtual environment..."
pip install -r requirements.txt
if [ $? -ne 0 ]; then
echo "✗ Error installing dependencies"
deactivate
exit 1
fi
echo "✓ Dependencies installed in virtual environment"
echo ""
# Deactivate venv
deactivate
# Create config file if it doesn't exist
if [ ! -f "config.yaml" ]; then
echo "Creating config.yaml from template..."
cp config.yaml.template config.yaml
echo "✓ Config file created"
echo ""
echo "IMPORTANT: Edit config.yaml with your Plex details:"
echo " - Plex server URL"
echo " - Plex token"
echo " - Music library name"
echo ""
echo "To get your Plex token:"
echo "1. Open a media item in Plex Web"
echo "2. Click ... menu → Get Info → View XML"
echo "3. Copy the X-Plex-Token from the URL"
echo ""
read -p "Press Enter to open config.yaml in your editor..."
# Open in default editor
if command -v code &> /dev/null; then
code config.yaml
elif command -v nano &> /dev/null; then
nano config.yaml
else
open -e config.yaml
fi
else
echo "✓ config.yaml already exists"
fi
echo ""
echo "======================================================"
echo "Setup Complete!"
echo "======================================================"
echo ""
echo "Next steps:"
echo "1. Make sure config.yaml has your Plex details"
echo "2. Connect your iPod"
echo "3. Run: ./sync.sh --dry-run"
echo "4. If everything looks good: ./sync.sh"
echo ""
echo "Note: Use ./sync.sh instead of running the Python script directly"
echo " (It automatically activates the virtual environment)"
echo ""
echo "See README.md for full documentation"
echo ""