Subsonic: Actually implement getArtistInfo2 endpoint

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2695>
environments/review-docs-renov-r6aeyi/deployments/19166
Philipp Wolfer 2023-12-30 17:42:16 +01:00 zatwierdzone przez Marge
rodzic 81401075aa
commit 0fab0470c2
3 zmienionych plików z 20 dodań i 2 usunięć

Wyświetl plik

@ -269,7 +269,20 @@ class SubsonicViewSet(viewsets.GenericViewSet):
)
@find_object(music_models.Artist.objects.all(), filter_playable=True)
def get_artist_info2(self, request, *args, **kwargs):
payload = {"artist-info2": {}}
artist = kwargs.pop("obj")
artist_info = {}
if artist.mbid:
artist_info["musicBrainzId"] = [str(artist.mbid)]
if artist.attachment_cover:
artist_info["mediumImageUrl"] = [
artist.attachment_cover.download_url_medium_square_crop
]
artist_info["largeImageUrl"] = [
artist.attachment_cover.download_url_large_square_crop
]
if artist.description:
artist_info["biography"] = [artist.description.rendered]
payload = {"artistInfo2": artist_info}
return response.Response(payload, status=200)

Wyświetl plik

@ -166,7 +166,11 @@ def test_get_artist_info2(
artist = factories["music.Artist"](playable=True)
playable_by = mocker.spy(music_models.ArtistQuerySet, "playable_by")
expected = {"artist-info2": {}}
expected = {
"artistInfo2": {
"musicBrainzId": [artist.mbid],
}
}
response = logged_in_api_client.get(url, {"id": artist.pk})
assert response.status_code == 200

Wyświetl plik

@ -0,0 +1 @@
Implement Subsonic getArtistInfo2 response