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();
if(!g) {
DPRINTF(ERR_DEBUG,"Error enumerating database\n");
daap_free(root);
return NULL;
}

View File

@ -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)

View File

@ -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");
}
}
}
}