diff --git a/src/blacktv/black-tv.sh b/src/blacktv/black-tv.sh index af17424..7cb4ea7 100644 --- a/src/blacktv/black-tv.sh +++ b/src/blacktv/black-tv.sh @@ -266,7 +266,22 @@ case "$cmd" in target="$1"; [ -e "$target" ] || die "no such path: $target" if [ -d "$target" ]; then n=$(build_dir_playlist "$target") - else printf '%s\n' "$target" > "$PLAYLIST"; n=1; fi + else + # Single file → build a continuation playlist from this episode onward + # (siblings in the same release), so the next episode auto-plays. Falls + # back to just the file (movies / loose files / unknown layout). + sd=$(showdir_of "$target" 2>/dev/null || true) + relroot="" + if [ -n "$sd" ]; then rel="${target#"$sd"/}"; relroot="$sd/${rel%%/*}"; fi + if [ -n "$relroot" ] && [ -d "$relroot" ]; then + find "$relroot" -type f -iregex "$VIDEO_RE" ! -ipath '*/Specials/*' ! -ipath '*/Extras/*' \ + | sort > "$PLAYLIST.all" + start=$(grep -nF "$target" "$PLAYLIST.all" | head -1 | cut -d: -f1) + if [ -n "$start" ]; then tail -n +"$start" "$PLAYLIST.all" > "$PLAYLIST" + else printf '%s\n' "$target" > "$PLAYLIST"; fi + rm -f "$PLAYLIST.all"; n=$(wc -l < "$PLAYLIST") + else printf '%s\n' "$target" > "$PLAYLIST"; n=1; fi + fi [ "${n:-0}" -gt 0 ] || die "no playable files under $target" launch "$PLAYLIST"; echo "playing $n item(s)" ;; play-show)