From: Mark Wooding Date: Sun, 5 May 2013 14:39:29 +0000 (+0100) Subject: server/rescan.c: Remove tracks which no longer have a player. X-Git-Tag: 5.1.1~9 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/c8a277f4ccdf4c392135769a4f0585dd7df5ae19 server/rescan.c: Remove tracks which no longer have a player. 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. --- 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;