From f06a93c17acdf3dabee20ecbbc7c05050e0f092c Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Wed, 2 Jan 2013 21:00:52 +0000 Subject: [PATCH] * Store the media type in the TIMESTAMP column, so we can force a rescan if the user changes the media type configuration. --- minidlna.c | 4 ++-- scanner.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/minidlna.c b/minidlna.c index b216ec8..d591a70 100644 --- a/minidlna.c +++ b/minidlna.c @@ -347,8 +347,8 @@ check_db(sqlite3 *db, int new_db, pid_t *scanner_pid) media_path = media_dirs; while (media_path) { - ret = sql_get_int_field(db, "SELECT ID from DETAILS where PATH = %Q", media_path->path); - if (ret < 1) + ret = sql_get_int_field(db, "SELECT TIMESTAMP from DETAILS where PATH = %Q", media_path->path); + if (ret != media_path->types) { ret = 1; goto rescan; diff --git a/scanner.c b/scanner.c index e6a47f7..565e2e7 100644 --- a/scanner.c +++ b/scanner.c @@ -787,8 +787,11 @@ start_scanner() av_log_set_level(AV_LOG_PANIC); while( media_path ) { + int64_t id; strncpyt(name, media_path->path, sizeof(name)); - GetFolderMetadata(basename(name), media_path->path, NULL, NULL, 0); + id = GetFolderMetadata(basename(name), media_path->path, NULL, NULL, 0); + /* Use TIMESTAMP to store the media type */ + sql_exec(db, "UPDATE DETAILS set TIMESTAMP = %d where ID = %lld", media_path->types, (long long)id); ScanDirectory(media_path->path, NULL, media_path->types); sql_exec(db, "INSERT into SETTINGS values (%Q, %Q)", "media_dir", media_path->path); media_path = media_path->next;