From 4a8db82e26eaa933081fa3287618a89a46181257 Mon Sep 17 00:00:00 2001 From: Leo Coogan Date: Sat, 5 Mar 2022 22:12:41 -0500 Subject: [PATCH] new script --- bin/dur | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 bin/dur diff --git a/bin/dur b/bin/dur new file mode 100755 index 0000000..7b186c6 --- /dev/null +++ b/bin/dur @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +#dur - Get duration of audio dir - Kok_Nikol +#https://www.reddit.com/r/linuxquestions/comments/3b93uv/comment/csk1poq/?utm_source=share&utm_medium=web2x&context=3 +tot=0; while read -r i; do tmp=0; tmp=`ffprobe "$i" -show_format 2>/dev/null | grep "^duration" | cut -d '=' -f 2 | cut -d '.' -f 1`; if [ -n "$tmp" ]; then let tot+=$tmp; fi; done < <(find . -type f -iname "*[.mp3,.wav,.flac]"); echo "Total duration: $(($tot/60)) minutes"