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