File size: 2,179 Bytes
65879b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# YouTube Transcript Project Setup Script
# This script configures pyenv and creates the right environment for the project

echo "πŸ“¦ Setting up YouTube Transcript Project with pyenv..."

# Check if pyenv is installed
if ! command -v pyenv &> /dev/null; then
    echo "❌ pyenv is not installed. Please install pyenv first:"
    echo "   For macOS: brew install pyenv"
    echo "   For Linux: curl https://pyenv.run | bash"
    exit 1
fi

# Install Python 3.11.7 if not already installed
if ! pyenv versions | grep -q "3.11.7"; then
    echo "πŸ”„ Installing Python 3.11.7 with pyenv..."
    pyenv install 3.11.7
else
    echo " Python 3.11.7 is already installed"
fi

# Set local Python version for this project
echo "πŸ”„ Setting local Python version to 3.11.7..."
pyenv local 3.11.7

# Check if we have a virtual environment
if [ ! -d "venv" ]; then
    echo "πŸ”„ Creating a new virtual environment..."
    python -m venv venv
else
    echo " Virtual environment already exists"
fi

# Activate the virtual environment
echo "πŸ”„ Activating virtual environment..."
source venv/bin/activate

# Upgrade pip
echo "πŸ”„ Upgrading pip..."
pip install --upgrade pip

# Install requirements
echo "πŸ”„ Installing requirements..."
pip install -r requirements.txt

# Create transcripts directory if it doesn't exist
if [ ! -d "transcripts" ]; then
    echo "πŸ”„ Creating transcripts directory..."
    mkdir -p transcripts
fi

# Create empty progress file if it doesn't exist
if [ ! -f "transcript_progress.json" ]; then
    echo "πŸ”„ Creating empty progress file..."
    echo '{
  "processed": [],
  "failed": [],
  "whisper_processed": []
}' > transcript_progress.json
    echo "⚠️ Note: Created a new empty progress file. If you have a backup, replace it with your original."
else
    echo " Progress file already exists"
fi

echo " Setup complete! You can now run:"
echo "   source venv/bin/activate  # To activate the environment"
echo "   python whisper_transcribe.py  # To run the transcription script"
echo ""
echo "⚠️ IMPORTANT: Always backup your transcript_progress.json file"
echo "   when recreating the project to preserve your download history."