Merge branch 'toys'

This commit is contained in:
Vincent Riquer 2013-09-28 00:34:03 +02:00
commit cf3652c028

View File

@ -61,14 +61,19 @@ do
'-M') show+=(types) ;;
'-p') show+=(performers) ;;
'-s') show+=(rates) ;;
'-B') show+=(depths) ;;
'-t') show+=(titles) ;;
'-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
@ -79,9 +84,11 @@ done
cat <<-EOHelp
No output specified!
-f Path
-# File count
-b Average bitrate
-C Channels
-s Sample rate
-B Bits per sample
-m Mofification time
-M Format
@ -110,11 +117,6 @@ openDatabase
columns="${show[@]//*/-}"
if ! [[ "$output" == - ]]
then
exec > "$output"
fi
printPath() {
for key in ${!pathparts[@]}
do
@ -136,12 +138,18 @@ printline() {
path="$olddir"
case $info in
'bitrates')
info=$((bitrates/count))
info=$(
printf %${locallength}d \
$((bitrates/count))
)
(( info )) || unset info
;;
'oldtimestamp')
info=$(printDate ${!info})
;;
'count')
info=$(printf %${locallength}d $count)
;;
'path')
while [[ $path =~ / ]]
do
@ -186,6 +194,11 @@ then
updateTags
fi
if ! [[ "$output" == - ]]
then
exec > "$output"
fi
printDate() {
date -d"@$1" +"${timeformat:-%x %X}"
}
@ -195,21 +208,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 +243,7 @@ SELECT
tags.bitrate,
tags.channels,
tags.rate,
tags.depth,
source_files.last_change,
mime_types.mime_text,
tags.albumartist,
@ -270,6 +286,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::}"
@ -310,7 +328,8 @@ do
esac
if [[ $dir == $olddir ]]
then
(( $bitrate )) && (( count++ , bitrates+=bitrate ))
(( count++ ))
(( $bitrate )) && (( bitrates+=bitrate ))
((
oldtimestamp = (
timestamp > oldtimestamp
@ -340,6 +359,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 +447,7 @@ do
unset bitrates
channelss="$channels"
rates="$rate"
depths="$depth"
types="$type"
albumartists="$albumartist"
albums="$album"
@ -428,7 +458,8 @@ do
performers="$performer"
titles="$title"
years="$year"
(( bitrate )) && (( count=1 , bitrates=bitrate ))
count=1
(( bitrate )) && (( bitrates=bitrate ))
oldmimetype=$mimetype
oldrate=$rate
oldtimestamp=$timestamp