diff --git a/src/configfile.c b/src/configfile.c index 464d819e..d34c023b 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -94,6 +94,7 @@ CONFIGELEMENT config_elements[] = { { 1,0,0,CONFIG_TYPE_STRING,"db_dir",(void*)&config.dbdir,config_emit_string }, #endif { 1,1,0,CONFIG_TYPE_STRING,"servername",(void*)&config.servername,config_emit_string }, + { 1,0,0,CONFIG_TYPE_INT,"rescan_interval",(void*)&config.rescan_interval,config_emit_int }, { 1,0,0,CONFIG_TYPE_STRING,"playlist",(void*)&config.playlist,config_emit_string }, { 1,0,0,CONFIG_TYPE_STRING,"extensions",(void*)&config.extensions,config_emit_string }, { 1,0,0,CONFIG_TYPE_STRING,"password",(void*)&config.readpassword, config_emit_string }, @@ -167,6 +168,7 @@ int config_read(char *file) { config.runas=NULL; config.artfilename=NULL; config.logfile=NULL; + config.rescan_interval=0; /* DWB: use alloced space so it can be freed without errors */ config.extensions=strdup(".mp3"); @@ -309,6 +311,7 @@ int config_write(WS_CONNINFO *pwsc) { fprintf(configfile,"password\t%s\n",ws_getvar(pwsc,"password")); fprintf(configfile,"extensions\t%s\n",ws_getvar(pwsc,"extensions")); fprintf(configfile,"db_dir\t\t%s\n",ws_getvar(pwsc,"db_dir")); + fprintf(configfile,"rescan_interval\t%s\n",ws_getvar(pwsc,"rescan_interval")); fclose(configfile); return 0; @@ -444,6 +447,9 @@ void config_handler(WS_CONNINFO *pwsc) { if (strcasecmp(pw,"stopdaap")==0) { config.stop=1; } + if (strcasecmp(pw,"rescan")==0) { + config.reload=1; + } } else { /* we need to update stuff */ pw=ws_getvar(pwsc,"admin_pw"); @@ -460,6 +466,11 @@ void config_handler(WS_CONNINFO *pwsc) { config.readpassword=strdup(pw); } + pw=ws_getvar(pwsc,"rescan_interval"); + if(pw) { + config.rescan_interval=atoi(pw); + } + if(!config_file_is_readonly()) { DPRINTF(ERR_INFO,"Updating config file\n"); config_write(pwsc); @@ -528,6 +539,7 @@ void config_emit_service_status(WS_CONNINFO *pwsc, void *value, char *arg) { char *html; char buf[256]; int r_days, r_hours, r_mins, r_secs; + int scanning; ws_writefd(pwsc,"
Service | "); ws_writefd(pwsc,"Status | Control | %s | %s | \n",mdns_running ? "Running":"Stopped", @@ -552,7 +564,15 @@ void config_emit_service_status(WS_CONNINFO *pwsc, void *value, char *arg) { if(config.stop) { ws_writefd(pwsc,"Wait... | \n"); } else { - ws_writefd(pwsc,"Stop DAAP Server"); + ws_writefd(pwsc," | Stop DAAP Server | "); + } + + scanning = db_scanning(); + ws_writefd(pwsc,"
---|---|---|
Background scanner | %s | ",scanning ? "Running":"Idle"); + if(scanning) { + ws_writefd(pwsc,"Wait... | Start Scan | "); } ws_writefd(pwsc,"