aboutsummaryrefslogtreecommitdiff
path: root/src/update.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-28 14:02:03 +0100
committerMax Kellermann <max@duempel.org>2009-02-28 14:02:03 +0100
commit83b1b0ff69e03cbb472c6cfaaf87f782bb9d9a91 (patch)
treea30ee76e95d12ae2857709b3faa83340e98dc4ed /src/update.c
parent2aebbf84606fa6fa5a014ac288eef9bc5d63402e (diff)
update: don't update unchanged archive
When the mtime of an archive time hasn't changed, don't update it again.
Diffstat (limited to 'src/update.c')
-rw-r--r--src/update.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/update.c b/src/update.c
index 78929f7d..5cb02cb4 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);