]> zdv2.bktei.com Git - BK-2020-03.git/blobdiff - user/rand_media_pl.sh
feat(unitproc/graphu):Tally UTF-8 characters
[BK-2020-03.git] / user / rand_media_pl.sh
index eaa3dc1638781e2ffa8c2d750678fee1898ee878..abe7766fd9685a0dae81e66145f118cdaf9d7327 100755 (executable)
@@ -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]
 #   - 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
 
 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;
         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; )";
 
     total_duration_s="$(printf "%.1f" "$total_duration"; )";
     total_duration_h="$(echo "scale=1; $total_duration / 3600" | bc -l; )";