commit 02a339f773ecb4985e8f34800a1505fa883303a7 parent 075e531f46db489508bd53cfbefe7dc74755e07b Author: Alex Balgavy <alex@balgavy.eu> Date: Wed, 23 Dec 2020 18:22:25 +0100 mp3s-find-broken: find broken mp3s in path Diffstat:
A | scripts/mp3-find-broken | | | 15 | +++++++++++++++ |
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/scripts/mp3-find-broken b/scripts/mp3-find-broken @@ -0,0 +1,15 @@ +#!/bin/sh +die() { printf "%s\n" "$1" >&2; exit 1; } +command -v mp3val 1>/dev/null 2>&1 || die "mp3val not installed." +[ $# -eq 1 ] || die "Argument required: path to music directory" +[ -d "$1" ] || die "Path $1 is not a directory." +set -x +cd "$1" || die "Could not cd to $1" + +outfile=/tmp/mp3-find-broken-$RANDOM.log +find . -name "*.mp3" | \ + while read -r fil; do + mp3val "$fil" | grep '^WARNING' >/dev/null && printf "%s" "$fil" | tee -a "$fil" + done + +printf "Log saved in %s.\n" "$outfile"