Skip to content

Commit ddd5147

Browse files
committed
add automated setup and run scripts for Windows and macOS
- setup_windows.bat: automated Windows setup with virtual environment - setup_macos.sh: automated macOS/Linux setup with virtual environment - run_windows.bat: quick Windows launcher - run_macos.sh: quick macOS/Linux launcher - SCRIPTS_INFO.md: comprehensive documentation for all scripts - update README.md with quick setup instructions Windows users can now double-click setup_windows.bat for one-click setup macOS/Linux users can run ./setup_macos.sh for automated installation Both platforms have quick launchers for daily use
1 parent 30e5054 commit ddd5147

6 files changed

Lines changed: 415 additions & 1 deletion

File tree

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,28 @@ A graphical user interface for FFmpeg video conversion with both PyQt6 and Tkint
2626
- Python 3.8 or higher
2727
- FFmpeg (can be downloaded through the application)
2828

29-
### From Source
29+
### Quick Setup (Automated Scripts)
30+
31+
**Windows:**
32+
```cmd
33+
# Double-click setup_windows.bat or run in Command Prompt:
34+
setup_windows.bat
35+
36+
# Then run the application:
37+
run_windows.bat
38+
```
39+
40+
**macOS/Linux:**
41+
```bash
42+
# Make executable and run setup:
43+
chmod +x setup_macos.sh
44+
./setup_macos.sh
45+
46+
# Then run the application:
47+
./run_macos.sh
48+
```
49+
50+
### Manual Installation
3051

3152
1. **Clone the repository:**
3253
```bash

SCRIPTS_INFO.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# Setup Scripts Documentation
2+
3+
## Automated Setup Scripts
4+
5+
The repository includes automated setup scripts for easy installation on different platforms.
6+
7+
### Windows Scripts
8+
9+
#### `setup_windows.bat`
10+
**Purpose:** Automated setup for Windows systems
11+
**Usage:** Double-click or run `setup_windows.bat` in Command Prompt
12+
13+
**What it does:**
14+
1. Checks if Python is installed and accessible
15+
2. Creates virtual environment (`.venv`) if not exists
16+
3. Activates virtual environment
17+
4. Upgrades pip to latest version
18+
5. Installs all dependencies from `requirements.txt`
19+
6. Displays usage instructions
20+
21+
**Error handling:**
22+
- Verifies Python installation
23+
- Checks virtual environment creation
24+
- Validates dependency installation
25+
- Provides helpful error messages
26+
27+
#### `run_windows.bat`
28+
**Purpose:** Quick launcher for the application
29+
**Usage:** Double-click or run `run_windows.bat`
30+
31+
**What it does:**
32+
1. Checks if virtual environment exists
33+
2. Activates virtual environment
34+
3. Launches PyQt6 GUI application
35+
4. Keeps window open if errors occur
36+
37+
### macOS/Linux Scripts
38+
39+
#### `setup_macos.sh`
40+
**Purpose:** Automated setup for macOS and Linux systems
41+
**Usage:** `chmod +x setup_macos.sh && ./setup_macos.sh`
42+
43+
**What it does:**
44+
1. Checks if Python 3 is installed
45+
2. Creates virtual environment using `python3 -m venv`
46+
3. Activates virtual environment
47+
4. Upgrades pip to latest version
48+
5. Installs all dependencies from `requirements.txt`
49+
6. Provides usage instructions including Makefile options
50+
51+
**Error handling:**
52+
- Exits on any error (`set -e`)
53+
- Verifies Python 3 availability
54+
- Checks requirements.txt existence
55+
- Clear error messages with installation hints
56+
57+
#### `run_macos.sh`
58+
**Purpose:** Quick launcher for the application
59+
**Usage:** `./run_macos.sh`
60+
61+
**What it does:**
62+
1. Checks if virtual environment exists
63+
2. Activates virtual environment
64+
3. Launches PyQt6 GUI application
65+
66+
## Usage Examples
67+
68+
### First-time Setup
69+
70+
**Windows:**
71+
```cmd
72+
# Download/clone repository
73+
cd ffmpeg-gui-pyqt6
74+
75+
# Run setup (creates venv and installs dependencies)
76+
setup_windows.bat
77+
78+
# Run application
79+
run_windows.bat
80+
```
81+
82+
**macOS/Linux:**
83+
```bash
84+
# Download/clone repository
85+
cd ffmpeg-gui-pyqt6
86+
87+
# Make scripts executable and run setup
88+
chmod +x setup_macos.sh run_macos.sh
89+
./setup_macos.sh
90+
91+
# Run application
92+
./run_macos.sh
93+
```
94+
95+
### Daily Usage
96+
97+
After initial setup, just use the run scripts:
98+
99+
**Windows:** Double-click `run_windows.bat`
100+
**macOS/Linux:** `./run_macos.sh`
101+
102+
## Troubleshooting
103+
104+
### Windows Issues
105+
106+
**"Python is not recognized"**
107+
- Install Python from [python.org](https://www.python.org/downloads/)
108+
- **IMPORTANT:** Check "Add Python to PATH" during installation
109+
- Restart Command Prompt after installation
110+
111+
**"Access is denied" on .bat files**
112+
- Right-click → "Run as administrator"
113+
- Or adjust execution policies in PowerShell
114+
115+
**Antivirus blocks scripts**
116+
- Add repository folder to antivirus exceptions
117+
- Some antivirus software blocks .bat files by default
118+
119+
### macOS/Linux Issues
120+
121+
**"Permission denied"**
122+
- Make scripts executable: `chmod +x *.sh`
123+
- Check file permissions: `ls -la *.sh`
124+
125+
**"python3: command not found"**
126+
- Install Python 3: `brew install python` (macOS) or `sudo apt install python3` (Linux)
127+
- Use full path: `/usr/bin/python3` instead of `python3`
128+
129+
**Virtual environment creation fails**
130+
- Install venv module: `sudo apt install python3-venv` (Linux)
131+
- Use alternative: `python3 -m pip install virtualenv`
132+
133+
## Manual Alternative
134+
135+
If scripts don't work, you can always use manual installation:
136+
137+
```bash
138+
# Create virtual environment
139+
python -m venv .venv # Windows
140+
python3 -m venv .venv # macOS/Linux
141+
142+
# Activate virtual environment
143+
.venv\Scripts\activate.bat # Windows
144+
source .venv/bin/activate # macOS/Linux
145+
146+
# Install dependencies
147+
pip install -r requirements.txt
148+
149+
# Run application
150+
python GUI_pyqt6_WINFF.py
151+
```
152+
153+
## Integration with Build System
154+
155+
The scripts complement the existing build system:
156+
157+
**Development workflow:**
158+
1. `setup_windows.bat` or `./setup_macos.sh` - Initial setup
159+
2. `run_windows.bat` or `./run_macos.sh` - Daily usage
160+
3. `make build-macos` or build process - Create executables
161+
162+
**Alternative Makefile usage (macOS/Linux):**
163+
```bash
164+
make venv install # Equivalent to setup script
165+
make run-pyqt # Equivalent to run script
166+
make build-macos # Additional build functionality
167+
```

run_macos.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
# FFmpeg GUI - macOS/Linux Run Script
3+
# Quick launcher for the application
4+
5+
echo "==========================================="
6+
echo "FFmpeg GUI - Starting Application"
7+
echo "==========================================="
8+
echo ""
9+
10+
# Check if virtual environment exists
11+
if [ ! -d ".venv" ]; then
12+
echo "Virtual environment not found!"
13+
echo "Please run ./setup_macos.sh first to set up the environment."
14+
echo ""
15+
exit 1
16+
fi
17+
18+
# Activate virtual environment
19+
source .venv/bin/activate
20+
21+
# Check if GUI file exists
22+
if [ ! -f "GUI_pyqt6_WINFF.py" ]; then
23+
echo "GUI_pyqt6_WINFF.py not found!"
24+
echo "Make sure you are in the correct directory."
25+
echo ""
26+
exit 1
27+
fi
28+
29+
# Run the PyQt6 version
30+
echo "Starting FFmpeg GUI (PyQt6 version)..."
31+
echo ""
32+
python GUI_pyqt6_WINFF.py

run_windows.bat

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@echo off
2+
REM FFmpeg GUI - Windows Run Script
3+
REM Quick launcher for the application
4+
5+
echo ===========================================
6+
echo FFmpeg GUI - Starting Application
7+
echo ===========================================
8+
echo.
9+
10+
REM Check if virtual environment exists
11+
if not exist ".venv" (
12+
echo Virtual environment not found!
13+
echo Please run setup_windows.bat first to set up the environment.
14+
echo.
15+
pause
16+
exit /b 1
17+
)
18+
19+
REM Activate virtual environment
20+
call .venv\Scripts\activate.bat
21+
22+
REM Check if GUI file exists
23+
if not exist "GUI_pyqt6_WINFF.py" (
24+
echo GUI_pyqt6_WINFF.py not found!
25+
echo Make sure you are in the correct directory.
26+
echo.
27+
pause
28+
exit /b 1
29+
)
30+
31+
REM Run the PyQt6 version
32+
echo Starting FFmpeg GUI (PyQt6 version)...
33+
echo.
34+
python GUI_pyqt6_WINFF.py
35+
36+
REM Keep window open if there was an error
37+
if %errorlevel% neq 0 (
38+
echo.
39+
echo Application exited with error code %errorlevel%
40+
pause
41+
)

setup_macos.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
# FFmpeg GUI - macOS/Linux Setup Script
3+
# This script sets up the virtual environment and installs dependencies
4+
5+
set -e # Exit on any error
6+
7+
echo "==========================================="
8+
echo "FFmpeg GUI - macOS/Linux Setup"
9+
echo "==========================================="
10+
echo ""
11+
12+
# Check if Python is installed
13+
if ! command -v python3 &> /dev/null; then
14+
echo "ERROR: Python 3 not found!"
15+
echo ""
16+
echo "Please install Python 3.8+ from:"
17+
echo "- macOS: https://www.python.org/downloads/ or 'brew install python'"
18+
echo "- Linux: 'sudo apt install python3 python3-venv python3-pip'"
19+
echo ""
20+
exit 1
21+
fi
22+
23+
echo "Python version:"
24+
python3 --version
25+
echo ""
26+
27+
# Create virtual environment if it doesn't exist
28+
if [ ! -d ".venv" ]; then
29+
echo "Creating virtual environment..."
30+
python3 -m venv .venv
31+
echo "Virtual environment created successfully!"
32+
else
33+
echo "Virtual environment already exists."
34+
fi
35+
echo ""
36+
37+
# Activate virtual environment
38+
echo "Activating virtual environment..."
39+
source .venv/bin/activate
40+
41+
# Upgrade pip
42+
echo "Upgrading pip..."
43+
python -m pip install --upgrade pip
44+
45+
# Install requirements
46+
echo "Installing dependencies..."
47+
if [ -f "requirements.txt" ]; then
48+
pip install -r requirements.txt
49+
echo "Dependencies installed successfully!"
50+
else
51+
echo "ERROR: requirements.txt not found!"
52+
exit 1
53+
fi
54+
55+
echo ""
56+
echo "==========================================="
57+
echo "Setup completed successfully!"
58+
echo "==========================================="
59+
echo ""
60+
echo "To run the application:"
61+
echo "1. Activate virtual environment: source .venv/bin/activate"
62+
echo "2. Run PyQt6 version: python GUI_pyqt6_WINFF.py"
63+
echo "3. Or run Tkinter version: python GUI_tkinter_WINFF.py"
64+
echo ""
65+
echo "To build macOS application:"
66+
echo "1. Activate virtual environment: source .venv/bin/activate"
67+
echo "2. Run: python build_macos.py"
68+
echo ""
69+
echo "Alternative: use Makefile commands"
70+
echo "- make venv install"
71+
echo "- make run-pyqt"
72+
echo "- make build-macos"
73+
echo ""

0 commit comments

Comments
 (0)