force section and key names to not have spaces. Fixes problems in the configurator

This commit is contained in:
Ron Pedde 2006-05-29 11:25:09 +00:00
parent 69bb8dba82
commit 920cb31052
2 changed files with 20 additions and 2 deletions

View File

@ -462,6 +462,7 @@ int conf_read(char *file) {
int key_type; int key_type;
char **valuearray; char **valuearray;
int index; int index;
char *temp;
if(conf_main_file) { if(conf_main_file) {
conf_close(); conf_close();
@ -513,6 +514,15 @@ int conf_read(char *file) {
compat_mode=0; compat_mode=0;
term=&linebuffer[1]; term=&linebuffer[1];
value = strchr(term,']'); value = strchr(term,']');
/* convert spaces to underscores in headings */
temp = term;
while(*temp) {
if(*temp == ' ')
*temp = '_';
temp++;
}
if(!value) { if(!value) {
ll_destroy(pllnew); ll_destroy(pllnew);
fclose(fin); fclose(fin);
@ -574,6 +584,14 @@ int conf_read(char *file) {
while((strlen(value) && (strchr("\t ",value[strlen(value)-1])))) while((strlen(value) && (strchr("\t ",value[strlen(value)-1]))))
value[strlen(value)-1] = '\0'; value[strlen(value)-1] = '\0';
/* convert spaces to underscores in key */
temp = term;
while(*temp) {
if(*temp == ' ')
*temp = '_';
temp++;
}
if(!pllcurrent) { if(!pllcurrent) {
/* in compat mode -- add a general section */ /* in compat mode -- add a general section */
if((err=ll_create(&plltemp)) != LL_E_SUCCESS) { if((err=ll_create(&plltemp)) != LL_E_SUCCESS) {

View File

@ -210,7 +210,7 @@ void scan_process_playlistlist(void) {
} }
if(strcasecmp(ext,".xml") == 0) { if(strcasecmp(ext,".xml") == 0) {
if(conf_get_int("scanning","process xml",1)) { if(conf_get_int("scanning","process_xml",1)) {
DPRINTF(E_LOG,L_SCAN,"Scanning %s\n",pnext->path); DPRINTF(E_LOG,L_SCAN,"Scanning %s\n",pnext->path);
scan_xml_playlist(pnext->path); scan_xml_playlist(pnext->path);
} }
@ -772,7 +772,7 @@ void make_composite_tags(MP3FILE *song) {
} }
if(song->compilation && song->artist && song->title && if(song->compilation && song->artist && song->title &&
(conf_get_int("scanning","concat compilations",0))) { (conf_get_int("scanning","concat_compilations",0))) {
len = (int)strlen(song->artist) + len = (int)strlen(song->artist) +
(int)strlen(sep) + (int)strlen(sep) +
(int)strlen(song->title); (int)strlen(song->title);