Login
You're viewing the functional.cafe public feed.
  • Nov 16, 2026, 10:16 PM

    How can I do queries on file-type specific properties of my files?

    I think some of my FLACs ripped from CD have errors, so I want to list any file with duration under thirty seconds.

    Maybe zsh has extended glob plugins? I could use the FLAC plugin and ask for exactly what I want?

    💬 4🔄 0⭐ 0

Replies

  • Nov 16, 2026, 10:49 PM

    @shapr
    I usually use find for this, it's something like
    find -name *.flac -exec is_short.sh \{\} -print \{\}

    💬 0🔄 0⭐ 0
  • Nov 16, 2026, 11:07 PM

    @shapr Something like find . -name \*.flac -exec ffprobe "{}" \; 2>&1 | grep -e Duration -e Input

    💬 2🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 17, 2026, 4:57 AM

    @shapr

    declare -a hz_samples_fn; ((0==${#hz_samples_fn[@]})) && mapfile -t hz_samples_fn < <(find /dir/to/files/ -name '*.flac' -type f -size -2M -exec metaflac --show-sample-rate --show-total-samples '{}' ';' -print); printf '%s\n' "${hz_samples_fn[@]}" | awk -v threshold=30 '1==(FNR%3){hz=$1; getline; samples=$1; getline; dur=samples/hz; if (dur < threshold) print dur, $0; dur=samples=hz=1; next}'

    💬 0🔄 0⭐ 0