feat(play): ✨ enhance playlist creation for single files
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
c24b1f3258
commit
8d28a8a988
1 changed files with 16 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue