- n = tracklength(track, path);
- if(n > 0) {
- byte_snprintf(buffer, sizeof buffer, "%ld", n);
- kvp_set(&data, "_length", buffer);
- if((err = trackdb_putdata(trackdb_tracksdb, track, data, tid, 0)))
- return err;
- ++cs->nlength;
+ for(n = 0; n < config->tracklength.n; ++n)
+ if(fnmatch(config->tracklength.s[n].s[0], track, 0) == 0)
+ break;
+ if(n >= config->tracklength.n)
+ error(0, "no tracklength plugin found for %s", track);
+ else {
+ length = tracklength(config->tracklength.s[n].s[1], track, path);
+ if(length > 0) {
+ byte_snprintf(buffer, sizeof buffer, "%ld", length);
+ kvp_set(&data, "_length", buffer);
+ if((err = trackdb_putdata(trackdb_tracksdb, track, data, tid, 0)))
+ return err;
+ ++cs->nlength;
+ }