summaryrefslogtreecommitdiff
path: root/plugins/lastfm
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-10-10 17:14:17 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-10-10 17:14:17 +0200
commit754ff9123ec9e2dd317351cd7c631ffa9f76b343 (patch)
tree8f375f7134b38e01cc0622d0ceb04f080faa18ab /plugins/lastfm
parent7cca327d228d6314e30fc5418cae0b9fbd4691cb (diff)
ported all custom configs to common config
Diffstat (limited to 'plugins/lastfm')
-rw-r--r--plugins/lastfm/lastfm.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c
index 77ae5657..bd4577c9 100644
--- a/plugins/lastfm/lastfm.c
+++ b/plugins/lastfm/lastfm.c
@@ -705,8 +705,6 @@ lastfm_start (void) {
// subscribe to frameupdate event
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGSTARTED, DB_CALLBACK (lastfm_songstarted), 0);
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGFINISHED, DB_CALLBACK (lastfm_songfinished), 0);
- // load login/pass
- char config[1024];
// {{{ lastfm v2 auth
#if 0
@@ -725,41 +723,9 @@ lastfm_start (void) {
#endif
// }}}
- snprintf (config, 1024, "%s/lastfm", deadbeef->get_config_dir ());
- FILE *fp = fopen (config, "rt");
- if (!fp) {
- trace ("lastfm: failed open %s\n", config);
- return -1;
- }
- if (!fgets (lfm_user, 50, fp)) {
- trace ("lastfm: failed to read login from %s\n", config);
- fclose (fp);
- return -1;
- }
- if (!fgets (lfm_pass, 50, fp)) {
- trace ("lastfm: failed to read pass from %s\n", config);
- fclose (fp);
- return -1;
- }
- fclose (fp);
- // remove trailing garbage
- int l;
- char *p;
- l = strlen (lfm_user);
- p = lfm_user+l-1;
- while (p >= lfm_user && *p < 0x20) {
- p--;
- }
- p++;
- *p = 0;
- l = strlen (lfm_pass);
- p = lfm_pass+l-1;
- while (p >= lfm_pass && *p < 0x20) {
- p--;
- }
- p++;
- *p = 0;
-
+ // load login/pass
+ strcpy (lfm_user, deadbeef->conf_get_str ("lastfm.login", ""));
+ strcpy (lfm_pass, deadbeef->conf_get_str ("lastfm.password", ""));
return 0;
}