*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* read tracks from the plugin */
while(!inputline("rescanner", fp, &path, 0)) {
checkabort();
/* actually we can cope relatively well within the server, but they'll go
* wrong in track listings */
if(strchr(path, '\n')) {
/* read tracks from the plugin */
while(!inputline("rescanner", fp, &path, 0)) {
checkabort();
/* actually we can cope relatively well within the server, but they'll go
* wrong in track listings */
if(strchr(path, '\n')) {
continue;
}
if(config->dbversion > 1) {
/* We use NFC track names */
if(!(track = utf8_compose_canon(track, strlen(track), 0))) {
continue;
}
if(config->dbversion > 1) {
/* We use NFC track names */
if(!(track = utf8_compose_canon(track, strlen(track), 0))) {
if(n < config->player.n) {
nnew += !!trackdb_notice(track, path);
++ntracks;
if(n < config->player.n) {
nnew += !!trackdb_notice(track, path);
++ntracks;
- if(ntracks % 100 == 0 && time(0) > last_report + 10) {
- info("rescanning %s, %ld tracks so far", c->root, ntracks);
- time(&last_report);
+ if(ntracks % 100 == 0 && xtime(0) > last_report + 10) {
+ disorder_info("rescanning %s, %ld tracks so far", c->root, ntracks);
+ xtime(&last_report);
- info("rescanned %s, %ld tracks, %ld new", c->root, ntracks, nnew);
+ disorder_info("rescanned %s, %ld tracks, %ld new", c->root, ntracks, nnew);
- long nobsolete, nnocollection, nlength;
+
+ /** @brief Number of tracks obsoleted */
+ long nobsolete;
+
+ /** @brief Number of tracks belonging to no collection */
+ long nnocollection;
+
+ /** @brief Number of lengths computed */
+ long nlength;
+
+ /** @brief Linked list of tracks to recheck */
if(fnmatch(config->tracklength.s[n].s[0], t->track, 0) == 0)
break;
if(n >= config->tracklength.n)
if(fnmatch(config->tracklength.s[n].s[0], t->track, 0) == 0)
break;
if(n >= config->tracklength.n)
/* Doing the checking inside a transaction locks up the server for much too
* long (because it spends lots of time thinking about each track). So we
* pull the full track list into memory and work from that.
/* Doing the checking inside a transaction locks up the server for much too
* long (because it spends lots of time thinking about each track). So we
* pull the full track list into memory and work from that.
global_tid = trackdb_begin_transaction();
memset(&cs, 0, sizeof cs);
cs.c = c;
global_tid = trackdb_begin_transaction();
memset(&cs, 0, sizeof cs);
cs.c = c;
- info("rechecking %s, %ld tracks so far", c->root, nrc);
+ disorder_info("rechecking %s, %ld tracks so far", c->root, nrc);
- info("rechecked %s, %ld obsoleted, %ld lengths calculated",
- c->root, cs.nobsolete, cs.nlength);
+ disorder_info("rechecked %s, %ld obsoleted, %ld lengths calculated",
+ c->root, cs.nobsolete, cs.nlength);
- info("rechecked all tracks, %ld no collection, %ld obsoleted, %ld lengths calculated",
+ disorder_info("rechecked all tracks, %ld no collection, %ld obsoleted, %ld lengths calculated",
while((n = getopt_long(argc, argv, "hVc:dDSsKC", options, 0)) >= 0) {
switch(n) {
case 'h': help();
while((n = getopt_long(argc, argv, "hVc:dDSsKC", options, 0)) >= 0) {
switch(n) {
case 'h': help();
case 's': logsyslog = 1; break;
case 'K': do_check = 1; break;
case 'C': do_check = 0; break;
case 's': logsyslog = 1; break;
case 'K': do_check = 1; break;
case 'C': do_check = 0; break;
}
}
if(logsyslog) {
openlog(progname, LOG_PID, LOG_DAEMON);
log_default = &log_syslog;
}
}
}
if(logsyslog) {
openlog(progname, LOG_PID, LOG_DAEMON);
log_default = &log_syslog;
}
xnice(config->nice_rescan);
sa.sa_handler = signal_handler;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
xsigaction(SIGTERM, &sa, 0);
xsigaction(SIGINT, &sa, 0);
xnice(config->nice_rescan);
sa.sa_handler = signal_handler;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
xsigaction(SIGTERM, &sa, 0);
xsigaction(SIGINT, &sa, 0);