Small fixes

This commit is contained in:
Ron Pedde 2004-03-08 21:27:38 +00:00
parent cdbbab756f
commit 11eaaf6d4f
3 changed files with 32 additions and 22 deletions

View File

@ -335,6 +335,7 @@ DAAP_BLOCK *daap_response_songlist(void) {
db_enum_end(); db_enum_end();
if(!g) { if(!g) {
DPRINTF(ERR_DEBUG,"Error enumerating database\n");
daap_free(root); daap_free(root);
return NULL; return NULL;
} }

View File

@ -422,6 +422,8 @@ int main(int argc, char *argv[]) {
WSHANDLE server; WSHANDLE server;
int parseonly=0; int parseonly=0;
int foreground=0; int foreground=0;
int start_time;
int end_time;
config.use_mdns=1; config.use_mdns=1;
@ -460,6 +462,8 @@ int main(int argc, char *argv[]) {
/* read the configfile, if specified, otherwise /* read the configfile, if specified, otherwise
* try defaults */ * try defaults */
start_time=time(NULL);
if(config_read(configfile)) { if(config_read(configfile)) {
perror("config_read"); perror("config_read");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -536,6 +540,11 @@ int main(int argc, char *argv[]) {
rend_register(config.servername,"_http._tcp",config.port); rend_register(config.servername,"_http._tcp",config.port);
} }
end_time=time(NULL);
log_err(0,"Scanned %d songs in %d seconds\n",db_get_song_count(),
end_time-start_time);
config.stop=0; config.stop=0;
while(!config.stop) while(!config.stop)

View File

@ -317,29 +317,29 @@ int scan_path(char *path) {
DPRINTF(ERR_DEBUG,"Found %s\n",mp3_path); DPRINTF(ERR_DEBUG,"Found %s\n",mp3_path);
if(stat(mp3_path,&sb)) { if(stat(mp3_path,&sb)) {
DPRINTF(ERR_WARN,"Error statting: %s\n",strerror(errno)); DPRINTF(ERR_WARN,"Error statting: %s\n",strerror(errno));
}
if(sb.st_mode & S_IFDIR) { /* dir -- recurse */
DPRINTF(ERR_DEBUG,"Found dir %s... recursing\n",pde->d_name);
scan_path(mp3_path);
} else { } else {
DPRINTF(ERR_DEBUG,"Processing file\n"); if(sb.st_mode & S_IFDIR) { /* dir -- recurse */
/* process the file */ DPRINTF(ERR_DEBUG,"Found dir %s... recursing\n",pde->d_name);
if(strlen(pde->d_name) > 4) { scan_path(mp3_path);
if(strcasecmp(".m3u",(char*)&pde->d_name[strlen(pde->d_name) - 4]) == 0) { } else {
/* we found an m3u file */ DPRINTF(ERR_INFO,"Processing %s\n",mp3_path);
scan_static_playlist(path, pde, &sb); /* process the file */
} else if (strcasestr(config.extensions, if(strlen(pde->d_name) > 4) {
(char*)&pde->d_name[strlen(pde->d_name) - 4])) { if(strcasecmp(".m3u",(char*)&pde->d_name[strlen(pde->d_name) - 4]) == 0) {
/* we found an m3u file */
scan_static_playlist(path, pde, &sb);
} else if (strcasestr(config.extensions,
(char*)&pde->d_name[strlen(pde->d_name) - 4])) {
/* only scan if it's been changed, or empty db */ /* only scan if it's been changed, or empty db */
modified_time=sb.st_mtime; modified_time=sb.st_mtime;
if((scan_mode_foreground) || if((scan_mode_foreground) ||
!db_exists(sb.st_ino) || !db_exists(sb.st_ino) ||
db_last_modified(sb.st_ino) < modified_time) { db_last_modified(sb.st_ino) < modified_time) {
scan_music_file(path,pde,&sb); scan_music_file(path,pde,&sb);
} else { } else {
DPRINTF(ERR_DEBUG,"Skipping file... not modified\n"); DPRINTF(ERR_DEBUG,"Skipping file... not modified\n");
}
} }
} }
} }