X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/7e772cd7416dcaef1b0f9a8cd09ce5e8d34c05c9..21beb7be61fdf90ea0df0a542c5f29f70a4a2434:/user/bk-copy-rand-music?ds=sidebyside diff --git a/user/bk-copy-rand-music b/user/bk-copy-rand-music index 2303d50..597a663 100755 --- a/user/bk-copy-rand-music +++ b/user/bk-copy-rand-music @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Desc: Copies random audio files # Usage: bk-copy-rand-music [dir SOURCE] [dir DEST] [int DURATION] ([int BYTES]) -# Version: 0.3.0 +# Version: 0.4.1 # Depends: BK-2020-03: bkshuf v0.1.0 declare -Ag appRollCall # Associative array for storing app status @@ -10,7 +10,7 @@ declare -Ag dirRollCall # Associative array for storing dir status declare -a music_codecs # Array for storing valid codec names (e.g. "aac" "mp3") # Adjustable parameters -music_codecs=("vorbis" "aac" "mp3" "flac" "opus"); # whitelist of valid codec_names ffprobe might return +music_codecs=("vorbis" "aac" "mp3" "flac" "opus" "eac3"); # whitelist of valid codec_names ffprobe might return ext_ignore=".ots\$|.mid\$|.json\$|.gz\$|.jpg\$|.png\$|.asc\$|.pdf\$|.txt\$|.vtt\$|\.SUM|.zip\$|.xz\$|.org\$|.txt\$"; # blacklist of file extensions for 'grep -Evi' max_filename_length="255"; # max output filename length min_file_duration="30"; # minimum duration per music file @@ -463,7 +463,7 @@ main() { path_candfile="$line"; # path of candidate file ### Check size - siz_cand="$(du -b "$path_candfile" | awk '{ print $1 }')"; # size in bytes + siz_cand="$(du -Lb "$path_candfile" | awk '{ print $1 }')"; # size in bytes if ! checkInt "$siz_cand"; then continue; fi; # reject if [[ "$((siz + siz_cand))" -gt "$siz_dest" ]]; then continue; fi; # reject if [[ "$siz_cand" -lt "$min_file_size" ]]; then continue; fi; # reject