From 851b57017d06048ce7feebb4d47bba4667077f30 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 11 May 2014 23:55:18 +0200 Subject: [PATCH] Add option to trigger startup scan, rename force-rescan and better cleanup in full rescan --- src/filescanner.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/filescanner.c b/src/filescanner.c index 48ed534b..c7b57faa 100644 --- a/src/filescanner.c +++ b/src/filescanner.c @@ -61,6 +61,7 @@ #include "conffile.h" #include "misc.h" #include "remote_pairing.h" +#include "player.h" #ifdef HAVE_SPOTIFY_H # include "spotify.h" @@ -684,19 +685,36 @@ process_file(char *file, time_t mtime, off_t size, int type, int flags) return; } #endif - else if (strcmp(ext, ".force-rescan") == 0) + else if (strcmp(ext, ".full-rescan") == 0) { if (flags & F_SCAN_BULK) return; else { - DPRINTF(E_LOG, L_SCAN, "Forcing full rescan, found force-rescan file: %s\n", file); + DPRINTF(E_LOG, L_SCAN, "Forcing full rescan, found full-rescan file: %s\n", file); + player_playback_stop(); + player_queue_clear(); inofd_event_unset(); // Clears all inotify watches db_purge_all(); // Clears files, playlists, playlistitems, inotify and groups inofd_event_set(); bulk_scan(F_SCAN_BULK); + return; + } + } + else if (strcmp(ext, ".init-rescan") == 0) + { + if (flags & F_SCAN_BULK) + return; + else + { + DPRINTF(E_LOG, L_SCAN, "Forcing startup rescan, found init-rescan file: %s\n", file); + inofd_event_unset(); // Clears all inotify watches + + inofd_event_set(); + bulk_scan(F_SCAN_BULK); + return; } }