better loop, update tag cache

This commit is contained in:
Vincent Riquer 2013-03-05 13:31:25 +01:00
parent db3a30e54d
commit 69b63c3d48

55
atom
View File

@ -799,23 +799,52 @@ echo '
AND mime_type_actions.action = 1;
SELECT "AtOM:NoMoreFiles";' >&3
while read -u4 line
read -u4 line
while ! [[ $line = AtOM:NoMoreFiles ]]
do
if [[ $line = AtOM:NoMoreFiles ]]
tagfiles+=("$line")
read -u4 line
done
echo 'BEGIN TRANSACTION;' >&3
for line in "${tagfiles[@]}"
do
sourcefileid=${line%%|*}
rest=${line#*|}
lastchange=${rest%%|*}
rest=${rest#*|}
mimetype=${rest%%|*}
filename=${rest#*|}
echo -en "\rTags: $((++count*100/filecount))%"
if getTags
then
echo -e "\r$count files to create or update."
break
else
destination=${line%%|*}
rest=${line#*|}
mimetype=${rest%%|*}
filename=${rest#*|}
echo -en "\rTags: $((++count*100/filecount))%"
getTags
#createTask
Update tags \
album "$album" \
albumartist "$albumartist" \
artist "$artist" \
composer "$composer" \
disc "$disc" \
genre "$genre" \
performer "$performer" \
title "$title" \
track "$tracknum" \
year "$year" \
last_change "$lastchange" \
>/dev/null <<<"source_file $sourcefileid"
unset genre \
albumartist \
year \
album \
disc \
artist \
track \
title \
composer \
performer
fi
done
unset count
echo 'COMMIT;' >&3
echo -e "\rRead tags from $count files."
unset count tagfiles
closeDatabase
# vim:set ts=8 sw=8: