createindex: -S: show size
This commit is contained in:
parent
1cd9dca422
commit
38ca7637bb
@ -63,6 +63,8 @@ do
|
|||||||
'-N') show+=(tracktotals) ;;
|
'-N') show+=(tracktotals) ;;
|
||||||
'-p') show+=(performers) ;;
|
'-p') show+=(performers) ;;
|
||||||
'-s') show+=(rates) ;;
|
'-s') show+=(rates) ;;
|
||||||
|
'-S') show+=(size)
|
||||||
|
length[count]=5 ;;
|
||||||
'-B') show+=(depths) ;;
|
'-B') show+=(depths) ;;
|
||||||
'-t') show+=(titles) ;;
|
'-t') show+=(titles) ;;
|
||||||
'-y') show+=(years) ;;
|
'-y') show+=(years) ;;
|
||||||
@ -170,6 +172,55 @@ printline() {
|
|||||||
done
|
done
|
||||||
unset pathparts
|
unset pathparts
|
||||||
;;
|
;;
|
||||||
|
'size')
|
||||||
|
if (( size > 1073741823 ))
|
||||||
|
then
|
||||||
|
info=$(( (size * 1000) / 1073741824 ))
|
||||||
|
int=$(( info / 1000 ))
|
||||||
|
if (( ${#int} > 2 ))
|
||||||
|
then
|
||||||
|
info=$(printf %4sG $int)
|
||||||
|
else
|
||||||
|
info=$(
|
||||||
|
printf %2s.%.1sG\
|
||||||
|
$int \
|
||||||
|
${info#int}
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
elif (( size > 1048575 ))
|
||||||
|
then
|
||||||
|
info=$(( (size * 1000) / 1048576 ))
|
||||||
|
int=$(( info / 1000 ))
|
||||||
|
if (( ${#int} > 2 ))
|
||||||
|
then
|
||||||
|
info=$(printf %4sM $int)
|
||||||
|
else
|
||||||
|
info=$(
|
||||||
|
printf %2s.%.1sM\
|
||||||
|
$int \
|
||||||
|
${info#int}
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
suffix=M
|
||||||
|
elif (( size > 1023 ))
|
||||||
|
then
|
||||||
|
info=$(( (size * 1000) / 1024 ))
|
||||||
|
int=$(( info / 1000 ))
|
||||||
|
if (( ${#int} > 2 ))
|
||||||
|
then
|
||||||
|
info=$(printf %4sk $int)
|
||||||
|
else
|
||||||
|
info=$(
|
||||||
|
printf %2s.%.1sk\
|
||||||
|
$int \
|
||||||
|
${info#int}
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
info=$size
|
||||||
|
info=$(printf %4s $size)
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
info="${!info}"
|
info="${!info}"
|
||||||
;;
|
;;
|
||||||
@ -247,6 +298,7 @@ do
|
|||||||
titles) info='Title' ;;
|
titles) info='Title' ;;
|
||||||
tracktotals) info='Track total' ;;
|
tracktotals) info='Track total' ;;
|
||||||
years) info='Date' ;;
|
years) info='Date' ;;
|
||||||
|
size) info='Size' ;;
|
||||||
esac
|
esac
|
||||||
printtmp="${info:0:$locallength}"
|
printtmp="${info:0:$locallength}"
|
||||||
until (( ${#printtmp} == locallength ))
|
until (( ${#printtmp} == locallength ))
|
||||||
@ -277,7 +329,8 @@ SELECT
|
|||||||
tags.performer,
|
tags.performer,
|
||||||
tags.title,
|
tags.title,
|
||||||
tags.track,
|
tags.track,
|
||||||
tags.year
|
tags.year,
|
||||||
|
source_files.size
|
||||||
FROM source_files
|
FROM source_files
|
||||||
INNER JOIN mime_types
|
INNER JOIN mime_types
|
||||||
ON source_files.mime_type=mime_types.id
|
ON source_files.mime_type=mime_types.id
|
||||||
@ -338,6 +391,8 @@ do
|
|||||||
rest="${rest#*::AtOM:SQL:Sep::}"
|
rest="${rest#*::AtOM:SQL:Sep::}"
|
||||||
year="${rest%%::AtOM:SQL:Sep::*}"
|
year="${rest%%::AtOM:SQL:Sep::*}"
|
||||||
rest="${rest#*::AtOM:SQL:Sep::}"
|
rest="${rest#*::AtOM:SQL:Sep::}"
|
||||||
|
filesize="${rest%%::AtOM:SQL:Sep::*}"
|
||||||
|
rest="${rest#*::AtOM:SQL:Sep::}"
|
||||||
case $mimetype in
|
case $mimetype in
|
||||||
application/ogg\ opus) type=Opus ;;
|
application/ogg\ opus) type=Opus ;;
|
||||||
application/ogg\ vorbis) type=Vorbis ;;
|
application/ogg\ vorbis) type=Vorbis ;;
|
||||||
@ -355,6 +410,7 @@ do
|
|||||||
esac
|
esac
|
||||||
if [[ $dir == $olddir ]]
|
if [[ $dir == $olddir ]]
|
||||||
then
|
then
|
||||||
|
(( size += filesize ))
|
||||||
(( count++ ))
|
(( count++ ))
|
||||||
(( $bitrate )) && (( bitrates+=bitrate ))
|
(( $bitrate )) && (( bitrates+=bitrate ))
|
||||||
((
|
((
|
||||||
@ -493,6 +549,7 @@ do
|
|||||||
titles="$title"
|
titles="$title"
|
||||||
tracktotals="$tracktotal"
|
tracktotals="$tracktotal"
|
||||||
years="$year"
|
years="$year"
|
||||||
|
size="$filesize"
|
||||||
count=1
|
count=1
|
||||||
(( bitrate )) && (( bitrates=bitrate ))
|
(( bitrate )) && (( bitrates=bitrate ))
|
||||||
oldmimetype=$mimetype
|
oldmimetype=$mimetype
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user