From 97e47d1d0b456ad7cbc5f2c8f5bac5ba5904d1ec Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Sun, 9 Nov 2025 02:06:02 +0100 Subject: [PATCH] allow ignoring microseconds in file timestamps --- doc/config | 5 +++++ doc/example.cfg | 3 +++ lib/config/getGeneral | 3 +++ lib/config/write | 3 +++ lib/files/getFiles | 9 ++++++++- 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/config b/doc/config index 9068e64..0fe529d 100644 --- a/doc/config +++ b/doc/config @@ -39,6 +39,11 @@ Sections: * debug : Integer. Currently defined values: * 1: few additional status informations. * 3: log SQL queries. + * skip-timestamp-microsec : 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] This section defines where are the files you want transcoded. diff --git a/doc/example.cfg b/doc/example.cfg index ffea7f7..0e76b61 100644 --- a/doc/example.cfg +++ b/doc/example.cfg @@ -34,6 +34,9 @@ database /home/user/.local/share/AtOM/atom.db # 3: log SQL queries to /debug.log #debug 1 +# * skip-timestamp-microsec: Ignore microsecond precision in timestamps. +skip-timestamp-microsec 0 + [source] # This section defines where are the files you want transcoded. diff --git a/lib/config/getGeneral b/lib/config/getGeneral index 1e7797d..c5d5f2e 100644 --- a/lib/config/getGeneral +++ b/lib/config/getGeneral @@ -75,6 +75,9 @@ getConfigGeneral() { 'database') database="$value" ;; + 'skip-timestamp-microsec') + skip_us_timestamp="$value" + ;; debug) (( value > debug )) && debug=$value ;; diff --git a/lib/config/write b/lib/config/write index f4954ad..e436231 100644 --- a/lib/config/write +++ b/lib/config/write @@ -33,6 +33,9 @@ database $database # * debug : Integer. #debug 1 +# * skip-timestamp-microsec: Ignore microsecond precision in timestamps. +skip-timestamp-microsec ${skip_us_timestamp:-0} + [source] # This section defines where are the files you want transcoded. diff --git a/lib/files/getFiles b/lib/files/getFiles index f6c28db..72a21d8 100644 --- a/lib/files/getFiles +++ b/lib/files/getFiles @@ -10,10 +10,17 @@ getFiles() { echo 'BEGIN TRANSACTION;' >&3 while read time size filename do + if (( skip_us_timestamp )) + then + compare_time=${time%.*}.% + else + compare_time=$time + fi if ! Select source_files id >/dev/null <<-EOWhere filename = $filename mime_type > 0 - last_change = $time + last_change LIKE $compare_time + size = $size EOWhere then mimetype=$(file -b --mime-type "$sourcepath/$filename")