chiark / gitweb /
server/rescan.c: Remove tracks which no longer have a player.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 5 May 2013 14:39:29 +0000 (15:39 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 22 May 2013 23:46:45 +0000 (00:46 +0100)
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

index 792bdf588908fa88d31f59e024a775339b4f4688..8f2419ce9ab5919b451c58e518ab047bd57df728 100644 (file)
@@ -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;