Make mp3_dir multivalued, closing ticket #16

This commit is contained in:
Ron Pedde 2006-04-12 05:18:55 +00:00
parent 15edcf0670
commit 267528f070
4 changed files with 25 additions and 18 deletions

View File

@ -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 */

View File

@ -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(conf_get_array("general","mp3_dir",&mp3_dir_array)) {
if(!skip_initial) {
DPRINTF(E_LOG,L_MAIN|L_SCAN,"Starting mp3 scan of %s\n",mp3_dir);
DPRINTF(E_LOG,L_MAIN|L_SCAN,"Starting mp3 scan\n");
if(scan_init(mp3_dir)) {
if(scan_init(mp3_dir_array)) {
DPRINTF(E_LOG,L_MAIN|L_SCAN,"Error scanning MP3 files: %s\n",strerror(errno));
}
}
free(mp3_dir);
conf_dispose_array(mp3_dir_array);
}
/* 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)) {
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");
}
free(mp3_dir);
conf_dispose_array(mp3_dir_array);
}
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 "

View File

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

View File

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