[lastfm/jsonapi/ws/main] New JSON-API-endpoints for Last.fm integration

In preparation for the new endpoints the following refactorings where
done in lastfm.c:
- Initialize lastfm.c in main.c instead of on first scrobble attempt
(necessary to retrieve the correct lastfm status)
- Return error messages if login attempt failed
- Add api function for status and logout
- Notify about Last.fm status changes

Unrelated changes in lastfm.c are:
- Refactoring of request_post
- Add request parameters sorted alphabetically and remove calling the
sort method in request_post
This commit is contained in:
chme
2017-09-24 06:57:49 +02:00
parent b64d282f32
commit f82b22042f
6 changed files with 275 additions and 66 deletions

View File

@@ -70,6 +70,9 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
#include "player.h"
#include "worker.h"
#include "library.h"
#ifdef LASTFM
# include "lastfm.h"
#endif
#ifdef HAVE_LIBCURL
# include <curl/curl.h>
@@ -784,6 +787,10 @@ main(int argc, char **argv)
mdns_no_mpd = 1;
#endif
#ifdef LASTFM
lastfm_init();
#endif
/* Start Remote pairing service */
ret = remote_pairing_init();
if (ret != 0)