From c8a277f4ccdf4c392135769a4f0585dd7df5ae19 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sun, 5 May 2013 15:39:29 +0100 Subject: [PATCH] server/rescan.c: Remove tracks which no longer have a player. Organization: Straylight/Edgeware From: Mark Wooding If you ever add a player with an overly broad pattern, and it matches a file which isn't actually an audio file but is legitimately part of the directory tree, then there's no way of getting it out of DisOrder's database short of hacking the files directly. --- server/rescan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/rescan.c b/server/rescan.c index 792bdf5..8f2419c 100644 --- a/server/rescan.c +++ b/server/rescan.c @@ -233,8 +233,11 @@ static int recheck_track_tid(struct recheck_state *cs, return 0; } } - /* see if the track has evaporated */ - if(check(c->module, c->root, path) == 0) { + /* see if the track has evaporated or no longer has a player */ + for(n = 0; (n < config->player.n + && fnmatch(config->player.s[n].s[0], t->track, 0) != 0); ++n) + ; + if(n >= config->player.n || check(c->module, c->root, path) == 0) { D(("obsoleting %s", t->track)); if((err = trackdb_obsolete(t->track, tid))) return err; -- [mdw]