last update

This commit is contained in:
Louis Mylle
2026-01-10 14:59:35 +01:00
parent ea4cab15c3
commit 757fc291b0
30 changed files with 22270 additions and 30 deletions

79
scripts/build_exe.bat Normal file
View File

@@ -0,0 +1,79 @@
@echo off
REM Build script for EBoek.info Scraper Windows executable
REM Run this script to compile the application into a standalone .exe file
echo =====================================
echo Building EBoek.info Scraper
echo =====================================
echo.
REM Check if PyInstaller is installed
python -c "import PyInstaller" 2>nul
if errorlevel 1 (
echo Installing PyInstaller...
python -m pip install pyinstaller
echo.
)
REM Clean previous builds
if exist "dist" rmdir /s /q "dist"
if exist "build" rmdir /s /q "build"
echo Cleaned previous builds
echo.
REM Option 1: Quick build (single file executable)
echo Building single-file executable...
echo This may take a few minutes...
echo.
pyinstaller --onefile --windowed --name "EBoek_Scraper" ^
--hidden-import "PyQt5.QtCore" ^
--hidden-import "PyQt5.QtGui" ^
--hidden-import "PyQt5.QtWidgets" ^
--hidden-import "selenium" ^
--hidden-import "selenium.webdriver" ^
--hidden-import "selenium.webdriver.chrome" ^
--hidden-import "core.scraper" ^
--hidden-import "core.scraper_thread" ^
--hidden-import "core.credentials" ^
--hidden-import "gui.main_window" ^
--hidden-import "gui.login_dialog" ^
--hidden-import "gui.progress_dialog" ^
--hidden-import "utils.validators" ^
--exclude-module "tkinter" ^
--exclude-module "matplotlib" ^
..\gui_main.py
if errorlevel 1 (
echo.
echo BUILD FAILED! Trying alternative method...
echo.
REM Option 2: Use spec file
echo Building with spec file...
pyinstaller eboek_scraper.spec
if errorlevel 1 (
echo BUILD FAILED!
echo Please check the error messages above.
pause
exit /b 1
)
)
echo.
echo =====================================
echo BUILD SUCCESSFUL!
echo =====================================
echo.
echo Your executable is located at:
echo dist\EBoek_Scraper.exe
echo.
echo File size:
dir /b "dist\EBoek_Scraper.exe" | find /v "EBoek_Scraper.exe" || echo Not found
for %%f in ("dist\EBoek_Scraper.exe") do echo %%~zf bytes
echo.
echo You can now distribute this single file!
echo Note: Windows may show a security warning on first run.
echo.
pause

96
scripts/build_exe.sh Executable file
View File

@@ -0,0 +1,96 @@
#!/bin/bash
# Build script for EBoek.info Scraper executable
# Run this script to compile the application into a standalone executable
echo "====================================="
echo "Building EBoek.info Scraper"
echo "====================================="
echo
# Check if PyInstaller is installed
python3 -c "import PyInstaller" 2>/dev/null
if [ $? -ne 0 ]; then
echo "Installing PyInstaller..."
python3 -m pip install pyinstaller
echo
fi
# Clean previous builds
if [ -d "dist" ]; then
rm -rf "dist"
fi
if [ -d "build" ]; then
rm -rf "build"
fi
echo "Cleaned previous builds"
echo
# Option 1: Quick build (single file executable)
echo "Building single-file executable..."
echo "This may take a few minutes..."
echo
python3 -m PyInstaller --onefile --windowed --name "EBoek_Scraper" \
--hidden-import "PyQt5.QtCore" \
--hidden-import "PyQt5.QtGui" \
--hidden-import "PyQt5.QtWidgets" \
--hidden-import "selenium" \
--hidden-import "selenium.webdriver" \
--hidden-import "selenium.webdriver.chrome" \
--hidden-import "core.scraper" \
--hidden-import "core.scraper_thread" \
--hidden-import "core.credentials" \
--hidden-import "gui.main_window" \
--hidden-import "gui.login_dialog" \
--hidden-import "gui.progress_dialog" \
--hidden-import "utils.validators" \
--exclude-module "tkinter" \
--exclude-module "matplotlib" \
../gui_main.py
if [ $? -ne 0 ]; then
echo
echo "BUILD FAILED! Trying alternative method..."
echo
# Option 2: Use spec file
echo "Building with spec file..."
python3 -m PyInstaller eboek_scraper.spec
if [ $? -ne 0 ]; then
echo "BUILD FAILED!"
echo "Please check the error messages above."
exit 1
fi
fi
echo
echo "====================================="
echo "BUILD SUCCESSFUL!"
echo "====================================="
echo
# Check which executable was created
if [ -f "dist/EBoek_Scraper" ]; then
EXECUTABLE="dist/EBoek_Scraper"
echo "Your executable is located at: $EXECUTABLE"
echo
echo "File size: $(du -h "$EXECUTABLE" | cut -f1)"
echo
echo "To run: ./$EXECUTABLE"
elif [ -f "dist/EBoek_Scraper.exe" ]; then
EXECUTABLE="dist/EBoek_Scraper.exe"
echo "Your executable is located at: $EXECUTABLE"
echo
echo "File size: $(du -h "$EXECUTABLE" | cut -f1)"
echo
echo "To run: ./$EXECUTABLE"
else
echo "Error: Could not find built executable!"
exit 1
fi
echo
echo "You can now distribute this single file!"
echo "Note: macOS may show a security warning on first run."
echo "Right-click and select 'Open' to bypass Gatekeeper."

172
scripts/build_executable.py Normal file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env python3
"""
Cross-platform build script for EBoek.info Scraper
Creates a standalone executable using PyInstaller
"""
import os
import sys
import subprocess
import shutil
from pathlib import Path
def run_command(command, description):
"""Run a command and handle errors."""
print(f"{description}...")
try:
result = subprocess.run(command, shell=True, capture_output=True, text=True)
if result.returncode != 0:
print(f"✗ Error: {result.stderr}")
return False
if result.stdout.strip():
print(f" {result.stdout.strip()}")
return True
except Exception as e:
print(f"✗ Exception: {e}")
return False
def main():
"""Main build process."""
print("=" * 50)
print("🚀 EBoek.info Scraper - Executable Builder")
print("=" * 50)
print()
# Change to project root directory (parent of scripts/)
script_dir = Path(__file__).parent
project_root = script_dir.parent
os.chdir(project_root)
print(f"📂 Working from: {project_root}")
print()
# Check Python version
if sys.version_info < (3, 8):
print("✗ Error: Python 3.8+ required")
sys.exit(1)
# Check if PyInstaller is installed
try:
import PyInstaller
print(f"✓ PyInstaller {PyInstaller.__version__} found")
except ImportError:
print("→ Installing PyInstaller...")
if not run_command(f"{sys.executable} -m pip install pyinstaller", "Installing PyInstaller"):
print("✗ Failed to install PyInstaller")
sys.exit(1)
# Clean previous builds
print()
for directory in ["dist", "build"]:
if Path(directory).exists():
shutil.rmtree(directory)
print(f"✓ Cleaned {directory}/")
# Determine platform-specific settings
is_windows = sys.platform.startswith('win')
exe_name = "EBoek_Scraper.exe" if is_windows else "EBoek_Scraper"
# Build command
build_cmd = [
f"{sys.executable}", "-m", "PyInstaller",
"--onefile",
"--windowed",
"--name", "EBoek_Scraper",
# Hidden imports for PyQt5
"--hidden-import", "PyQt5.QtCore",
"--hidden-import", "PyQt5.QtGui",
"--hidden-import", "PyQt5.QtWidgets",
# Hidden imports for Selenium
"--hidden-import", "selenium",
"--hidden-import", "selenium.webdriver",
"--hidden-import", "selenium.webdriver.chrome",
"--hidden-import", "selenium.webdriver.chrome.options",
"--hidden-import", "selenium.webdriver.common.by",
# Hidden imports for our modules
"--hidden-import", "core.scraper",
"--hidden-import", "core.scraper_thread",
"--hidden-import", "core.credentials",
"--hidden-import", "gui.main_window",
"--hidden-import", "gui.login_dialog",
"--hidden-import", "gui.progress_dialog",
"--hidden-import", "utils.validators",
# Exclude unnecessary modules to reduce size
"--exclude-module", "tkinter",
"--exclude-module", "matplotlib",
"--exclude-module", "numpy",
"--exclude-module", "pandas",
# Main script
"gui_main.py"
]
print()
print("🔨 Building executable...")
print("📝 This may take a few minutes...")
print()
# Run PyInstaller
try:
result = subprocess.run(build_cmd, capture_output=True, text=True)
if result.returncode != 0:
print("✗ Build failed!")
print("Error output:")
print(result.stderr)
# Try fallback with spec file
print()
print("🔄 Trying alternative build with spec file...")
spec_cmd = [f"{sys.executable}", "-m", "PyInstaller", "scripts/eboek_scraper.spec"]
result = subprocess.run(spec_cmd, capture_output=True, text=True)
if result.returncode != 0:
print("✗ Alternative build also failed!")
print(result.stderr)
sys.exit(1)
print("✓ Build completed successfully!")
except Exception as e:
print(f"✗ Build failed with exception: {e}")
sys.exit(1)
# Check if executable was created
exe_path = Path("dist") / exe_name
if not exe_path.exists():
print(f"✗ Error: Executable not found at {exe_path}")
sys.exit(1)
# Display results
file_size = exe_path.stat().st_size / (1024 * 1024) # MB
print()
print("=" * 50)
print("🎉 BUILD SUCCESSFUL!")
print("=" * 50)
print(f"📂 Executable location: {exe_path}")
print(f"📊 File size: {file_size:.1f} MB")
print()
# Platform-specific instructions
if is_windows:
print("🪟 Windows Instructions:")
print(f" • Run: {exe_path}")
print(" • Windows may show security warning on first run")
print(" • Click 'More Info''Run Anyway' if prompted")
else:
print("🍎 macOS/Linux Instructions:")
print(f" • Run: ./{exe_path}")
print(" • macOS may show security warning on first run")
print(" • Right-click and select 'Open' to bypass Gatekeeper")
print()
print("📦 Distribution:")
print(f" • Share this single file: {exe_name}")
print(" • No Python installation required on target machine")
print(" • Includes all dependencies (PyQt5, Selenium, etc.)")
print()
print("✨ Ready for distribution!")
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,44 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['../gui_main.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=['PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtWidgets', 'selenium', 'selenium.webdriver', 'selenium.webdriver.chrome', 'selenium.webdriver.chrome.options', 'selenium.webdriver.common.by', 'core.scraper', 'core.scraper_thread', 'core.credentials', 'gui.main_window', 'gui.login_dialog', 'gui.progress_dialog', 'utils.validators'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=['tkinter', 'matplotlib', 'numpy', 'pandas'],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='EBoek_Scraper',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
app = BUNDLE(
exe,
name='EBoek_Scraper.app',
icon=None,
bundle_identifier=None,
)

View File

@@ -0,0 +1,81 @@
@echo off
echo ===============================================
echo EBoek.info Scraper - Installation and Setup
echo ===============================================
echo.
REM Check if Python is installed
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo Python is not installed or not in PATH.
echo.
echo Please install Python from: https://www.python.org/downloads/
echo Make sure to check "Add Python to PATH" during installation.
echo.
pause
exit /b 1
)
echo Python found! Checking version...
for /f "tokens=2" %%i in ('python --version') do set PYTHON_VERSION=%%i
echo Python version: %PYTHON_VERSION%
REM Check if this is the first run
if exist "..\gui_main.py" (
echo GUI application already set up.
echo.
goto :run_gui
)
echo.
echo Installing required packages...
echo ===============================================
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
if %errorlevel% neq 0 (
echo.
echo ERROR: Failed to install requirements.
echo Please check your internet connection and try again.
echo You may need to run this as Administrator.
pause
exit /b 1
)
echo.
echo Requirements installed successfully!
echo Setting up GUI application...
REM The GUI files will be created by the setup process
echo.
echo ===============================================
echo Installation complete!
echo ===============================================
:run_gui
if exist "..\gui_main.py" (
echo Starting EBoek.info Scraper GUI...
echo.
python ..\gui_main.py
if %errorlevel% neq 0 (
echo.
echo GUI failed to start. You can still use the terminal version:
echo python main.py
echo.
pause
)
) else (
echo GUI version not found. Running terminal version...
echo.
if exist "main.py" (
python main.py
) else (
echo Error: No scraper found. Please check installation.
pause
exit /b 1
)
)
echo.
echo Application closed.
pause

158
scripts/install_and_run.sh Executable file
View File

@@ -0,0 +1,158 @@
#!/bin/bash
echo "==============================================="
echo " EBoek.info Scraper - Installation and Setup"
echo "==============================================="
echo
# Function to check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Check operating system
OS="$(uname -s)"
case "${OS}" in
Linux*) MACHINE=Linux;;
Darwin*) MACHINE=Mac;;
*) MACHINE="UNKNOWN:${OS}"
esac
echo "Operating System: $MACHINE"
# Check if Python is installed
if command_exists python3; then
PYTHON_CMD="python3"
elif command_exists python; then
PYTHON_VERSION=$(python --version 2>&1 | grep -oP '\d+\.\d+')
if [[ ${PYTHON_VERSION%.*} -ge 3 ]]; then
PYTHON_CMD="python"
else
echo "ERROR: Python 3 is required. Found Python $PYTHON_VERSION"
PYTHON_CMD=""
fi
else
PYTHON_CMD=""
fi
if [ -z "$PYTHON_CMD" ]; then
echo "Python 3 is not installed."
echo
if [ "$MACHINE" = "Mac" ]; then
echo "To install Python on macOS:"
echo "1. Install Homebrew: /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
echo "2. Install Python: brew install python"
echo " OR download from: https://www.python.org/downloads/"
elif [ "$MACHINE" = "Linux" ]; then
echo "To install Python on Linux:"
echo "Ubuntu/Debian: sudo apt update && sudo apt install python3 python3-pip"
echo "CentOS/RHEL: sudo yum install python3 python3-pip"
echo "Fedora: sudo dnf install python3 python3-pip"
fi
echo
echo "After installing Python, run this script again."
exit 1
fi
echo "Python found: $($PYTHON_CMD --version)"
# Check if pip is available
if ! $PYTHON_CMD -m pip --version >/dev/null 2>&1; then
echo "pip is not available. Installing pip..."
if [ "$MACHINE" = "Mac" ]; then
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$PYTHON_CMD get-pip.py
rm get-pip.py
elif [ "$MACHINE" = "Linux" ]; then
echo "Please install pip using your package manager:"
echo "Ubuntu/Debian: sudo apt install python3-pip"
echo "CentOS/RHEL: sudo yum install python3-pip"
exit 1
fi
fi
# Check if GUI is already set up
if [ -f "../gui_main.py" ]; then
echo "GUI application already set up."
echo
else
echo
echo "Installing required packages..."
echo "==============================================="
# Upgrade pip first
$PYTHON_CMD -m pip install --upgrade pip
# Install requirements
if ! $PYTHON_CMD -m pip install -r requirements.txt; then
echo
echo "ERROR: Failed to install requirements."
echo "Please check your internet connection and try again."
echo "You may need to install additional system dependencies."
if [ "$MACHINE" = "Mac" ]; then
echo
echo "On macOS, you might need to install Xcode command line tools:"
echo "xcode-select --install"
elif [ "$MACHINE" = "Linux" ]; then
echo
echo "On Linux, you might need additional packages:"
echo "Ubuntu/Debian: sudo apt install python3-dev python3-tk"
echo "CentOS/RHEL: sudo yum install python3-devel tkinter"
fi
exit 1
fi
echo
echo "Requirements installed successfully!"
echo "Setting up GUI application..."
fi
# Check for Chrome browser
if [ "$MACHINE" = "Mac" ]; then
if [ ! -d "/Applications/Google Chrome.app" ]; then
echo
echo "WARNING: Google Chrome not found."
echo "Please install Chrome from: https://www.google.com/chrome/"
echo "The scraper requires Chrome to function."
fi
elif [ "$MACHINE" = "Linux" ]; then
if ! command_exists google-chrome && ! command_exists chromium-browser; then
echo
echo "WARNING: Chrome/Chromium not found."
echo "Please install Chrome or Chromium:"
echo "Ubuntu/Debian: sudo apt install chromium-browser"
echo "Or download Chrome from: https://www.google.com/chrome/"
fi
fi
echo
echo "==============================================="
echo "Installation complete!"
echo "==============================================="
# Run the GUI application
if [ -f "../gui_main.py" ]; then
echo "Starting EBoek.info Scraper GUI..."
echo
if ! $PYTHON_CMD ../gui_main.py; then
echo
echo "GUI failed to start. You can still use the terminal version:"
echo "$PYTHON_CMD main.py"
echo
fi
else
echo "GUI version not found. Running terminal version..."
echo
if [ -f "main.py" ]; then
$PYTHON_CMD main.py
else
echo "Error: No scraper found. Please check installation."
exit 1
fi
fi
echo
echo "Application closed."
echo "Press Enter to exit..."
read