Compare commits
18 Commits
0f13154d6f
...
4b1ba6bf7a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b1ba6bf7a | ||
|
|
006555c53e | ||
|
|
96b536ac3a | ||
|
|
04a0e7d0a6 | ||
|
|
10b8cf3193 | ||
|
|
0692abe7f8 | ||
|
|
a67ffc7c7e | ||
|
|
06ab0a3970 | ||
|
|
ab14f09f1d | ||
|
|
321fe29bf9 | ||
|
|
df24574e37 | ||
|
|
6e827d7bd9 | ||
|
|
60cd9f0e88 | ||
|
|
6d9321319b | ||
|
|
2df3e5cddc | ||
|
|
ede8407fa4 | ||
|
|
ecfa6f73c6 | ||
|
|
4722f51706 |
11
atom
11
atom
@ -265,7 +265,12 @@ do
|
|||||||
rest=${line#*::AtOM:SQL:Sep::}
|
rest=${line#*::AtOM:SQL:Sep::}
|
||||||
removeFileDestName=${rest%%::AtOM:SQL:Sep::*}
|
removeFileDestName=${rest%%::AtOM:SQL:Sep::*}
|
||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
removefile[$removeFileId]="${destinationpath["$removeFileDestName"]}/${rest%%::AtOM:SQL:Sep::*}"
|
if [[ -n "${rest%%::AtOM:SQL:Sep::*}" ]]
|
||||||
|
then
|
||||||
|
removefile[$removeFileId]="${destinationpath["$removeFileDestName"]}/${rest%%::AtOM:SQL:Sep::*}"
|
||||||
|
else
|
||||||
|
removefile[$removeFileId]=''
|
||||||
|
fi
|
||||||
read -u4 -r -d $'\0' line
|
read -u4 -r -d $'\0' line
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@ -475,6 +480,7 @@ echo '
|
|||||||
tags.genre,
|
tags.genre,
|
||||||
tags.performer,
|
tags.performer,
|
||||||
tags.rate,
|
tags.rate,
|
||||||
|
tags.rating,
|
||||||
tags.releasecountry,
|
tags.releasecountry,
|
||||||
tags.replaygain_alb,
|
tags.replaygain_alb,
|
||||||
tags.replaygain_trk,
|
tags.replaygain_trk,
|
||||||
@ -555,6 +561,8 @@ do
|
|||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
rate=${rest%%::AtOM:SQL:Sep::*}
|
rate=${rest%%::AtOM:SQL:Sep::*}
|
||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
|
rating=${rest%%::AtOM:SQL:Sep::*}
|
||||||
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
releasecountry=${rest%%::AtOM:SQL:Sep::*}
|
releasecountry=${rest%%::AtOM:SQL:Sep::*}
|
||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
replaygain_alb=${rest%%::AtOM:SQL:Sep::*}
|
replaygain_alb=${rest%%::AtOM:SQL:Sep::*}
|
||||||
@ -625,6 +633,7 @@ do
|
|||||||
mimetype \
|
mimetype \
|
||||||
performer \
|
performer \
|
||||||
rate \
|
rate \
|
||||||
|
rating \
|
||||||
releasecountry \
|
releasecountry \
|
||||||
replaygain_alb \
|
replaygain_alb \
|
||||||
replaygain_trk \
|
replaygain_trk \
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
# at the root of the project.
|
# at the root of the project.
|
||||||
|
|
||||||
# Current schema version this AtOM binary understands
|
# Current schema version this AtOM binary understands
|
||||||
currentdbversion=8
|
currentdbversion=9
|
||||||
checkDatabaseVersion() {
|
checkDatabaseVersion() {
|
||||||
local dbversion
|
local dbversion
|
||||||
# Try to read the stored version from the 'atom' metadata table
|
# Try to read the stored version from the 'atom' metadata table
|
||||||
|
|||||||
51
lib/database/upgradedatabase_8_9
Normal file
51
lib/database/upgradedatabase_8_9
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright © 2012-2026 ScriptFanix
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# A copy of the GNU General Public License v3 is includded in the LICENSE file
|
||||||
|
# at the root of the project.
|
||||||
|
|
||||||
|
upgradedatabase_8_9() {
|
||||||
|
echo "Upgrading database to version 9... (backup is $database.bak_v8)"
|
||||||
|
cp "$database" "$database.bak_v8"
|
||||||
|
|
||||||
|
echo '
|
||||||
|
ALTER TABLE tags ADD COLUMN rating FLOAT;
|
||||||
|
DROP TRIGGER force_destination_update_on_tag_update;
|
||||||
|
CREATE TRIGGER IF NOT EXISTS force_destination_update_on_tag_update
|
||||||
|
AFTER UPDATE OF
|
||||||
|
genre,
|
||||||
|
albumartist,
|
||||||
|
year,
|
||||||
|
album,
|
||||||
|
disc,
|
||||||
|
artist,
|
||||||
|
track,
|
||||||
|
title,
|
||||||
|
composer,
|
||||||
|
performer,
|
||||||
|
rating,
|
||||||
|
releasecountry,
|
||||||
|
replaygain_alb,
|
||||||
|
replaygain_trk,
|
||||||
|
rate,
|
||||||
|
channels,
|
||||||
|
bitrate,
|
||||||
|
depth
|
||||||
|
ON tags
|
||||||
|
BEGIN
|
||||||
|
UPDATE destination_files SET last_change=0
|
||||||
|
WHERE source_file_id=old.source_file;
|
||||||
|
END;
|
||||||
|
' >&3
|
||||||
|
|
||||||
|
Update atom version 9 <<<"1 = 1"
|
||||||
|
}
|
||||||
@ -28,6 +28,7 @@ encodeFile::mp3() {
|
|||||||
[ -n "$albumartist" ] && lameopts+=(--tv TPE2="$albumartist")
|
[ -n "$albumartist" ] && lameopts+=(--tv TPE2="$albumartist")
|
||||||
[ -n "$composer" ] && lameopts+=(--tv TCOM="$composer")
|
[ -n "$composer" ] && lameopts+=(--tv TCOM="$composer")
|
||||||
[ -n "$performer" ] && lameopts+=(--tv TOPE="$performer")
|
[ -n "$performer" ] && lameopts+=(--tv TOPE="$performer")
|
||||||
|
[ -n "$rating" ] && lameopts+=(--tv "FMPS_RATING=$rating")
|
||||||
[ -n "$releasecountry" ] \
|
[ -n "$releasecountry" ] \
|
||||||
&& lameopts+=(--tv TXXX="MusicBrainz Album Release Country=$releasecountry")
|
&& lameopts+=(--tv TXXX="MusicBrainz Album Release Country=$releasecountry")
|
||||||
[ -n "$replaygain_alb" ] \
|
[ -n "$replaygain_alb" ] \
|
||||||
|
|||||||
@ -29,6 +29,7 @@ encodeFile::opus() {
|
|||||||
[ -n "$disc" ] && opusencopts+=(--comment "DISCNUMBER=$disc")
|
[ -n "$disc" ] && opusencopts+=(--comment "DISCNUMBER=$disc")
|
||||||
[ -n "$genre" ] && opusencopts+=(--comment "GENRE=$genre")
|
[ -n "$genre" ] && opusencopts+=(--comment "GENRE=$genre")
|
||||||
[ -n "$performer" ] && opusencopts+=(--comment "PERFORMER=$performer")
|
[ -n "$performer" ] && opusencopts+=(--comment "PERFORMER=$performer")
|
||||||
|
[ -n "$rating" ] && opusencopts+=(--comment "FMPS_RATING=$rating")
|
||||||
[ -n "$releasecountry" ] \
|
[ -n "$releasecountry" ] \
|
||||||
&& opusencopts+=(--comment "RELEASECOUNTRY=$releasecountry")
|
&& opusencopts+=(--comment "RELEASECOUNTRY=$releasecountry")
|
||||||
[ -n "$replaygain_alb" ] \
|
[ -n "$replaygain_alb" ] \
|
||||||
|
|||||||
@ -25,6 +25,7 @@ encodeFile::vorbis() {
|
|||||||
[ -n "$disc" ] && oggencopts+=(-c "DISCNUMBER=$disc")
|
[ -n "$disc" ] && oggencopts+=(-c "DISCNUMBER=$disc")
|
||||||
[ -n "$genre" ] && oggencopts+=(-G "$genre")
|
[ -n "$genre" ] && oggencopts+=(-G "$genre")
|
||||||
[ -n "$performer" ] && oggencopts+=(-c "PERFORMER=$performer")
|
[ -n "$performer" ] && oggencopts+=(-c "PERFORMER=$performer")
|
||||||
|
[ -n "$rating" ] && oggencopts+=(--comment "FMPS_RATING=$rating")
|
||||||
[ -n "$releasecountry" ] \
|
[ -n "$releasecountry" ] \
|
||||||
&& oggencopts+=(-c "RELEASECOUNTRY=$releasecountry")
|
&& oggencopts+=(-c "RELEASECOUNTRY=$releasecountry")
|
||||||
[ -n "$replaygain_alb" ] \
|
[ -n "$replaygain_alb" ] \
|
||||||
|
|||||||
@ -55,11 +55,13 @@ getDestFile() {
|
|||||||
destfile="${filename##*/}"
|
destfile="${filename##*/}"
|
||||||
destfile="${destfile%.*}"
|
destfile="${destfile%.*}"
|
||||||
fi
|
fi
|
||||||
destfile=$(sanitizeFile "$destfile")
|
|
||||||
destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::}
|
|
||||||
if (( ${destinationascii["$destination"]} ))
|
if (( ${destinationascii["$destination"]} ))
|
||||||
then
|
then
|
||||||
|
destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::}
|
||||||
echo "$destfile" >&${toascii[1]}
|
echo "$destfile" >&${toascii[1]}
|
||||||
read -r -u${toascii[0]} destfile
|
read -r -u${toascii[0]} destfile
|
||||||
|
destfile=${destfile//::AtOM:NewLine:SQL:Inline::/$'\n'}
|
||||||
fi
|
fi
|
||||||
|
destfile=$(sanitizeFile "$destfile")
|
||||||
|
destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,6 +40,9 @@ sanitizeFile() {
|
|||||||
string=${string/#+(.)/}
|
string=${string/#+(.)/}
|
||||||
string=${string/%+(.)/}
|
string=${string/%+(.)/}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# We can't have newlines either
|
||||||
|
string=${string//$'\n'/ }
|
||||||
fi
|
fi
|
||||||
echo "$string"
|
echo "$string"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
getInfosFLAC_version='FLAC-5'
|
getInfosFLAC_version='FLAC-6'
|
||||||
tagreaders+=( "$getInfosFLAC_version" )
|
tagreaders+=( "$getInfosFLAC_version" )
|
||||||
getInfos::FLAC() {
|
getInfos::FLAC() {
|
||||||
local \
|
local \
|
||||||
@ -17,6 +17,7 @@ getInfos::FLAC() {
|
|||||||
--show-tag=COMPOSER \
|
--show-tag=COMPOSER \
|
||||||
--show-tag=DATE \
|
--show-tag=DATE \
|
||||||
--show-tag=DISCNUMBER \
|
--show-tag=DISCNUMBER \
|
||||||
|
--show-tag=FMPS_RATING \
|
||||||
--show-tag=GENRE \
|
--show-tag=GENRE \
|
||||||
--show-tag=PERFORMER \
|
--show-tag=PERFORMER \
|
||||||
--show-tag=RELEASECOUNTRY \
|
--show-tag=RELEASECOUNTRY \
|
||||||
@ -34,6 +35,7 @@ getInfos::FLAC() {
|
|||||||
disc=$(gettag discnumber)
|
disc=$(gettag discnumber)
|
||||||
genre=$(gettag genre)
|
genre=$(gettag genre)
|
||||||
performer=$(gettag performer)
|
performer=$(gettag performer)
|
||||||
|
rating=$(gettag fmps_rating)
|
||||||
releasecountry=$(gettag releasecountry)
|
releasecountry=$(gettag releasecountry)
|
||||||
replaygain_alb=$(gettag replaygain_album_gain)
|
replaygain_alb=$(gettag replaygain_album_gain)
|
||||||
replaygain_trk=$(gettag replaygain_track_gain)
|
replaygain_trk=$(gettag replaygain_track_gain)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
getInfosOpus_version='Opus-4'
|
getInfosOpus_version='Opus-5'
|
||||||
tagreaders+=( "$getInfosOpus_version" )
|
tagreaders+=( "$getInfosOpus_version" )
|
||||||
getInfos::Opus() {
|
getInfos::Opus() {
|
||||||
tagreader="$getInfosOpus_version"
|
tagreader="$getInfosOpus_version"
|
||||||
@ -15,6 +15,7 @@ getInfos::Opus() {
|
|||||||
artist=$(gettag artist)
|
artist=$(gettag artist)
|
||||||
composer=$(gettag composer)
|
composer=$(gettag composer)
|
||||||
disc=$(gettag discnumber)
|
disc=$(gettag discnumber)
|
||||||
|
rating=$(gettag fmps_rating)
|
||||||
genre=$(gettag genre)
|
genre=$(gettag genre)
|
||||||
performer=$(gettag performer)
|
performer=$(gettag performer)
|
||||||
releasecountry=$(gettag releasecountry)
|
releasecountry=$(gettag releasecountry)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
getInfosffmpeg_version='ffmpeg-9'
|
getInfosffmpeg_version='ffmpeg-10'
|
||||||
tagreaders+=( "$getInfosffmpeg_version" )
|
tagreaders+=( "$getInfosffmpeg_version" )
|
||||||
getInfos::ffmpeg() {
|
getInfos::ffmpeg() {
|
||||||
tagreader="$getInfosffmpeg_version"
|
tagreader="$getInfosffmpeg_version"
|
||||||
@ -15,6 +15,7 @@ getInfos::ffmpeg() {
|
|||||||
artist, \
|
artist, \
|
||||||
composer, \
|
composer, \
|
||||||
disc, \
|
disc, \
|
||||||
|
fmps_rating,
|
||||||
genre, \
|
genre, \
|
||||||
TOPE, \
|
TOPE, \
|
||||||
releasecountry, \
|
releasecountry, \
|
||||||
@ -40,6 +41,7 @@ getInfos::ffmpeg() {
|
|||||||
disc=$(gettag TAG:disc)
|
disc=$(gettag TAG:disc)
|
||||||
genre=$(gettag TAG:genre)
|
genre=$(gettag TAG:genre)
|
||||||
performer=$(gettag TAG:TOPE)
|
performer=$(gettag TAG:TOPE)
|
||||||
|
rating=$(gettag fmps_rating)
|
||||||
releasecountry=$(gettag TAG:releasecountry)
|
releasecountry=$(gettag TAG:releasecountry)
|
||||||
[[ -z "$releasecountry" ]] \
|
[[ -z "$releasecountry" ]] \
|
||||||
&& releasecountry=$(gettag "TAG:MusicBrainz Album Release Country")
|
&& releasecountry=$(gettag "TAG:MusicBrainz Album Release Country")
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
getInfosSoxi_version='soxi-3'
|
getInfosSoxi_version='soxi-4'
|
||||||
tagreaders+=( "$getInfosSoxi_version" )
|
tagreaders+=( "$getInfosSoxi_version" )
|
||||||
getInfos::soxi() {
|
getInfos::soxi() {
|
||||||
tagreader="$getInfosSoxi_version"
|
tagreader="$getInfosSoxi_version"
|
||||||
@ -15,6 +15,7 @@ getInfos::soxi() {
|
|||||||
artist=$(gettag artist)
|
artist=$(gettag artist)
|
||||||
composer=$(gettag composer)
|
composer=$(gettag composer)
|
||||||
disc=$(gettag discnumber)
|
disc=$(gettag discnumber)
|
||||||
|
rating=$(gettag fmps_rating)
|
||||||
genre=$(gettag genre)
|
genre=$(gettag genre)
|
||||||
performer=$(gettag performer)
|
performer=$(gettag performer)
|
||||||
releasecountry=$(gettag releasecountry)
|
releasecountry=$(gettag releasecountry)
|
||||||
|
|||||||
@ -1,11 +1,33 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright © 2012-2026 ScriptFanix
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# A copy of the GNU General Public License v3 is includded in the LICENSE file
|
||||||
|
# at the root of the project.
|
||||||
|
|
||||||
updateTags() {
|
updateTags() {
|
||||||
local reader \
|
local reader \
|
||||||
|
|
||||||
|
# Build a WHERE clause fragment that excludes files already read by any
|
||||||
|
# known reader version; files not matching any known version need a
|
||||||
|
# re-read
|
||||||
for reader in "${tagreaders[@]}"
|
for reader in "${tagreaders[@]}"
|
||||||
do
|
do
|
||||||
tagreaderclause+="${tagreaderclause:+ AND }NOT tags.tagreader = \"$reader\""
|
tagreaderclause+="${tagreaderclause:+ AND }NOT tags.tagreader = \"$reader\""
|
||||||
done
|
done
|
||||||
|
# Query source files that need tag updates: either the file's
|
||||||
|
# last_change differs from the stored tag row's last_change, or the
|
||||||
|
# tagreader version has changed.
|
||||||
|
# Only files linked to a destination with action=1 (transcode) are
|
||||||
|
# included.
|
||||||
echo '
|
echo '
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
source_files.id,
|
source_files.id,
|
||||||
@ -20,6 +42,7 @@ updateTags() {
|
|||||||
tags.disc,
|
tags.disc,
|
||||||
tags.genre,
|
tags.genre,
|
||||||
tags.performer,
|
tags.performer,
|
||||||
|
tags.rating,
|
||||||
tags.releasecountry,
|
tags.releasecountry,
|
||||||
tags.replaygain_alb,
|
tags.replaygain_alb,
|
||||||
tags.replaygain_trk,
|
tags.replaygain_trk,
|
||||||
@ -47,11 +70,13 @@ updateTags() {
|
|||||||
)
|
)
|
||||||
AND mime_type_actions.action = 1
|
AND mime_type_actions.action = 1
|
||||||
ORDER BY source_files.id' >&3
|
ORDER BY source_files.id' >&3
|
||||||
|
# Optionally cap the number of files processed in one run
|
||||||
(( maxbatch )) && echo "LIMIT $maxbatch" >&3
|
(( maxbatch )) && echo "LIMIT $maxbatch" >&3
|
||||||
echo '
|
echo '
|
||||||
;
|
;
|
||||||
|
|
||||||
SELECT "AtOM:NoMoreFiles";' >&3
|
SELECT "AtOM:NoMoreFiles";' >&3
|
||||||
|
# Collect all result rows; sentinel "AtOM:NoMoreFiles" ends the loop
|
||||||
read -u4 -r -d $'\0' line
|
read -u4 -r -d $'\0' line
|
||||||
while ! [[ $line = AtOM:NoMoreFiles ]]
|
while ! [[ $line = AtOM:NoMoreFiles ]]
|
||||||
do
|
do
|
||||||
@ -59,9 +84,10 @@ echo '
|
|||||||
(( filecount++ ))
|
(( filecount++ ))
|
||||||
read -u4 -r -d $'\0' line
|
read -u4 -r -d $'\0' line
|
||||||
done
|
done
|
||||||
echo 'BEGIN TRANSACTION;' >&3
|
# Wrap all updates in a transaction echo 'BEGIN TRANSACTION;' >&3
|
||||||
for line in "${tagfiles[@]}"
|
for line in "${tagfiles[@]}"
|
||||||
do
|
do
|
||||||
|
# Split each row on the ::AtOM:SQL:Sep:: column separator
|
||||||
sourcefileid=${line%%::AtOM:SQL:Sep::*}
|
sourcefileid=${line%%::AtOM:SQL:Sep::*}
|
||||||
rest=${line#*::AtOM:SQL:Sep::}
|
rest=${line#*::AtOM:SQL:Sep::}
|
||||||
lastchange=${rest%%::AtOM:SQL:Sep::*}
|
lastchange=${rest%%::AtOM:SQL:Sep::*}
|
||||||
@ -86,6 +112,8 @@ echo '
|
|||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
oldperformer=${rest%%::AtOM:SQL:Sep::*}
|
oldperformer=${rest%%::AtOM:SQL:Sep::*}
|
||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
|
oldrating=${rest%%::AtOM:SQL:Sep::*}
|
||||||
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
oldreleasecountry=${rest%%::AtOM:SQL:Sep::*}
|
oldreleasecountry=${rest%%::AtOM:SQL:Sep::*}
|
||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
oldreplaygain_alb=${rest%%::AtOM:SQL:Sep::*}
|
oldreplaygain_alb=${rest%%::AtOM:SQL:Sep::*}
|
||||||
@ -104,7 +132,9 @@ echo '
|
|||||||
rest=${rest#*::AtOM:SQL:Sep::}
|
rest=${rest#*::AtOM:SQL:Sep::}
|
||||||
oldbitrate=${rest%%::AtOM:SQL:Sep::*}
|
oldbitrate=${rest%%::AtOM:SQL:Sep::*}
|
||||||
((++count))
|
((++count))
|
||||||
|
# Show percentage progress in interactive mode
|
||||||
(( cron )) || echo -en "\rTags: $((count*100/filecount))%"
|
(( cron )) || echo -en "\rTags: $((count*100/filecount))%"
|
||||||
|
# Commit every 100 files: limit reprocessing on interrupt/crash
|
||||||
if (( count % 100 == 0 ))
|
if (( count % 100 == 0 ))
|
||||||
then
|
then
|
||||||
echo 'COMMIT;BEGIN TRANSACTION;' >&3
|
echo 'COMMIT;BEGIN TRANSACTION;' >&3
|
||||||
@ -113,6 +143,10 @@ echo '
|
|||||||
fi
|
fi
|
||||||
if getTags
|
if getTags
|
||||||
then
|
then
|
||||||
|
# Set a dirty flag for each field that changed since
|
||||||
|
# the last read;
|
||||||
|
# only changed fields will be included in the UPDATE
|
||||||
|
# statement below
|
||||||
[[ $oldalbum != "$album" ]]&& ual=1
|
[[ $oldalbum != "$album" ]]&& ual=1
|
||||||
[[ $oldalbumartist != "$albumartist" ]]&&uaa=1
|
[[ $oldalbumartist != "$albumartist" ]]&&uaa=1
|
||||||
[[ $oldartist != "$artist" ]]&& uar=1
|
[[ $oldartist != "$artist" ]]&& uar=1
|
||||||
@ -130,6 +164,13 @@ echo '
|
|||||||
[[ $oldrate != "$rate" ]]&& ura=1
|
[[ $oldrate != "$rate" ]]&& ura=1
|
||||||
[[ $oldchannels != "$channels" ]]&& uch=1
|
[[ $oldchannels != "$channels" ]]&& uch=1
|
||||||
[[ $oldbitrate != "$bitrate" ]]&& ubi=1
|
[[ $oldbitrate != "$bitrate" ]]&& ubi=1
|
||||||
|
# Emit an Update with only dirty columns plus
|
||||||
|
# last_change/tagreader.
|
||||||
|
# ::AtOM:FT:: prefix forces text quoting even for
|
||||||
|
# numeric-looking values.
|
||||||
|
# Absent values become SQL NULL (no quotes).
|
||||||
|
# Each ${flag:+col val} expands to nothing when the
|
||||||
|
# flag is unset.
|
||||||
Update tags \
|
Update tags \
|
||||||
${ual:+album "${album:+::AtOM:FT::}${album:-NULL}"}\
|
${ual:+album "${album:+::AtOM:FT::}${album:-NULL}"}\
|
||||||
${uaa:+albumartist "${albumartist:+::AtOM:FT::}${albumartist:-NULL}"}\
|
${uaa:+albumartist "${albumartist:+::AtOM:FT::}${albumartist:-NULL}"}\
|
||||||
@ -139,6 +180,8 @@ echo '
|
|||||||
${udi:+disc "${disc:-NULL}"} \
|
${udi:+disc "${disc:-NULL}"} \
|
||||||
${uge:+genre "${genre:-NULL}"} \
|
${uge:+genre "${genre:-NULL}"} \
|
||||||
${upe:+performer "${performer:+::AtOM:FT::}${performer:-NULL}"}\
|
${upe:+performer "${performer:+::AtOM:FT::}${performer:-NULL}"}\
|
||||||
|
${urr:+rating "${rating:+::AtOM:FT::}${rating:-NULL}"}\
|
||||||
|
${urc:+releasecountry "${releasecountry:+::AtOM:FT::}${releasecountry:-NULL}"}\
|
||||||
${urc:+releasecountry "${releasecountry:+::AtOM:FT::}${releasecountry:-NULL}"}\
|
${urc:+releasecountry "${releasecountry:+::AtOM:FT::}${releasecountry:-NULL}"}\
|
||||||
${urpa:+replaygain_alb "${replaygain_alb:-NULL}"}\
|
${urpa:+replaygain_alb "${replaygain_alb:-NULL}"}\
|
||||||
${urpt:+replaygain_trk "${replaygain_trk:-NULL}"}\
|
${urpt:+replaygain_trk "${replaygain_trk:-NULL}"}\
|
||||||
@ -151,6 +194,8 @@ echo '
|
|||||||
${ubi:+bitrate "${bitrate:-NULL}"} \
|
${ubi:+bitrate "${bitrate:-NULL}"} \
|
||||||
tagreader "$tagreader" \
|
tagreader "$tagreader" \
|
||||||
>/dev/null <<<"source_file = $sourcefileid"
|
>/dev/null <<<"source_file = $sourcefileid"
|
||||||
|
# Clear all tag variables and dirty flags for the next
|
||||||
|
# iteration
|
||||||
unset genre \
|
unset genre \
|
||||||
albumartist \
|
albumartist \
|
||||||
year \
|
year \
|
||||||
@ -161,6 +206,7 @@ echo '
|
|||||||
title \
|
title \
|
||||||
composer \
|
composer \
|
||||||
performer \
|
performer \
|
||||||
|
rating \
|
||||||
releasecountry \
|
releasecountry \
|
||||||
replaygain_alb \
|
replaygain_alb \
|
||||||
replaygain_trk \
|
replaygain_trk \
|
||||||
@ -178,6 +224,7 @@ echo '
|
|||||||
oldtitle \
|
oldtitle \
|
||||||
oldcomposer \
|
oldcomposer \
|
||||||
oldperformer \
|
oldperformer \
|
||||||
|
oldrating \
|
||||||
oldreleasecountry \
|
oldreleasecountry \
|
||||||
oldreplaygain_alb \
|
oldreplaygain_alb \
|
||||||
oldreplaygain_trk \
|
oldreplaygain_trk \
|
||||||
@ -193,6 +240,7 @@ echo '
|
|||||||
udi \
|
udi \
|
||||||
uge \
|
uge \
|
||||||
upe \
|
upe \
|
||||||
|
urr \
|
||||||
urc \
|
urc \
|
||||||
urpa \
|
urpa \
|
||||||
urpt \
|
urpt \
|
||||||
@ -204,6 +252,7 @@ echo '
|
|||||||
ubi
|
ubi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# Commit the final partial batch
|
||||||
echo 'COMMIT;' >&3
|
echo 'COMMIT;' >&3
|
||||||
(( cron )) || echo -n $'\r'
|
(( cron )) || echo -n $'\r'
|
||||||
(( count )) && echo -n "Read tags from $count files."
|
(( count )) && echo -n "Read tags from $count files."
|
||||||
|
|||||||
@ -57,6 +57,7 @@ CREATE TABLE IF NOT EXISTS tags (
|
|||||||
title TEXT,
|
title TEXT,
|
||||||
composer TEXT,
|
composer TEXT,
|
||||||
performer TEXT,
|
performer TEXT,
|
||||||
|
rating FLOAT,
|
||||||
releasecountry TEXT,
|
releasecountry TEXT,
|
||||||
replaygain_alb TEXT,
|
replaygain_alb TEXT,
|
||||||
replaygain_trk TEXT,
|
replaygain_trk TEXT,
|
||||||
@ -131,6 +132,7 @@ CREATE TRIGGER IF NOT EXISTS force_destination_update_on_tag_update
|
|||||||
title,
|
title,
|
||||||
composer,
|
composer,
|
||||||
performer,
|
performer,
|
||||||
|
rating,
|
||||||
releasecountry,
|
releasecountry,
|
||||||
replaygain_alb,
|
replaygain_alb,
|
||||||
replaygain_trk,
|
replaygain_trk,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user