From 351725c8b2dc2d3fa2b4ca099f60714d025282ad Mon Sep 17 00:00:00 2001 From: chme Date: Fri, 16 Dec 2016 18:38:28 +0100 Subject: [PATCH 1/2] [db] initialize id parameter with 0 --- src/db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db.c b/src/db.c index 60e13ad7..d945a7ee 100644 --- a/src/db.c +++ b/src/db.c @@ -2312,6 +2312,7 @@ db_file_stamp_bypath(char *path, time_t *stamp, int *id) sqlite3_stmt *stmt; int ret; + *id = 0; *stamp = 0; query = sqlite3_mprintf(Q_TMPL, path); From af774ef175ae3876b59a2f3bf0b4a303e520ad02 Mon Sep 17 00:00:00 2001 From: chme Date: Fri, 16 Dec 2016 18:38:03 +0100 Subject: [PATCH 2/2] [filescanner] Remove unnecessary query for file id in process_media The previous query for db_file_stamp_bypath already retrieves the file id for the given path. --- src/filescanner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filescanner.c b/src/filescanner.c index d8e93e2d..daf9b3fa 100644 --- a/src/filescanner.c +++ b/src/filescanner.c @@ -626,7 +626,7 @@ filescanner_process_media(char *path, time_t mtime, off_t size, int type, struct mfi = external_mfi; if (stamp) - mfi->id = db_file_id_bypath(path); + mfi->id = id; mfi->fname = strdup(filename); if (!mfi->fname)