Created
April 6, 2017 11:04
-
-
Save aliva/279f9f3e51f5a00b54f4338060bc572f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function displaytime { | |
local T=`echo $1 / 1 | bc` | |
local D=$((T/60/60/24)) | |
local H=$((T/60/60%24)) | |
local M=$((T/60%60)) | |
local S=$((T%60)) | |
(( $D > 0 )) && printf '%d days ' $D | |
(( $H > 0 )) && printf '%d hours ' $H | |
(( $M > 0 )) && printf '%d minutes ' $M | |
(( $D > 0 || $H > 0 || $M > 0 )) && printf 'and ' | |
printf '%d seconds\n' $S | |
} | |
export SUM=0 | |
find | while read file | |
do | |
duration=`ffprobe -i "$file" -show_entries format=duration -v quiet -of csv="p=0"` | |
if [[ $? -eq 0 ]] && [[ $duration != "N/A" ]] | |
then | |
SUM=`echo $SUM + $duration | bc -l` | |
echo $SUM $file $duration | |
displaytime $SUM | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment