From 83b1b0ff69e03cbb472c6cfaaf87f782bb9d9a91 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 28 Feb 2009 14:02:03 +0100 Subject: [PATCH] update: don't update unchanged archive When the mtime of an archive time hasn't changed, don't update it again. --- src/update.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/update.c b/src/update.c index 78929f7d2..5cb02cb4e 100644 --- a/src/update.c +++ b/src/update.c @@ -373,6 +373,12 @@ update_archive_file(struct directory *parent, const char *name, struct directory *directory; char *filepath; + directory = dirvec_find(&parent->children, name); + if (directory != NULL && directory->mtime == st->st_mtime) + /* MPD has already scanned the archive, and it hasn't + changed since - don't consider updating it */ + return; + path_fs = map_directory_child_fs(parent, name); /* open archive */ @@ -386,7 +392,6 @@ update_archive_file(struct directory *parent, const char *name, g_debug("archive %s opened", path_fs); g_free(path_fs); - directory = dirvec_find(&parent->children, name); if (directory == NULL) { g_debug("creating archive directory: %s", name); directory = make_subdir(parent, name);