only update changed tags
This commit is contained in:
parent
64b14b67f7
commit
822a266c7c
@ -1,29 +1,23 @@
|
||||
#!/bin/bash
|
||||
updateTags() {
|
||||
local \
|
||||
ual \
|
||||
uaa \
|
||||
uar \
|
||||
uco \
|
||||
udi \
|
||||
uge \
|
||||
upe \
|
||||
uti \
|
||||
utr \
|
||||
uye \
|
||||
ura \
|
||||
uch \
|
||||
ubi
|
||||
for reader in "${tagreaders[@]}"
|
||||
do
|
||||
tagreaderclause+="${tagreaderclause:+ AND }NOT tags.tagreader = \"$reader\""
|
||||
done
|
||||
echo '
|
||||
SELECT COUNT(DISTINCT source_files.filename)
|
||||
FROM source_files
|
||||
INNER JOIN destination_files
|
||||
ON destination_files.source_file_id=source_files.id
|
||||
INNER JOIN destinations
|
||||
ON destination_files.destination_id=destinations.id
|
||||
INNER JOIN mime_type_actions
|
||||
ON destinations.id=mime_type_actions.destination_id
|
||||
INNER JOIN tags
|
||||
ON source_files.id=tags.source_file
|
||||
WHERE mime_type_actions.id = source_files.mime_type
|
||||
AND (
|
||||
CAST(tags.last_change AS TEXT)
|
||||
<>
|
||||
CAST(source_files.last_change AS TEXT)
|
||||
OR ('"$tagreaderclause"')
|
||||
)
|
||||
AND mime_type_actions.action = 1;' >&3
|
||||
read -u4 filecount
|
||||
echo '
|
||||
SELECT DISTINCT
|
||||
source_files.id,
|
||||
@ -66,6 +60,7 @@ updateTags() {
|
||||
while ! [[ $line = AtOM:NoMoreFiles ]]
|
||||
do
|
||||
tagfiles+=("$line")
|
||||
(( filecount++ ))
|
||||
read -u4 line
|
||||
done
|
||||
echo 'BEGIN TRANSACTION;' >&3
|
||||
@ -113,21 +108,34 @@ updateTags() {
|
||||
fi
|
||||
if getTags
|
||||
then
|
||||
[[ $oldalbum != "$album" ]]&& ual=1
|
||||
[[ $oldalbumartist != "$albumartist" ]]&&uaa=1
|
||||
[[ $oldartist != "$artist" ]]&& uar=1
|
||||
[[ $oldcomposer != "$composer" ]]&& uco=1
|
||||
[[ $olddisc != "$disc" ]]&& udi=1
|
||||
[[ $oldgenre != "$genre" ]]&& uge=1
|
||||
[[ $oldperformer != "$performer" ]]&& upe=1
|
||||
[[ $oldtitle != "$title" ]]&& uti=1
|
||||
[[ $oldtrack != "$track" ]]&& utr=1
|
||||
[[ $oldyear != "$year" ]]&& uye=1
|
||||
[[ $oldrate != "$rate" ]]&& ura=1
|
||||
[[ $oldchannels != "$channels" ]]&& uch=1
|
||||
[[ $oldbitrate != "$bitrate" ]]&& ubi=1
|
||||
Update tags \
|
||||
album "${album:-NULL}" \
|
||||
albumartist "${albumartist:-NULL}" \
|
||||
artist "${artist:-NULL}" \
|
||||
composer "${composer:-NULL}" \
|
||||
disc "${disc:-NULL}" \
|
||||
genre "${genre:-NULL}" \
|
||||
performer "${performer:-NULL}" \
|
||||
title "${title:-NULL}" \
|
||||
track "${tracknum:-NULL}" \
|
||||
year "${year:-NULL}" \
|
||||
${ual:+album "${album:-NULL}"} \
|
||||
${uaa:+albumartist "${albumartist:-NULL}"} \
|
||||
${uar:+artist "${artist:-NULL}"} \
|
||||
${uco:+composer "${composer:-NULL}"} \
|
||||
${udi:+disc "${disc:-NULL}"} \
|
||||
${uge:+genre "${genre:-NULL}"} \
|
||||
${upe:+performer "${performer:-NULL}"} \
|
||||
${uti:+title "${title:-NULL}"} \
|
||||
${utr:+track "${tracknum:-NULL}"} \
|
||||
${uye:+year "${year:-NULL}"} \
|
||||
last_change "$lastchange" \
|
||||
rate "${rate:-NULL}" \
|
||||
channels "${channels:-NULL}" \
|
||||
bitrate "${bitrate:-NULL}" \
|
||||
${ura:+rate "${rate:-NULL}"} \
|
||||
${uch:+channels "${channels:-NULL}"} \
|
||||
${ubi:+bitrate "${bitrate:-NULL}"} \
|
||||
tagreader "$tagreader" \
|
||||
>/dev/null <<<"source_file = $sourcefileid"
|
||||
unset genre \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user