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.
This commit is contained in:
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
# Convert m4a files in-place: AAC -> MP3 (V0 VBR), ALAC -> FLAC (lossless).
|
||||
# Preserves metadata + embedded cover art. Deletes original on success.
|
||||
set -u
|
||||
|
||||
LOG=${ALEMBIC_CONFIG_DIR:-/config}/logs/convert-m4a-$(date +%Y%m%d-%H%M%S).log
|
||||
mkdir -p "$(dirname "$LOG")"
|
||||
|
||||
log() { echo "[$(date -Iseconds)] $*" | tee -a "$LOG"; }
|
||||
|
||||
OK_AAC=0
|
||||
OK_ALAC=0
|
||||
FAIL=0
|
||||
|
||||
while IFS= read -r -d '' f; do
|
||||
codec=$(ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of csv=p=0 "$f" 2>/dev/null | tr -d ',')
|
||||
base="${f%.m4a}"
|
||||
case "$codec" in
|
||||
aac)
|
||||
out="${base}.mp3"
|
||||
if [[ -e "$out" ]]; then log "SKIP-EXISTS: $out"; FAIL=$((FAIL+1)); continue; fi
|
||||
if ffmpeg -nostdin -hide_banner -loglevel error -i "$f" \
|
||||
-map 0 -c:v copy -c:a libmp3lame -q:a 0 -id3v2_version 3 \
|
||||
"$out" 2>>"$LOG"; then
|
||||
rm -f "$f"
|
||||
log "AAC→MP3: $out"
|
||||
OK_AAC=$((OK_AAC+1))
|
||||
else
|
||||
log "FAIL-AAC: $f"
|
||||
rm -f "$out" 2>/dev/null
|
||||
FAIL=$((FAIL+1))
|
||||
fi
|
||||
;;
|
||||
alac)
|
||||
out="${base}.flac"
|
||||
if [[ -e "$out" ]]; then log "SKIP-EXISTS: $out"; FAIL=$((FAIL+1)); continue; fi
|
||||
if ffmpeg -nostdin -hide_banner -loglevel error -i "$f" \
|
||||
-map 0 -c:v copy -c:a flac -compression_level 8 \
|
||||
"$out" 2>>"$LOG"; then
|
||||
rm -f "$f"
|
||||
log "ALAC→FLAC: $out"
|
||||
OK_ALAC=$((OK_ALAC+1))
|
||||
else
|
||||
log "FAIL-ALAC: $f"
|
||||
rm -f "$out" 2>/dev/null
|
||||
FAIL=$((FAIL+1))
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
log "SKIP-OTHER ($codec): $f"
|
||||
;;
|
||||
esac
|
||||
done < <(find ${MUSIC_DATA_DIR:-/data/music}/Library -type f -iname "*.m4a" -print0 2>/dev/null)
|
||||
|
||||
log ""
|
||||
log "=== AAC→MP3: $OK_AAC | ALAC→FLAC: $OK_ALAC | Failed: $FAIL ==="
|
||||
log "Log: $LOG"
|
||||
Reference in New Issue
Block a user