From 11eaaf6d4f6b21240e7da751739d959c8b679504 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Mon, 8 Mar 2004 21:27:38 +0000 Subject: [PATCH] Small fixes --- src/daap.c | 1 + src/main.c | 9 +++++++++ src/mp3-scanner.c | 44 ++++++++++++++++++++++---------------------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/daap.c b/src/daap.c index fde23986..fb6b90f1 100644 --- a/src/daap.c +++ b/src/daap.c @@ -335,6 +335,7 @@ DAAP_BLOCK *daap_response_songlist(void) { db_enum_end(); if(!g) { + DPRINTF(ERR_DEBUG,"Error enumerating database\n"); daap_free(root); return NULL; } diff --git a/src/main.c b/src/main.c index 48d8c5f0..59a722af 100644 --- a/src/main.c +++ b/src/main.c @@ -422,6 +422,8 @@ int main(int argc, char *argv[]) { WSHANDLE server; int parseonly=0; int foreground=0; + int start_time; + int end_time; config.use_mdns=1; @@ -460,6 +462,8 @@ int main(int argc, char *argv[]) { /* read the configfile, if specified, otherwise * try defaults */ + start_time=time(NULL); + if(config_read(configfile)) { perror("config_read"); exit(EXIT_FAILURE); @@ -536,6 +540,11 @@ int main(int argc, char *argv[]) { 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; while(!config.stop) diff --git a/src/mp3-scanner.c b/src/mp3-scanner.c index 46acac0c..a0042d41 100644 --- a/src/mp3-scanner.c +++ b/src/mp3-scanner.c @@ -317,29 +317,29 @@ int scan_path(char *path) { DPRINTF(ERR_DEBUG,"Found %s\n",mp3_path); if(stat(mp3_path,&sb)) { 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 { - DPRINTF(ERR_DEBUG,"Processing file\n"); - /* process the file */ - if(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 */ - modified_time=sb.st_mtime; - if((scan_mode_foreground) || - !db_exists(sb.st_ino) || - db_last_modified(sb.st_ino) < modified_time) { - scan_music_file(path,pde,&sb); - } else { - DPRINTF(ERR_DEBUG,"Skipping file... not modified\n"); + if(sb.st_mode & S_IFDIR) { /* dir -- recurse */ + DPRINTF(ERR_DEBUG,"Found dir %s... recursing\n",pde->d_name); + scan_path(mp3_path); + } else { + DPRINTF(ERR_INFO,"Processing %s\n",mp3_path); + /* process the file */ + if(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 */ + modified_time=sb.st_mtime; + if((scan_mode_foreground) || + !db_exists(sb.st_ino) || + db_last_modified(sb.st_ino) < modified_time) { + scan_music_file(path,pde,&sb); + } else { + DPRINTF(ERR_DEBUG,"Skipping file... not modified\n"); + } } } }