maloja: fix submission of artist names
Payload must be submitted as JSON and artist must be an array Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2328>
This commit is contained in:
parent
097f803fab
commit
7da78afa43
|
@ -22,7 +22,7 @@ def submit_listen(listening, conf, **kwargs):
|
|||
logger.debug("Majola payload: %r", payload)
|
||||
url = server_url.rstrip("/") + "/apis/mlj_1/newscrobble"
|
||||
session = plugins.get_session()
|
||||
response = session.post(url, payload)
|
||||
response = session.post(url, json=payload)
|
||||
response.raise_for_status()
|
||||
details = json.loads(response.text)
|
||||
if details["status"] == "success":
|
||||
|
@ -35,12 +35,13 @@ def get_payload(listening, api_key):
|
|||
track = listening.track
|
||||
payload = {
|
||||
"key": api_key,
|
||||
"artists": track.artist.name,
|
||||
"artists": [track.artist.name],
|
||||
"title": track.title,
|
||||
"time": int(listening.creation_date.timestamp()),
|
||||
}
|
||||
|
||||
if track.album:
|
||||
if track.album.title:
|
||||
payload["album"] = track.album.title
|
||||
|
||||
return payload
|
||||
|
|
|
@ -5,7 +5,7 @@ PLUGIN = plugins.get_plugin_config(
|
|||
label="Maloja",
|
||||
description="A plugin that allows you to submit your listens to your Maloja server.",
|
||||
homepage="https://docs.funkwhale.audio/users/builtinplugins.html#maloja-plugin",
|
||||
version="0.1",
|
||||
version="0.1.1",
|
||||
user=True,
|
||||
conf=[
|
||||
{"name": "server_url", "type": "text", "label": "Maloja server URL"},
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix artist name submission in Maloja plugin
|
Loading…
Reference in New Issue