From d541282f270184e9d6efa7c05167e1b46e2c82d0 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Sat, 28 Sep 2013 00:29:25 +0200 Subject: [PATCH 1/3] Show bit-depth --- toys/createindex | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/toys/createindex b/toys/createindex index 7b725d6..d752ec3 100755 --- a/toys/createindex +++ b/toys/createindex @@ -61,6 +61,7 @@ do '-M') show+=(types) ;; '-p') show+=(performers) ;; '-s') show+=(rates) ;; + '-B') show+=(depths) ;; '-t') show+=(titles) ;; '-y') show+=(years) ;; @@ -82,6 +83,7 @@ done -b Average bitrate -C Channels -s Sample rate + -B Bits per sample -m Mofification time -M Format @@ -195,21 +197,23 @@ do info="${show[index]}" locallength="${length[index]:=50}" case $info in - albumartists) info="Album artist" ;; - albums) info="Album" ;; - artists) info="Artist" ;; - bitrates) info="Bitrate" ;; - composers) info="Composer" ;; - channelss) info="Channels" ;; - discs) info="Disc" ;; - path) info="Directory name" ;; - genres) info="Genre" ;; - oldtimestamp) info="Last modified" ;; - types) info="Format" ;; - performers) info="Performer" ;; - rates) info="Sample rate" ;; - titles) info="Title" ;; - years) info="Date" ;; + albumartists) info='Album artist' ;; + albums) info='Album' ;; + artists) info='Artist' ;; + bitrates) info='Bitrate' ;; + depths) info='Bit depth' ;; + channelss) info='Channels' ;; + composers) info='Composer' ;; + count) info='#' ;; + discs) info='Disc' ;; + path) info='Directory name' ;; + genres) info='Genre' ;; + oldtimestamp) info='Last modified' ;; + types) info='Format' ;; + performers) info='Performer' ;; + rates) info='Sample rate' ;; + titles) info='Title' ;; + years) info='Date' ;; esac printtmp="${info:0:$locallength}" until (( ${#printtmp} == locallength )) @@ -228,6 +232,7 @@ SELECT tags.bitrate, tags.channels, tags.rate, + tags.depth, source_files.last_change, mime_types.mime_text, tags.albumartist, @@ -270,6 +275,8 @@ do rest="${rest#*::AtOM:SQL:Sep::}" rate="${rest%%::AtOM:SQL:Sep::*}" rest="${rest#*::AtOM:SQL:Sep::}" + depth="${rest%%::AtOM:SQL:Sep::*}" + rest="${rest#*::AtOM:SQL:Sep::}" timestamp="${rest%%::AtOM:SQL:Sep::*}" timestamp="${timestamp%%.*}" rest="${rest#*::AtOM:SQL:Sep::}" @@ -340,6 +347,16 @@ do rates+="${rates+,}$rate" fi fi + if [ -n "$depth" ] && ! [[ $depths =~ $expr1"$depth"$expr2 ]] + then + if [ -n "$depths" ] \ + && (( depth < ${depths%%,*} )) + then + depths="$depth,$depths" + else + depths+="${depths+,}$depth" + fi + fi if ! [[ $types =~ $expr1"$type"$expr2 ]] then [ -z "$types" ] \ @@ -418,6 +435,7 @@ do unset bitrates channelss="$channels" rates="$rate" + depths="$depth" types="$type" albumartists="$albumartist" albums="$album" From b5c6d052c6c84f2673ddcbf487e0051aeb76f621 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Sat, 28 Sep 2013 00:31:56 +0200 Subject: [PATCH 2/3] createindex show file count --- toys/createindex | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/toys/createindex b/toys/createindex index d752ec3..eb1f0b6 100755 --- a/toys/createindex +++ b/toys/createindex @@ -64,6 +64,7 @@ do '-B') show+=(depths) ;; '-t') show+=(titles) ;; '-y') show+=(years) ;; + '-#') show+=(count) ;; '-T') timeformat="$OPTARG" ;; '-o') output="$1" @@ -80,6 +81,7 @@ done cat <<-EOHelp No output specified! -f Path + -# File count -b Average bitrate -C Channels -s Sample rate @@ -144,6 +146,9 @@ printline() { 'oldtimestamp') info=$(printDate ${!info}) ;; + 'count') + info=$(printf %${locallength}d $count) + ;; 'path') while [[ $path =~ / ]] do @@ -317,7 +322,8 @@ do esac if [[ $dir == $olddir ]] then - (( $bitrate )) && (( count++ , bitrates+=bitrate )) + (( count++ )) + (( $bitrate )) && (( bitrates+=bitrate )) (( oldtimestamp = ( timestamp > oldtimestamp @@ -446,7 +452,8 @@ do performers="$performer" titles="$title" years="$year" - (( bitrate )) && (( count=1 , bitrates=bitrate )) + count=1 + (( bitrate )) && (( bitrates=bitrate )) oldmimetype=$mimetype oldrate=$rate oldtimestamp=$timestamp From 4cda6e0f7bdebcd0c4bbbb617bc073d13757e541 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Sat, 28 Sep 2013 00:32:37 +0200 Subject: [PATCH 3/3] Small fixes --- toys/createindex | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) 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}" }