Settings page saved to /config/settings.json but nothing downstream read that file. Schedule changes were silently ignored; max_quality and sleep_interval changes were silently ignored. The "Settings saved successfully" flash was a lie. Fix: - sync.sh reads max_quality + sleep_interval from settings.json on each run (jq -er ... // empty, falling back to env vars on missing/malformed file) - entrypoint.sh reads sync_schedule from settings.json before setting up cron, and writes the crond PID to /var/run/crond.pid so Flask can SIGHUP it - app.py adds apply_schedule(): rewrites /etc/crontabs/root, signals crond via the recorded PID, restarts crond if the PID is stale, drops the crontab when schedule is set to "manual". save_settings_route invokes it only when the schedule actually changed; any failure flashes a warning so the save still succeeds with the user informed - bare `except: pass` in get_settings replaced with explicit exception types + stderr warning so debugging malformed settings is possible - sync.sh: one bad channel no longer aborts the whole loop under set -e - Dockerfile adds jq for the JSON reads in sync.sh / entrypoint.sh - README: two stale github.com URLs fixed to Gitea; new Running Tests section under Building From Source - tests/test_settings.py: 3 pytest cases covering get_settings()'s three branches (missing file, valid file, malformed JSON) Settings hierarchy unchanged: env-var defaults seed the UI; settings.json wins when present and parseable. Timezone (TZ) is not applied live - tzdata is locked in at process start. Same behavior as before; not in scope for this commit.
45 lines
891 B
Docker
45 lines
891 B
Docker
FROM alpine:3.19
|
|
|
|
# Install dependencies
|
|
RUN apk add --no-cache \
|
|
python3 \
|
|
py3-pip \
|
|
ffmpeg \
|
|
bash \
|
|
curl \
|
|
jq \
|
|
tzdata \
|
|
dcron \
|
|
&& pip3 install --no-cache-dir yt-dlp flask --break-system-packages
|
|
|
|
# Create directories
|
|
RUN mkdir -p /downloads /config /app
|
|
|
|
# Copy scripts and web UI
|
|
COPY sync.sh /app/sync.sh
|
|
COPY entrypoint.sh /app/entrypoint.sh
|
|
COPY app.py /app/app.py
|
|
COPY templates/ /app/templates/
|
|
COPY static/ /app/static/
|
|
RUN chmod +x /app/sync.sh /app/entrypoint.sh /app/app.py
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Environment defaults
|
|
ENV DOWNLOAD_DIR=/downloads \
|
|
CONFIG_DIR=/config \
|
|
SYNC_SCHEDULE="0 2 * * *" \
|
|
MAX_QUALITY=1080 \
|
|
SLEEP_INTERVAL=2 \
|
|
TZ=America/Phoenix
|
|
|
|
# Expose web UI port
|
|
EXPOSE 8080
|
|
|
|
# Expose volume mount points
|
|
VOLUME ["/downloads", "/config"]
|
|
|
|
# Run entrypoint
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|