diff options
author | 2009-10-10 17:14:17 +0200 | |
---|---|---|
committer | 2009-10-10 17:14:17 +0200 | |
commit | 754ff9123ec9e2dd317351cd7c631ffa9f76b343 (patch) | |
tree | 8f375f7134b38e01cc0622d0ceb04f080faa18ab /plugins/cdda | |
parent | 7cca327d228d6314e30fc5418cae0b9fbd4691cb (diff) |
ported all custom configs to common config
Diffstat (limited to 'plugins/cdda')
-rw-r--r-- | plugins/cdda/cdda.c | 76 |
1 files changed, 6 insertions, 70 deletions
diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c index 576d1cbf..0d85e0b7 100644 --- a/plugins/cdda/cdda.c +++ b/plugins/cdda/cdda.c @@ -76,76 +76,12 @@ trim (char* s) static int read_config () { - char param[ 256 ]; - char config[1024]; - char *key, *value; - snprintf (config, 1024, "%s/cdaudio", deadbeef->get_config_dir()); - - FILE *cfg_file = fopen (config, "rt"); - if (!cfg_file) { - trace ("cdaudio: failed open %s\n", config); - return -1; - } - - while ( fgets( param, sizeof(param), cfg_file ) ) - { - param[ strlen( param )-1 ] = 0; //terminating \n - if (param[0] == '#' || param[0] == 0) - continue; - - char *colon = strchr (param, ':'); - if (!colon) - { - trace ("cdaudio: malformed config string: %s\n", param); - continue; - } - *(colon++) = 0; - key = trim (param); - value = trim (colon + 1); - - if (0 == strcmp (key, "cddb")) - { - if (0 == strcmp (value, "on")) - use_cddb = 1; - else if (0 == strcmp (value, "off")) - use_cddb = 0; - else - { - use_cddb = 0; - trace ("cdaudio: warning, wrong value %s\n", value); - } - } - else if (0 == strcmp (key, "cddb_server")) - { - server[0] = 0; - strncat (server, value, sizeof (server)); - } - else if (0 == strcmp (key, "cddb_port")) - { - port = atoi (value); - } - else if (0 == strcmp (key, "cddb_proxy")) - { - proxy[0] = 0; - strncat (proxy, value, sizeof (server)); - } - else if (0 == strcmp (key, "cddb_proxy_port")) - { - proxy_port = atoi (value); - } - else if (0 == strcmp (key, "proto")) - { - if (0 == strcmp (value, "cddb")) - proto_cddb = 1; - else if (0 == strcmp (value, "http")) - proto_cddb = 0; - else - trace ("cdaudio: unknown protocol \"%s\"\n", value); - } - else - trace ("cdaudio: warning, unknown option %s\n", key); - } - fclose (cfg_file); + use_cddb = deadbeef->conf_get_int ("cdda.freedb.enable", 1); + strncpy (server, deadbeef->conf_get_str ("cdda.freedb.host", "freedb.org"), sizeof (server)-1); + port = deadbeef->conf_get_int ("cdda.freedb.port", 888); + strncpy (proxy, deadbeef->conf_get_str ("cdda.freedb.proxy", ""), sizeof (proxy)-1); + proxy_port = deadbeef->conf_get_int ("cdda.freedb.proxy_port", 8080); + proto_cddb = deadbeef->conf_get_int ("cdda.protocol", 1); // 1 is cddb, 0 is http } static int |