From 69b63c3d48a0712759f4bea91689e9adf6979734 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Tue, 5 Mar 2013 13:31:25 +0100 Subject: [PATCH] better loop, update tag cache --- atom | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/atom b/atom index 932e718..885ca6f 100755 --- a/atom +++ b/atom @@ -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: