allow ignoring microseconds in file timestamps

This commit is contained in:
Vincent Riquer 2025-11-09 02:06:02 +01:00
parent b6110cf626
commit 97e47d1d0b
5 changed files with 22 additions and 1 deletions

View File

@ -39,6 +39,11 @@ Sections:
* debug <level>: Integer. Currently defined values: * debug <level>: Integer. Currently defined values:
* 1: few additional status informations. * 1: few additional status informations.
* 3: log SQL queries. * 3: log SQL queries.
* skip-timestamp-microsec <bool>: Ignore microsecond precision in timestamps.
Microsec precise timestamps are still stored as-is in the DB, this
setting just impacts comparisons when determining if a file has been
changed.
[source] [source]
This section defines where are the files you want transcoded. This section defines where are the files you want transcoded.

View File

@ -34,6 +34,9 @@ database /home/user/.local/share/AtOM/atom.db
# 3: log SQL queries to <temporary-directory>/debug.log # 3: log SQL queries to <temporary-directory>/debug.log
#debug 1 #debug 1
# * skip-timestamp-microsec: Ignore microsecond precision in timestamps.
skip-timestamp-microsec 0
[source] [source]
# This section defines where are the files you want transcoded. # This section defines where are the files you want transcoded.

View File

@ -75,6 +75,9 @@ getConfigGeneral() {
'database') 'database')
database="$value" database="$value"
;; ;;
'skip-timestamp-microsec')
skip_us_timestamp="$value"
;;
debug) debug)
(( value > debug )) && debug=$value (( value > debug )) && debug=$value
;; ;;

View File

@ -33,6 +33,9 @@ database $database
# * debug <level>: Integer. # * debug <level>: Integer.
#debug 1 #debug 1
# * skip-timestamp-microsec: Ignore microsecond precision in timestamps.
skip-timestamp-microsec ${skip_us_timestamp:-0}
[source] [source]
# This section defines where are the files you want transcoded. # This section defines where are the files you want transcoded.

View File

@ -10,10 +10,17 @@ getFiles() {
echo 'BEGIN TRANSACTION;' >&3 echo 'BEGIN TRANSACTION;' >&3
while read time size filename while read time size filename
do do
if (( skip_us_timestamp ))
then
compare_time=${time%.*}.%
else
compare_time=$time
fi
if ! Select source_files id >/dev/null <<-EOWhere if ! Select source_files id >/dev/null <<-EOWhere
filename = $filename filename = $filename
mime_type > 0 mime_type > 0
last_change = $time last_change LIKE $compare_time
size = $size
EOWhere EOWhere
then then
mimetype=$(file -b --mime-type "$sourcepath/$filename") mimetype=$(file -b --mime-type "$sourcepath/$filename")