Skip to content

Commit ac220da

Browse files
committed
scrobble: add 'on' parameter to ws_love()
Signed-off-by: Felipe Contreras <[email protected]>
1 parent 24e662f commit ac220da

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scrobble.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct sr_session_priv {
4444

4545
static void now_playing(sr_session_t *s, sr_track_t *t);
4646
static void ws_auth(sr_session_t *s);
47-
static void ws_love(sr_session_t *s);
47+
static void ws_love(sr_session_t *s, bool on);
4848

4949
sr_session_t *
5050
sr_session_new(const char *url,
@@ -190,7 +190,7 @@ check_last(sr_session_t *s,
190190
g_queue_push_tail(priv->love_queue, sr_track_dup(c));
191191
g_mutex_unlock(priv->love_queue_mutex);
192192
if (!priv->api_problems)
193-
ws_love(s);
193+
ws_love(s, true);
194194
}
195195

196196
playtime = timestamp - c->timestamp;
@@ -505,7 +505,7 @@ sr_session_handshake(sr_session_t *s)
505505
if (!priv->session_key)
506506
ws_auth(s);
507507
else
508-
ws_love(s);
508+
ws_love(s, true);
509509
}
510510
}
511511

@@ -942,11 +942,11 @@ ws_love_cb(SoupSession *session,
942942

943943
if (!g_queue_is_empty(priv->love_queue))
944944
/* still need to submit more */
945-
ws_love(s);
945+
ws_love(s, true);
946946
}
947947

948948
static void
949-
ws_love(sr_session_t *s)
949+
ws_love(sr_session_t *s, bool on)
950950
{
951951
struct sr_session_priv *priv = s->priv;
952952
SoupMessage *message;
@@ -961,7 +961,7 @@ ws_love(sr_session_t *s)
961961
return;
962962

963963
ws_params(s, &params,
964-
"method", "track.love",
964+
"method", on ? "track.love" : "track.unlove",
965965
"api_key", priv->api_key,
966966
"sk", priv->session_key,
967967
"track", t->title,
@@ -1007,5 +1007,5 @@ sr_session_love(sr_session_t *s, const char *artist, const char *title, int on)
10071007
g_mutex_unlock(priv->love_queue_mutex);
10081008

10091009
if (!priv->api_problems)
1010-
ws_love(s);
1010+
ws_love(s, on);
10111011
}

0 commit comments

Comments
 (0)