Merge branch 'toys'

* toys:
  Fix time format and Output file option parsing
  Add track totals
  Hide obsolete files
  Show off
This commit is contained in:
Vincent Riquer 2013-10-06 03:15:19 +02:00
commit 5dabbd69c6

View File

@ -43,6 +43,7 @@ do
source "$function"
done
args="$@"
while [ -n "$1" ]
do
opt="$1"
@ -59,6 +60,7 @@ do
'-g') show+=(genres) ;;
'-m') show+=(oldtimestamp) ;;
'-M') show+=(types) ;;
'-N') show+=(tracktotals) ;;
'-p') show+=(performers) ;;
'-s') show+=(rates) ;;
'-B') show+=(depths) ;;
@ -67,8 +69,10 @@ do
'-#') show+=(count) ;;
'-T') timeformat="$1"
shift
continue ;;
'-o') output="$1"
shift
continue ;;
'-u') update=1
continue ;;
@ -99,6 +103,7 @@ done
-d Disc
-g Genre
-p Performer
-N Track total
-t Title
-y Year
@ -194,11 +199,27 @@ then
updateTags
fi
echo 'SELECT IFNULL(
(SELECT last_seen FROM source_files ORDER BY last_seen DESC LIMIT 1),
0);' >&3
read -u4 lastupdate
if ! [[ "$output" == - ]]
then
exec > "$output"
fi
cat <<-EOBrag
# Generated by AtOM's createindex toy.
# https://gitorious.org/atom
# (C) 2012-2013 Vincent Riquer (GPL-3)
#
# $0 $args
#
# Last database update: $(date -d @$lastupdate +'%x %X')
EOBrag
printDate() {
date -d"@$1" +"${timeformat:-%x %X}"
}
@ -224,6 +245,7 @@ do
performers) info='Performer' ;;
rates) info='Sample rate' ;;
titles) info='Title' ;;
tracktotals) info='Track total' ;;
years) info='Date' ;;
esac
printtmp="${info:0:$locallength}"
@ -254,6 +276,7 @@ SELECT
tags.genre,
tags.performer,
tags.title,
tags.track,
tags.year
FROM source_files
INNER JOIN mime_types
@ -263,6 +286,7 @@ FROM source_files
WHERE
NOT mime_types.mime_text LIKE "text/%"
AND NOT mime_types.mime_text LIKE "image/%"
AND last_seen = '$lastupdate'
ORDER BY source_files.filename
COLLATE NOCASE;
@ -309,6 +333,9 @@ do
rest="${rest#*::AtOM:SQL:Sep::}"
title="${rest%%::AtOM:SQL:Sep::*}"
rest="${rest#*::AtOM:SQL:Sep::}"
track="${rest%%::AtOM:SQL:Sep::*}"
tracktotal=${track#*/}
rest="${rest#*::AtOM:SQL:Sep::}"
year="${rest%%::AtOM:SQL:Sep::*}"
rest="${rest#*::AtOM:SQL:Sep::}"
case $mimetype in
@ -432,6 +459,13 @@ do
[ -n "$title" ] \
&& titles+="${titles+,}$title"
fi
if ! [[ $tracktotals =~ $expr1"$tracktotal"$expr2 ]]
then
[ -z "$tracktotals" ] \
&& unset tracktotals
[ -n "$tracktotal" ] \
&& tracktotals+="${tracktotals+,}$tracktotal"
fi
if ! [[ $years =~ $expr1"$year"$expr2 ]]
then
[ -z "$years" ] \
@ -457,6 +491,7 @@ do
genres="$genre"
performers="$performer"
titles="$title"
tracktotals="$tracktotal"
years="$year"
count=1
(( bitrate )) && (( bitrates=bitrate ))