Fix scrobble functions and set values correctly
FossilOrigin-Name: bcf4568212e9d4ced1a597444d19b1b196778a0d9641989f351b7b260d45f951
This commit is contained in:
parent
c2535042d1
commit
600dca63b6
3 changed files with 17 additions and 14 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <mastodont_relationship.h>
|
||||
#include <mastodont_account.h>
|
||||
#include <mastodont_attachment.h>
|
||||
#include <mastodont_scrobbles.h>
|
||||
|
||||
/* Functions required form curl */
|
||||
void mastodont_global_curl_init();
|
||||
|
|
|
@ -58,8 +58,10 @@ int mstdnt_scrobbles_result(struct mstdnt_fetch_results* results,
|
|||
struct mstdnt_scrobble* scrobbles[],
|
||||
size_t* size);
|
||||
|
||||
int _mstdnt_scrobbles_from_result_callback(struct mstdnt_fetch_results* results,
|
||||
struct mstdnt_storage* storage,
|
||||
void* arg);
|
||||
int _mstdnt_scrobbles_result_callback(struct mstdnt_fetch_results* results,
|
||||
struct mstdnt_storage* storage,
|
||||
void* arg);
|
||||
|
||||
int mstdnt_scrobble_json(struct mstdnt_scrobble* scrobble, cJSON* js);
|
||||
|
||||
#endif /* MASTODONT_SCROBBLES_H */
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <mastodont_query.h>
|
||||
#include <mastodont_request.h>
|
||||
|
||||
int mstdnt_scrobble_from_json(struct mstdnt_scrobble* scrobble, cJSON* js)
|
||||
int mstdnt_scrobble_json(struct mstdnt_scrobble* scrobble, cJSON* js)
|
||||
{
|
||||
cJSON* v;
|
||||
|
||||
|
@ -29,12 +29,12 @@ int mstdnt_scrobble_from_json(struct mstdnt_scrobble* scrobble, cJSON* js)
|
|||
|
||||
struct _mstdnt_val_ref vals[] = {
|
||||
{ "account", &(scrobble->account), _mstdnt_val_account_call },
|
||||
{ "album", &(scrobble->id), _mstdnt_val_string_call },
|
||||
{ "artist", &(scrobble->id), _mstdnt_val_string_call },
|
||||
{ "created_at", &(scrobble->id), _mstdnt_val_string_call },
|
||||
{ "album", &(scrobble->album), _mstdnt_val_string_call },
|
||||
{ "artist", &(scrobble->artist), _mstdnt_val_string_call },
|
||||
{ "created_at", &(scrobble->created_at), _mstdnt_val_string_call },
|
||||
{ "id", &(scrobble->id), _mstdnt_val_string_call },
|
||||
{ "length", &(scrobble->id), _mstdnt_val_uint_call },
|
||||
{ "title", &(scrobble->id), _mstdnt_val_string_call }
|
||||
{ "length", &(scrobble->length), _mstdnt_val_uint_call },
|
||||
{ "title", &(scrobble->title), _mstdnt_val_string_call }
|
||||
};
|
||||
|
||||
for (v = js; v; v = v->next)
|
||||
|
@ -75,12 +75,12 @@ int mstdnt_scrobbles_result(struct mstdnt_fetch_results* results,
|
|||
}
|
||||
|
||||
|
||||
int _mstdnt_scrobbles_from_result_callback(struct mstdnt_fetch_results* results,
|
||||
struct mstdnt_storage* storage,
|
||||
void* _args)
|
||||
int _mstdnt_scrobbles_result_callback(struct mstdnt_fetch_results* results,
|
||||
struct mstdnt_storage* storage,
|
||||
void* _args)
|
||||
{
|
||||
struct _mstdnt_scrobbles_cb_args* args = _args;
|
||||
return mstdnt_scrobbles_from_result(results, storage, args->scrobbles, args->size);
|
||||
return mstdnt_scrobbles_result(results, storage, args->scrobbles, args->size);
|
||||
}
|
||||
|
||||
int mastodont_get_scrobbles(mastodont_t* data,
|
||||
|
@ -117,7 +117,7 @@ int mastodont_get_scrobbles(mastodont_t* data,
|
|||
NULL, 0,
|
||||
CURLOPT_HTTPGET,
|
||||
&cb_args,
|
||||
_mstdnt_scrobbles_from_result_callback
|
||||
_mstdnt_scrobbles_result_callback
|
||||
};
|
||||
|
||||
return mastodont_request(data, &req_args);
|
||||
|
|
Loading…
Reference in a new issue