Trying to get this nsxiv script to work on NetBSD. However, as the author states in the README
:
These are usually met on most modern Linux distributions. If your system is strictly POSIX, this script will fail to work.
So, I figure maybe it's not possible, but no harm in asking if anyone has any ideas.
I managed to circumvent the find
error by replacing -printf "%P\0"
with -print0
, That's a start I guess.
The Script:
#!/usr/bin/env sh
tmpdir="$(mktemp -d)" || {
printf "%s: %s\n" "${0##*/}" "could not create temporary directory"
exit 1
}
trap 'rm -rf -- "$tmpdir"' TERM INT EXIT
find '.' -mindepth 1 -maxdepth 1 \( -type f -o -type l \) -print0 \
| xargs -r0 -n 20 -P 64 file -00 -L --mime-type -- \
| xargs -r0 -n 2 sh -c '
case "$2" in
video/*) printf "%s\0" "$1";;
esac
' -- \
| sort -z \
| xargs -r0 -I FILE ffmpegthumbnailer -i FILE -o "$tmpdir/FILE.jpg" -m -t 50% -s 384 -q 10
{ nsxiv -0otp -- "$tmpdir"; rm -rf -- "${tmpdir:?}" > /dev/null; } \
| sed -z 's|.jpg$||;s|^.*/||' \
| xargs -r0 -I FILE xdg-open ./FILE
The errors are as expected:
sort: unknown option -- z
xargs: sh terminated by SIGPIPE
xargs: (null) terminated by SIGPIPE
sed: unknown option -- z
nsxiv: No valid image file given, aborting
Edit:
The author has written a slightly more POSIX version that now provides caching of thumbnails