diff --git a/toys/createindex b/toys/createindex index eb1f0b6..9eec4c4 100755 --- a/toys/createindex +++ b/toys/createindex @@ -66,11 +66,14 @@ do '-y') show+=(years) ;; '-#') show+=(count) ;; - '-T') timeformat="$OPTARG" ;; + '-T') timeformat="$1" + continue ;; '-o') output="$1" continue ;; - '-u') update=1 ;; - '-D') (( debug++ )) ;; + '-u') update=1 + continue ;; + '-D') (( debug++ )) + continue ;; [0-9]*) length[count-1]=$opt continue ;; esac @@ -114,11 +117,6 @@ openDatabase columns="${show[@]//*/-}" -if ! [[ "$output" == - ]] -then - exec > "$output" -fi - printPath() { for key in ${!pathparts[@]} do @@ -140,7 +138,10 @@ printline() { path="$olddir" case $info in 'bitrates') - info=$((bitrates/count)) + info=$( + printf %${locallength}d \ + $((bitrates/count)) + ) (( info )) || unset info ;; 'oldtimestamp') @@ -193,6 +194,11 @@ then updateTags fi +if ! [[ "$output" == - ]] +then + exec > "$output" +fi + printDate() { date -d"@$1" +"${timeformat:-%x %X}" }