mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-12 15:33:23 -05:00
[scan] Fix missing rescan if a file is modified quickly multiple times
If db_timestamp == file_mtime we didn't rescan, just pinged the file in the db Fixes #1782
This commit is contained in:
parent
90a79090ea
commit
59bba5e261
5
src/db.c
5
src/db.c
@ -7055,7 +7055,10 @@ db_statements_prepare_ping(const char *table)
|
||||
sqlite3_stmt *stmt;
|
||||
int ret;
|
||||
|
||||
CHECK_NULL(L_DB, query = db_mprintf("UPDATE %s SET db_timestamp = ?, disabled = 0 WHERE path = ? AND db_timestamp >= ?;", table));
|
||||
// The last param will be the file mtime. We must not update if the mtime is
|
||||
// newer or equal than the current db_timestamp, since the file may have been
|
||||
// modified and must be rescanned.
|
||||
CHECK_NULL(L_DB, query = db_mprintf("UPDATE %s SET db_timestamp = ?, disabled = 0 WHERE path = ? AND db_timestamp > ?;", table));
|
||||
|
||||
ret = db_blocking_prepare_v2(query, -1, &stmt, NULL);
|
||||
if (ret != SQLITE_OK)
|
||||
|
@ -572,10 +572,12 @@ process_regular_file(const char *file, struct stat *sb, int type, int flags, int
|
||||
char virtual_path[PATH_MAX];
|
||||
int ret;
|
||||
|
||||
// Will return 0 if file is not in library or if file mtime is newer than library timestamp
|
||||
// - note if mtime is 0 then we always scan the file
|
||||
if (!(flags & F_SCAN_METARESCAN))
|
||||
{
|
||||
// Will return 0 if file is not in library or if file mtime is not older
|
||||
// than the library timestamp. If mtime is equal we must rescan, since a
|
||||
// fast update may have been made, see issue #1782. If mtime is 0 then we
|
||||
// always scan.
|
||||
ret = db_file_ping_bypath(file, sb->st_mtime);
|
||||
if ((sb->st_mtime != 0) && (ret != 0))
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user