Compare commits

..

10 Commits

Author SHA1 Message Date
Vincent Riquer
0f13154d6f comment lib/setup/* (#LLM assisted - Claude Code) 2026-03-13 17:52:26 +01:00
Vincent Riquer
3995e92323 comment lib/files/* 2026-03-13 17:38:41 +01:00
Vincent Riquer
c9a21637c6 comment lib/encode/* (#LLM-assisted - Claude Code) 2026-03-13 17:33:12 +01:00
Vincent Riquer
d0175fa03d comment lib/destinations/* (#LLM-assisted - Claude Code) 2026-03-13 17:20:38 +01:00
Vincent Riquer
6474bcab25 comment lib/decode/* (#LLM-assisted - Claude Code) 2026-03-13 16:34:02 +01:00
Vincent Riquer
22549072c3 Comment lib/database/* (#LLM-assisted - Claude Code) 2026-03-13 05:15:02 +01:00
Vincent Riquer
ee119f07a4 Comment lib/copy/* (#LLM-assisted - Claude Code) 2026-03-13 03:54:31 +01:00
Vincent Riquer
c99825912f Comment config handling (#LLM-assisted - Claude Code) 2026-03-13 02:42:40 +01:00
Vincent Riquer
d680d52425 Comment atom 2026-02-20 04:07:38 +01:00
Vincent Riquer
756ce7ec01 atom: License 2026-02-20 02:03:15 +01:00
14 changed files with 12 additions and 137 deletions

11
atom
View File

@ -265,12 +265,7 @@ do
rest=${line#*::AtOM:SQL:Sep::}
removeFileDestName=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::}
if [[ -n "${rest%%::AtOM:SQL:Sep::*}" ]]
then
removefile[$removeFileId]="${destinationpath["$removeFileDestName"]}/${rest%%::AtOM:SQL:Sep::*}"
else
removefile[$removeFileId]=''
fi
removefile[$removeFileId]="${destinationpath["$removeFileDestName"]}/${rest%%::AtOM:SQL:Sep::*}"
read -u4 -r -d $'\0' line
done
done
@ -480,7 +475,6 @@ echo '
tags.genre,
tags.performer,
tags.rate,
tags.rating,
tags.releasecountry,
tags.replaygain_alb,
tags.replaygain_trk,
@ -561,8 +555,6 @@ do
rest=${rest#*::AtOM:SQL:Sep::}
rate=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::}
rating=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::}
releasecountry=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::}
replaygain_alb=${rest%%::AtOM:SQL:Sep::*}
@ -633,7 +625,6 @@ do
mimetype \
performer \
rate \
rating \
releasecountry \
replaygain_alb \
replaygain_trk \

View File

@ -14,7 +14,7 @@
# at the root of the project.
# Current schema version this AtOM binary understands
currentdbversion=9
currentdbversion=8
checkDatabaseVersion() {
local dbversion
# Try to read the stored version from the 'atom' metadata table

View File

@ -1,51 +0,0 @@
#!/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"
}

View File

@ -28,7 +28,6 @@ encodeFile::mp3() {
[ -n "$albumartist" ] && lameopts+=(--tv TPE2="$albumartist")
[ -n "$composer" ] && lameopts+=(--tv TCOM="$composer")
[ -n "$performer" ] && lameopts+=(--tv TOPE="$performer")
[ -n "$rating" ] && lameopts+=(--tv "FMPS_RATING=$rating")
[ -n "$releasecountry" ] \
&& lameopts+=(--tv TXXX="MusicBrainz Album Release Country=$releasecountry")
[ -n "$replaygain_alb" ] \

View File

@ -29,7 +29,6 @@ encodeFile::opus() {
[ -n "$disc" ] && opusencopts+=(--comment "DISCNUMBER=$disc")
[ -n "$genre" ] && opusencopts+=(--comment "GENRE=$genre")
[ -n "$performer" ] && opusencopts+=(--comment "PERFORMER=$performer")
[ -n "$rating" ] && opusencopts+=(--comment "FMPS_RATING=$rating")
[ -n "$releasecountry" ] \
&& opusencopts+=(--comment "RELEASECOUNTRY=$releasecountry")
[ -n "$replaygain_alb" ] \

View File

@ -25,7 +25,6 @@ encodeFile::vorbis() {
[ -n "$disc" ] && oggencopts+=(-c "DISCNUMBER=$disc")
[ -n "$genre" ] && oggencopts+=(-G "$genre")
[ -n "$performer" ] && oggencopts+=(-c "PERFORMER=$performer")
[ -n "$rating" ] && oggencopts+=(--comment "FMPS_RATING=$rating")
[ -n "$releasecountry" ] \
&& oggencopts+=(-c "RELEASECOUNTRY=$releasecountry")
[ -n "$replaygain_alb" ] \

View File

@ -55,13 +55,11 @@ getDestFile() {
destfile="${filename##*/}"
destfile="${destfile%.*}"
fi
if (( ${destinationascii["$destination"]} ))
then
destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::}
echo "$destfile" >&${toascii[1]}
read -r -u${toascii[0]} destfile
destfile=${destfile//::AtOM:NewLine:SQL:Inline::/$'\n'}
fi
destfile=$(sanitizeFile "$destfile")
destfile=${destfile//$'\n'/::AtOM:NewLine:SQL:Inline::}
if (( ${destinationascii["$destination"]} ))
then
echo "$destfile" >&${toascii[1]}
read -r -u${toascii[0]} destfile
fi
}

View File

@ -40,9 +40,6 @@ sanitizeFile() {
string=${string/#+(.)/}
string=${string/%+(.)/}
fi
# We can't have newlines either
string=${string//$'\n'/ }
fi
echo "$string"
}

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
getInfosFLAC_version='FLAC-6'
getInfosFLAC_version='FLAC-5'
tagreaders+=( "$getInfosFLAC_version" )
getInfos::FLAC() {
local \
@ -17,7 +17,6 @@ getInfos::FLAC() {
--show-tag=COMPOSER \
--show-tag=DATE \
--show-tag=DISCNUMBER \
--show-tag=FMPS_RATING \
--show-tag=GENRE \
--show-tag=PERFORMER \
--show-tag=RELEASECOUNTRY \
@ -35,7 +34,6 @@ getInfos::FLAC() {
disc=$(gettag discnumber)
genre=$(gettag genre)
performer=$(gettag performer)
rating=$(gettag fmps_rating)
releasecountry=$(gettag releasecountry)
replaygain_alb=$(gettag replaygain_album_gain)
replaygain_trk=$(gettag replaygain_track_gain)

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
getInfosOpus_version='Opus-5'
getInfosOpus_version='Opus-4'
tagreaders+=( "$getInfosOpus_version" )
getInfos::Opus() {
tagreader="$getInfosOpus_version"
@ -15,7 +15,6 @@ getInfos::Opus() {
artist=$(gettag artist)
composer=$(gettag composer)
disc=$(gettag discnumber)
rating=$(gettag fmps_rating)
genre=$(gettag genre)
performer=$(gettag performer)
releasecountry=$(gettag releasecountry)

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
getInfosffmpeg_version='ffmpeg-10'
getInfosffmpeg_version='ffmpeg-9'
tagreaders+=( "$getInfosffmpeg_version" )
getInfos::ffmpeg() {
tagreader="$getInfosffmpeg_version"
@ -15,7 +15,6 @@ getInfos::ffmpeg() {
artist, \
composer, \
disc, \
fmps_rating,
genre, \
TOPE, \
releasecountry, \
@ -41,7 +40,6 @@ getInfos::ffmpeg() {
disc=$(gettag TAG:disc)
genre=$(gettag TAG:genre)
performer=$(gettag TAG:TOPE)
rating=$(gettag fmps_rating)
releasecountry=$(gettag TAG:releasecountry)
[[ -z "$releasecountry" ]] \
&& releasecountry=$(gettag "TAG:MusicBrainz Album Release Country")

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
getInfosSoxi_version='soxi-4'
getInfosSoxi_version='soxi-3'
tagreaders+=( "$getInfosSoxi_version" )
getInfos::soxi() {
tagreader="$getInfosSoxi_version"
@ -15,7 +15,6 @@ getInfos::soxi() {
artist=$(gettag artist)
composer=$(gettag composer)
disc=$(gettag discnumber)
rating=$(gettag fmps_rating)
genre=$(gettag genre)
performer=$(gettag performer)
releasecountry=$(gettag releasecountry)

View File

@ -1,33 +1,11 @@
#!/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() {
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[@]}"
do
tagreaderclause+="${tagreaderclause:+ AND }NOT tags.tagreader = \"$reader\""
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 '
SELECT DISTINCT
source_files.id,
@ -42,7 +20,6 @@ updateTags() {
tags.disc,
tags.genre,
tags.performer,
tags.rating,
tags.releasecountry,
tags.replaygain_alb,
tags.replaygain_trk,
@ -70,13 +47,11 @@ updateTags() {
)
AND mime_type_actions.action = 1
ORDER BY source_files.id' >&3
# Optionally cap the number of files processed in one run
(( maxbatch )) && echo "LIMIT $maxbatch" >&3
echo '
;
SELECT "AtOM:NoMoreFiles";' >&3
# Collect all result rows; sentinel "AtOM:NoMoreFiles" ends the loop
read -u4 -r -d $'\0' line
while ! [[ $line = AtOM:NoMoreFiles ]]
do
@ -84,10 +59,9 @@ echo '
(( filecount++ ))
read -u4 -r -d $'\0' line
done
# Wrap all updates in a transaction echo 'BEGIN TRANSACTION;' >&3
echo 'BEGIN TRANSACTION;' >&3
for line in "${tagfiles[@]}"
do
# Split each row on the ::AtOM:SQL:Sep:: column separator
sourcefileid=${line%%::AtOM:SQL:Sep::*}
rest=${line#*::AtOM:SQL:Sep::}
lastchange=${rest%%::AtOM:SQL:Sep::*}
@ -112,8 +86,6 @@ echo '
rest=${rest#*::AtOM:SQL:Sep::}
oldperformer=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::}
oldrating=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::}
oldreleasecountry=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::}
oldreplaygain_alb=${rest%%::AtOM:SQL:Sep::*}
@ -132,9 +104,7 @@ echo '
rest=${rest#*::AtOM:SQL:Sep::}
oldbitrate=${rest%%::AtOM:SQL:Sep::*}
((++count))
# Show percentage progress in interactive mode
(( cron )) || echo -en "\rTags: $((count*100/filecount))%"
# Commit every 100 files: limit reprocessing on interrupt/crash
if (( count % 100 == 0 ))
then
echo 'COMMIT;BEGIN TRANSACTION;' >&3
@ -143,10 +113,6 @@ echo '
fi
if getTags
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
[[ $oldalbumartist != "$albumartist" ]]&&uaa=1
[[ $oldartist != "$artist" ]]&& uar=1
@ -164,13 +130,6 @@ echo '
[[ $oldrate != "$rate" ]]&& ura=1
[[ $oldchannels != "$channels" ]]&& uch=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 \
${ual:+album "${album:+::AtOM:FT::}${album:-NULL}"}\
${uaa:+albumartist "${albumartist:+::AtOM:FT::}${albumartist:-NULL}"}\
@ -180,8 +139,6 @@ echo '
${udi:+disc "${disc:-NULL}"} \
${uge:+genre "${genre:-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}"}\
${urpa:+replaygain_alb "${replaygain_alb:-NULL}"}\
${urpt:+replaygain_trk "${replaygain_trk:-NULL}"}\
@ -194,8 +151,6 @@ echo '
${ubi:+bitrate "${bitrate:-NULL}"} \
tagreader "$tagreader" \
>/dev/null <<<"source_file = $sourcefileid"
# Clear all tag variables and dirty flags for the next
# iteration
unset genre \
albumartist \
year \
@ -206,7 +161,6 @@ echo '
title \
composer \
performer \
rating \
releasecountry \
replaygain_alb \
replaygain_trk \
@ -224,7 +178,6 @@ echo '
oldtitle \
oldcomposer \
oldperformer \
oldrating \
oldreleasecountry \
oldreplaygain_alb \
oldreplaygain_trk \
@ -240,7 +193,6 @@ echo '
udi \
uge \
upe \
urr \
urc \
urpa \
urpt \
@ -252,7 +204,6 @@ echo '
ubi
fi
done
# Commit the final partial batch
echo 'COMMIT;' >&3
(( cron )) || echo -n $'\r'
(( count )) && echo -n "Read tags from $count files."

View File

@ -57,7 +57,6 @@ CREATE TABLE IF NOT EXISTS tags (
title TEXT,
composer TEXT,
performer TEXT,
rating FLOAT,
releasecountry TEXT,
replaygain_alb TEXT,
replaygain_trk TEXT,
@ -132,7 +131,6 @@ CREATE TRIGGER IF NOT EXISTS force_destination_update_on_tag_update
title,
composer,
performer,
rating,
releasecountry,
replaygain_alb,
replaygain_trk,