Refactor downloader and file manager for improved rclone integration and add healthcheck and smoke test options

- Renamed download flags in ContentDownloader for clarity.
- Enhanced FileManager with methods to build upload paths and verify existing files for rclone uploads.
- Updated StreamProcessor to return success status for stream processing.
- Added rclone smoke test and healthcheck functions to validate configuration and tool availability.
- Improved environment variable handling with a utility function.
- Updated TwitchArchive to incorporate new rclone verification and processing logic.
- Added unit tests for new functionality and refactored existing tests for clarity and coverage.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
MaddoScientisto 2026-04-25 11:54:03 +02:00
commit f97e0200d6
23 changed files with 1013 additions and 289 deletions

6
docker/entrypoint.sh Normal file
View file

@ -0,0 +1,6 @@
#!/bin/sh
set -eu
mkdir -p /app/archive /app/config /app/bin/temp
exec "$@"

49
docker/python.Dockerfile Normal file
View file

@ -0,0 +1,49 @@
FROM python:3.12-slim
ARG TWITCH_DOWNLOADER_VERSION=1.56.4
ARG TARGETARCH
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
RCLONE_CONFIG=/app/config/rclone.conf
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
ffmpeg \
libicu-dev \
rclone \
unzip \
&& rm -rf /var/lib/apt/lists/*
RUN set -eux; \
case "${TARGETARCH}" in \
amd64) twitch_downloader_arch='Linux-x64' ;; \
arm64) twitch_downloader_arch='LinuxArm64' ;; \
arm) twitch_downloader_arch='LinuxArm' ;; \
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
esac; \
curl -fsSL -o /tmp/TwitchDownloaderCLI.zip "https://github.com/lay295/TwitchDownloader/releases/download/${TWITCH_DOWNLOADER_VERSION}/TwitchDownloaderCLI-${TWITCH_DOWNLOADER_VERSION}-${twitch_downloader_arch}.zip"; \
mkdir -p /tmp/twitchdownloader; \
unzip -j /tmp/TwitchDownloaderCLI.zip TwitchDownloaderCLI -d /tmp/twitchdownloader; \
install -m 0755 /tmp/twitchdownloader/TwitchDownloaderCLI /usr/local/bin/TwitchDownloaderCLI; \
rm -rf /tmp/TwitchDownloaderCLI.zip /tmp/twitchdownloader
COPY requirements.txt ./requirements.txt
RUN python -m pip install --upgrade pip \
&& python -m pip install -r requirements.txt
COPY . /app
RUN mkdir -p /app/archive /app/config /app/bin/temp
COPY docker/entrypoint.sh /usr/local/bin/twitch-archive-entrypoint
RUN chmod +x /usr/local/bin/twitch-archive-entrypoint
ENTRYPOINT ["twitch-archive-entrypoint"]
CMD ["python", "twitch-archive.py", "-u", "vinesauce"]