Harden gen-djmix, gen-vgm, strip-mb-tags, notify-telegram under set -euo pipefail (R1)

Adds strict mode to four maintenance scripts, with guards so expected non-zero
exits (empty beet queries, a missing config, a curl timeout) log/skip instead
of aborting: gen-djmix bails cleanly if djmix-albums.txt is absent and tolerates
a bad single query; gen-vgm tolerates an empty query; strip-mb-tags quotes its
path arg and best-efforts the trailing beet update; notify-telegram guards curl
so a network error still reaches its explicit "send failed" branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
andrew
2026-07-10 10:43:37 -06:00
parent 852b3797d8
commit 41ef26a40b
4 changed files with 23 additions and 10 deletions
+4 -2
View File
@@ -4,7 +4,7 @@
#
# Navidrome picks this up as a regular playlist. Safe to run manually anytime.
set -u
set -euo pipefail
PLAYLIST_DIR=${MUSIC_DATA_DIR:-/data/music}/playlists
OUT="${PLAYLIST_DIR}/vgm.m3u8"
@@ -17,7 +17,9 @@ log() { echo "[$(date -Iseconds)] $*" | tee -a "$LOG"; }
log "=== Regenerating vgm.m3u8 ==="
SORTED=$(beet ls -f '$path' 'genres:Game' 2>>"$LOG" | sort -u)
# `|| true`: an empty or failed query just means no tracks, handled below as a
# warning. This is a cosmetic playlist regen, not worth aborting the job over.
SORTED=$(beet ls -f '$path' 'genres:Game' 2>>"$LOG" | sort -u || true)
COUNT=$(echo -n "$SORTED" | grep -c '^' || true)
if [[ "$COUNT" -gt 0 ]]; then