mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-11-01 01:21:18 +01:00
# Description of Changes This pull request introduces support for FFmpeg as a new external tool in the application. It adds configuration options for FFmpeg session limits and timeouts, updates the process execution and tool-checking utilities to handle FFmpeg, and expands endpoint configuration to include FFmpeg-dependent features. Corresponding unit tests have also been added to ensure FFmpeg detection works as expected. **FFmpeg Integration and Configuration:** * Added FFmpeg session limit and timeout configuration options to `ApplicationProperties`, with default values and getter methods. [[1]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R631) [[2]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R672-R675) [[3]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R702) [[4]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R743-R746) * Updated `ProcessExecutor` to recognize FFmpeg as a process type, and to use the new session limit and timeout configuration for FFmpeg processes. [[1]](diffhunk://#diff-8424a11112fff55cc28467c4d531e451a485911ed1aeb0aea772c9fa7dc3aa6aL305-R316) [[2]](diffhunk://#diff-8424a11112fff55cc28467c4d531e451a485911ed1aeb0aea772c9fa7dc3aa6aR74-R78) [[3]](diffhunk://#diff-8424a11112fff55cc28467c4d531e451a485911ed1aeb0aea772c9fa7dc3aa6aR133-R137) **Tool Detection and Exception Handling:** * Implemented `isFfmpegAvailable()` in `CheckProgramInstall` to detect FFmpeg installation, with caching for efficiency. [[1]](diffhunk://#diff-7b61807107c689e3824a5f8fd42c27ab072a67a5666f24445bd6895937351690R14) [[2]](diffhunk://#diff-7b61807107c689e3824a5f8fd42c27ab072a67a5666f24445bd6895937351690R60-R78) * Added a specific exception factory method for missing FFmpeg in `ExceptionUtils`. **Endpoint Configuration:** * Registered the new `pdf-to-video` endpoint under the "Convert", "Java", and "FFmpeg" groups, and updated the tool group logic to include "FFmpeg". [[1]](diffhunk://#diff-3cddb66d1cf93eeb8103ccd17cee8ed006e0c0ee006d0ee1cf42d512f177e437R265) [[2]](diffhunk://#diff-3cddb66d1cf93eeb8103ccd17cee8ed006e0c0ee006d0ee1cf42d512f177e437R395) [[3]](diffhunk://#diff-3cddb66d1cf93eeb8103ccd17cee8ed006e0c0ee006d0ee1cf42d512f177e437R452-R454) [[4]](diffhunk://#diff-3cddb66d1cf93eeb8103ccd17cee8ed006e0c0ee006d0ee1cf42d512f177e437L496-R502) **Testing Enhancements:** * Added and updated unit tests in `CheckProgramInstallTest` to verify FFmpeg detection, including scenarios for installed, not installed, and caching behavior. [[1]](diffhunk://#diff-0eaf917d935710f0f5e18f12db600be47b8439d628d65a97a3db34133231790eR29) [[2]](diffhunk://#diff-0eaf917d935710f0f5e18f12db600be47b8439d628d65a97a3db34133231790eR38-R45) [[3]](diffhunk://#diff-0eaf917d935710f0f5e18f12db600be47b8439d628d65a97a3db34133231790eR67-R75) [[4]](diffhunk://#diff-0eaf917d935710f0f5e18f12db600be47b8439d628d65a97a3db34133231790eR222-R262) --- ## Checklist ### General - [x] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [x] I have performed a self-review of my own code - [x] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details.
62 lines
2.0 KiB
Docker
62 lines
2.0 KiB
Docker
# dockerfile.dev
|
||
|
||
# Basisimage: Gradle mit JDK 17 (Debian-basiert)
|
||
FROM gradle:8.14-jdk17
|
||
|
||
# Als Root-Benutzer arbeiten, um benötigte Pakete zu installieren
|
||
USER root
|
||
|
||
# Set GRADLE_HOME und füge Gradle zum PATH hinzu
|
||
ENV GRADLE_HOME=/opt/gradle
|
||
ENV PATH="$GRADLE_HOME/bin:$PATH"
|
||
|
||
# Update und Installation zusätzlicher Pakete (Debian/Ubuntu-basiert)
|
||
RUN apt-get update && apt-get install -y \
|
||
sudo \
|
||
libreoffice \
|
||
poppler-utils \
|
||
qpdf \
|
||
# settings.yml | tessdataDir: /usr/share/tesseract-ocr/5/tessdata
|
||
tesseract-ocr \
|
||
tesseract-ocr-eng \
|
||
ffmpeg \
|
||
fonts-terminus fonts-dejavu fonts-font-awesome fonts-noto fonts-noto-core fonts-noto-cjk fonts-noto-extra fonts-liberation fonts-linuxlibertine fonts-urw-base35 \
|
||
python3-uno \
|
||
python3-venv \
|
||
# ss -tln
|
||
iproute2 \
|
||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||
|
||
# Setze die Environment Variable für setuptools
|
||
ENV SETUPTOOLS_USE_DISTUTILS=local \
|
||
STIRLING_TEMPFILES_DIRECTORY=/tmp/stirling-pdf \
|
||
TMPDIR=/tmp/stirling-pdf \
|
||
TEMP=/tmp/stirling-pdf \
|
||
TMP=/tmp/stirling-pdf
|
||
|
||
# Installation der benötigten Python-Pakete
|
||
COPY .github/scripts/requirements_dev.txt /tmp/requirements_dev.txt
|
||
RUN python3 -m venv --system-site-packages /opt/venv \
|
||
&& . /opt/venv/bin/activate \
|
||
&& pip install --no-cache-dir --require-hashes -r /tmp/requirements_dev.txt
|
||
|
||
# Füge den venv-Pfad zur globalen PATH-Variable hinzu, damit die Tools verfügbar sind
|
||
ENV PATH="/opt/venv/bin:$PATH"
|
||
|
||
COPY . /workspace
|
||
|
||
RUN mkdir -p /tmp/stirling-pdf \
|
||
&& fc-cache -f -v \
|
||
&& adduser --disabled-password --gecos '' devuser \
|
||
&& chown -R devuser:devuser /home/devuser /workspace /tmp/stirling-pdf
|
||
RUN echo "devuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/devuser \
|
||
&& chmod 0440 /etc/sudoers.d/devuser
|
||
|
||
# Setze das Arbeitsverzeichnis (wird später per Bind-Mount überschrieben)
|
||
WORKDIR /workspace
|
||
|
||
RUN chmod +x /workspace/.devcontainer/git-init.sh /workspace/.devcontainer/init-setup.sh
|
||
|
||
# Wechsel zum Nicht‑Root Benutzer
|
||
USER devuser
|