#!/usr/bin/env bash set -o pipefail # generate-disc-playlists.sh # Generic multi-disc playlist generator (numeric / Roman (Disc N) only). # Excludes Bonus/Special/etc. because they lack (Disc N) markers. # Will not rename source images; playlist base strips only the (Disc N) tag. SCRIPT_DIR="$(dirname "$(realpath "$0")")" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" if [ -f "$PROJECT_ROOT/core/disc_sets.sh" ]; then # shellcheck source=/dev/null source "$PROJECT_ROOT/core/disc_sets.sh" else echo "[disc] ERROR: core/disc_sets.sh not found" >&2 exit 1 fi ROOT=${PLAYLIST_ROOT:-${1:-.}} EXTS=${PLAYLIST_EXTS:-"chd cue iso bin pbp ccd img mds"} MIN_DISCS=${PLAYLIST_MIN_DISCS:-2} FORCE=${PLAYLIST_FORCE:-0} DRY_RUN=${PLAYLIST_DRY_RUN:-0} VERBOSE=${PLAYLIST_VERBOSE:-0} IFS=' ' read -r -a _ext_array <<<"$EXTS" input_lines=$(disc_collect_groups "$ROOT" "${_ext_array[@]}") disc_write_playlists "$MIN_DISCS" "$FORCE" "$DRY_RUN" "$VERBOSE" "$input_lines" exit 0