Self Hosted YT-DLP MP3 Downloader -- Modern UI/UX & File Management -- MeTube Fork
mp3
docker
selfhosting
media
management
files
music
1#!/bin/bash
2
3# Development setup script for M4.Manager
4set -e
5
6echo "🎵 Setting up M4.Manager development environment..."
7
8# Colors for output
9GREEN='\033[0;32m'
10BLUE='\033[0;34m'
11YELLOW='\033[1;33m'
12NC='\033[0m' # No Color
13
14# Check if we're in the right directory
15if [ ! -f "pyproject.toml" ] || [ ! -d "ui" ]; then
16 echo "❌ Error: Please run this script from the M4.Manager root directory"
17 exit 1
18fi
19
20# Create directories
21echo -e "${BLUE}📁 Creating directories...${NC}"
22mkdir -p downloads/.metube
23mkdir -p ui/dist
24
25# Setup Python backend
26echo -e "${BLUE}🐍 Setting up Python backend...${NC}"
27if command -v uv &> /dev/null; then
28 echo "Using uv for Python dependencies..."
29 uv sync --dev
30 PYTHON_CMD="uv run python"
31else
32 echo "⚠️ uv not found. Using system Python (make sure dependencies are installed)"
33 PYTHON_CMD="python3"
34fi
35
36# Setup Frontend
37echo -e "${BLUE}📦 Setting up Frontend dependencies...${NC}"
38cd ui
39if command -v pnpm &> /dev/null; then
40 echo "Using pnpm..."
41 corepack enable 2>/dev/null || true
42 pnpm install
43 PACKAGE_MANAGER="pnpm"
44elif command -v npm &> /dev/null; then
45 echo "Using npm..."
46 npm install
47 PACKAGE_MANAGER="npm"
48else
49 echo "❌ Error: No package manager (pnpm/npm) found"
50 exit 1
51fi
52cd ..
53
54# Build frontend for development
55echo -e "${BLUE}🔨 Building frontend...${NC}"
56cd ui
57if [ "$PACKAGE_MANAGER" = "pnpm" ]; then
58 pnpm run build
59else
60 npm run build
61fi
62cd ..
63
64echo -e "${GREEN}✅ Development environment setup complete!${NC}"
65echo ""
66echo -e "${YELLOW}To start the development server:${NC}"
67echo " Backend: $PYTHON_CMD app/main.py"
68echo " Frontend: cd ui && $PACKAGE_MANAGER start"
69echo ""
70echo -e "${YELLOW}Or use the dev-start.sh script to run both:${NC}"
71echo " ./dev-start.sh"