diff --git a/src/conf.c b/src/conf.c index 309ae6f8..279ce3d9 100644 --- a/src/conf.c +++ b/src/conf.c @@ -93,7 +93,7 @@ static CONF_ELEMENTS conf_elements[] = { { 1, 0, CONF_T_EXISTPATH,"general","web_root" }, { 1, 0, CONF_T_INT,"general","port" }, { 1, 0, CONF_T_STRING,"general","admin_pw" }, - { 1, 0, CONF_T_STRING,"general","mp3_dir" }, + { 1, 0, CONF_T_MULTICOMMA,"general","mp3_dir" }, { 0, 1, CONF_T_EXISTPATH,"general","db_dir" }, { 0, 0, CONF_T_STRING,"general","db_type" }, { 0, 0, CONF_T_EXISTPATH,"general","db_parms" }, /* this isn't right */ diff --git a/src/main.c b/src/main.c index d3bd9084..4f6b8cf8 100644 --- a/src/main.c +++ b/src/main.c @@ -185,7 +185,8 @@ int main(int argc, char *argv[]) { int force_non_root=0; int skip_initial=0; int convert_conf=0; - char *logfile,*db_type,*db_parms,*mp3_dir,*web_root,*runas; + char *logfile,*db_type,*db_parms,*web_root,*runas; + char **mp3_dir_array; char *servername,*iface; char txtrecord[255]; @@ -340,15 +341,16 @@ int main(int argc, char *argv[]) { DPRINTF(E_FATAL,L_MAIN|L_DB,"Error in db_init: %s\n",strerror(errno)); } - mp3_dir = conf_alloc_string("general","mp3_dir","/mnt/mp3"); - if(!skip_initial) { - DPRINTF(E_LOG,L_MAIN|L_SCAN,"Starting mp3 scan of %s\n",mp3_dir); + if(conf_get_array("general","mp3_dir",&mp3_dir_array)) { + if(!skip_initial) { + DPRINTF(E_LOG,L_MAIN|L_SCAN,"Starting mp3 scan\n"); - if(scan_init(mp3_dir)) { - DPRINTF(E_LOG,L_MAIN|L_SCAN,"Error scanning MP3 files: %s\n",strerror(errno)); + if(scan_init(mp3_dir_array)) { + DPRINTF(E_LOG,L_MAIN|L_SCAN,"Error scanning MP3 files: %s\n",strerror(errno)); + } } + conf_dispose_array(mp3_dir_array); } - free(mp3_dir); /* start up the web server */ web_root = conf_alloc_string("general","web_root",NULL); @@ -423,12 +425,13 @@ int main(int argc, char *argv[]) { start_time=(int) time(NULL); DPRINTF(E_LOG,L_MAIN|L_DB|L_SCAN,"Rescanning database\n"); - /* FIXME: move mp3_dir to scanner */ - mp3_dir = conf_alloc_string("general","mp3_dir","/mnt/mp3"); - if(scan_init(mp3_dir)) { - DPRINTF(E_LOG,L_MAIN|L_DB|L_SCAN,"Error rescanning... bad path?\n"); + + if(conf_get_array("general","mp3_dir",&mp3_dir_array)) { + if(scan_init(mp3_dir_array)) { + DPRINTF(E_LOG,L_MAIN|L_DB|L_SCAN,"Error rescanning... bad path?\n"); + } + conf_dispose_array(mp3_dir_array); } - free(mp3_dir); config.reload=0; db_get_song_count(NULL,&song_count); DPRINTF(E_INF,L_MAIN|L_DB|L_SCAN,"Scanned %d songs (was %d) in " diff --git a/src/mp3-scanner.c b/src/mp3-scanner.c index bce212f9..b1f5e186 100644 --- a/src/mp3-scanner.c +++ b/src/mp3-scanner.c @@ -231,8 +231,9 @@ void scan_process_playlistlist(void) { * and update files on a file-by-file basis */ -int scan_init(char *path) { +int scan_init(char **patharray) { int err=0; + int index=0; DPRINTF(E_DBG,L_SCAN,"Starting scan_init\n"); @@ -241,10 +242,13 @@ int scan_init(char *path) { return -1; } - DPRINTF(E_DBG,L_SCAN,"Scanning for MP3s in %s\n",path); - scan_playlistlist.next=NULL; - err=scan_path(path); + + while(patharray[index] != NULL) { + DPRINTF(E_DBG,L_SCAN,"Scanning for MP3s in %s\n",patharray[index]); + err=scan_path(patharray[index]); + index++; + } if(db_end_song_scan()) return -1; diff --git a/src/mp3-scanner.h b/src/mp3-scanner.h index 69aab5cd..6d5cdc33 100644 --- a/src/mp3-scanner.h +++ b/src/mp3-scanner.h @@ -98,7 +98,7 @@ typedef struct tag_m3ufile { #define WINAMP_GENRE_UNKNOWN 148 extern char *scan_winamp_genre[]; -extern int scan_init(char *path); +extern int scan_init(char **patharray); extern void make_composite_tags(MP3FILE *song); #ifndef TRUE