Files
alembic/pipeline/lib/gen-vgm-playlist.sh
T
andrew 68cb007e4c Stage 0: migrate pipeline scripts from /opt/sldl, scaffold repo
Moves all ~30 pipeline scripts, configs, and the vendored sldl binary into
this repo (source /opt/sldl left untouched). Removes all docker exec/docker
compose dependencies now that beets and sldl run in-process/as a subprocess
of this container instead of via soulbeet/on-demand sldl containers.
Replaces hardcoded host paths, Navidrome credentials, and Spotify credential
sourcing with env-var-driven paths and shared credential loaders. Adds
Dockerfile, entrypoint.sh, requirements.txt, docker-compose.snippet.yml, and
the initial app DB schema.
2026-07-08 13:10:55 -06:00

34 lines
859 B
Bash
Executable File

#!/bin/bash
# gen-vgm-playlist.sh — regenerate vgm.m3u8 from all tracks tagged with
# genre "Game Soundtrack" in the beets library.
#
# Navidrome picks this up as a regular playlist. Safe to run manually anytime.
set -u
PLAYLIST_DIR=${MUSIC_DATA_DIR:-/data/music}/playlists
OUT="${PLAYLIST_DIR}/vgm.m3u8"
LOG_DIR=${ALEMBIC_CONFIG_DIR:-/config}/logs
LOG="${LOG_DIR}/vgm-$(date +%Y%m%d).log"
mkdir -p "$LOG_DIR" "$PLAYLIST_DIR"
log() { echo "[$(date -Iseconds)] $*" | tee -a "$LOG"; }
log "=== Regenerating vgm.m3u8 ==="
SORTED=$(beet ls -f '$path' 'genres:Game' 2>>"$LOG" | sort -u)
COUNT=$(echo -n "$SORTED" | grep -c '^' || true)
if [[ "$COUNT" -gt 0 ]]; then
{
echo "#EXTM3U"
echo "$SORTED"
} > "$OUT"
log "vgm.m3u8 updated with $COUNT tracks"
else
log "WARNING: no tracks found — vgm.m3u8 not updated"
fi
log "=== Finished ==="