update: don't update unchanged archive

When the mtime of an archive time hasn't changed, don't update it
again.
This commit is contained in:
Max Kellermann 2009-02-28 14:02:03 +01:00
parent 2aebbf8460
commit 83b1b0ff69

View File

@ -373,6 +373,12 @@ update_archive_file(struct directory *parent, const char *name,
struct directory *directory; struct directory *directory;
char *filepath; 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); path_fs = map_directory_child_fs(parent, name);
/* open archive */ /* open archive */
@ -386,7 +392,6 @@ update_archive_file(struct directory *parent, const char *name,
g_debug("archive %s opened", path_fs); g_debug("archive %s opened", path_fs);
g_free(path_fs); g_free(path_fs);
directory = dirvec_find(&parent->children, name);
if (directory == NULL) { if (directory == NULL) {
g_debug("creating archive directory: %s", name); g_debug("creating archive directory: %s", name);
directory = make_subdir(parent, name); directory = make_subdir(parent, name);