X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/aed21dd510f631be44b9ae966ef71c8ca7ed8fee..f06d25b954d7fc046d0f0bbd641feb5df721efd6:/user/rand_media_pl.sh diff --git a/user/rand_media_pl.sh b/user/rand_media_pl.sh index eaa3dc1..abe7766 100755 --- a/user/rand_media_pl.sh +++ b/user/rand_media_pl.sh @@ -7,8 +7,8 @@ # - Prompts the user whether to use the cached data or regenerate it. # - Uses an EDL file to specify the starting offset for the first file. # Usage: rand_media_pl.sh [DIR] -# Version: 0.0.5 -# Dependencies: Bash 4, ffprobe, mpv, bc, shuf +# Version: 0.1.0 +# Dependencies: Bash 4, ffprobe, mpv, bc, shuf, GNU Parallel yell() { echo "$0: $*" >&2; } # Print script path and all args to stderr die() { yell "$*"; exit 111; } # Same as yell() but exits with code 111 @@ -72,7 +72,7 @@ generate_playlist_cache() { else yell "WARNING: Invalid duration '$duration' for file '$file', skipping." 1>&2; fi; - done < <(find_media_files | sort; ); + done < <(find_media_files | parallel readlink -f '{}' | sort -u; ); total_duration_s="$(printf "%.1f" "$total_duration"; )"; total_duration_h="$(echo "scale=1; $total_duration / 3600" | bc -l; )";