Allow user to trigger full rescan with a .force-rescan file

This commit is contained in:
ejurgensen
2013-11-29 22:48:53 +01:00
parent 0fd65b285d
commit adc9c03763
4 changed files with 55 additions and 0 deletions

View File

@@ -90,6 +90,9 @@ static pthread_t tid_scan;
static struct deferred_pl *playlists;
static struct stacked_dir *dirstack;
/* Forward */
static void
bulk_scan(void);
static int
push_dir(struct stacked_dir **s, char *path)
@@ -560,6 +563,19 @@ process_file(char *file, time_t mtime, off_t size, int type, int flags)
return;
}
else if (strcmp(ext, ".force-rescan") == 0)
{
if (flags & F_SCAN_BULK)
return;
else
{
DPRINTF(E_LOG, L_SCAN, "Forcing full rescan, found force-rescan file: %s\n", file);
db_purge_all();
bulk_scan();
return;
}
}
}
/* Not any kind of special file, so let's see if it's a media file */