comparison src/scrobbler/plugin.c @ 3109:5a11abf0075c

scrobbler: add support for custom audioscrobbler servers. (closes #23)
author William Pitcock <nenolod@atheme.org>
date Fri, 01 May 2009 12:28:48 -0500
parents 3134a0987162
children
comparison
equal deleted inserted replaced
3108:9978be206b93 3109:5a11abf0075c
97 track_timeout = 0; 97 track_timeout = 0;
98 } 98 }
99 } 99 }
100 100
101 void start(void) { 101 void start(void) {
102 char *username = NULL, *password = NULL; 102 char *username = NULL, *password = NULL, *sc_url = NULL;
103 char *ge_username = NULL, *ge_password = NULL; 103 char *ge_username = NULL, *ge_password = NULL;
104 mcs_handle_t *cfgfile; 104 mcs_handle_t *cfgfile;
105 sc_going = 1; 105 sc_going = 1;
106 ge_going = 1; 106 ge_going = 1;
107 GError **moo = NULL; 107 GError **moo = NULL;
109 if ((cfgfile = aud_cfg_db_open()) != NULL) { 109 if ((cfgfile = aud_cfg_db_open()) != NULL) {
110 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "username", 110 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "username",
111 &username); 111 &username);
112 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "password", 112 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "password",
113 &password); 113 &password);
114 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "sc_url",
115 &sc_url);
114 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "ge_username", 116 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "ge_username",
115 &ge_username); 117 &ge_username);
116 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "ge_password", 118 aud_cfg_db_get_string(cfgfile, "audioscrobbler", "ge_password",
117 &ge_password); 119 &ge_password);
118 aud_cfg_db_close(cfgfile); 120 aud_cfg_db_close(cfgfile);
124 DEBUG); 126 DEBUG);
125 sc_going = 0; 127 sc_going = 0;
126 } 128 }
127 else 129 else
128 { 130 {
129 sc_init(username, password); 131 sc_init(username, password, sc_url);
130 132
131 g_free(username); 133 g_free(username);
132 g_free(password); 134 g_free(password);
135 g_free(sc_url);
133 } 136 }
134 137
135 if ((!ge_username || !ge_password) || (!*ge_username || !*ge_password)) 138 if ((!ge_username || !ge_password) || (!*ge_username || !*ge_password))
136 { 139 {
137 pdebug("username/password not found - not starting Gerpok support", 140 pdebug("username/password not found - not starting Gerpok support",