mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-06 03:50:06 +02:00
Merge branch '573-subsonic-type' into 'develop'
Fix #573: Added "type: funkwhale" and "funkwhale-version" in Subsonic responses Closes #573 See merge request funkwhale/funkwhale!456
This commit is contained in:
commit
6c7ee54dbc
4 changed files with 28 additions and 3 deletions
|
@ -2,13 +2,22 @@ import xml.etree.ElementTree as ET
|
|||
|
||||
from rest_framework import renderers
|
||||
|
||||
import funkwhale_api
|
||||
|
||||
|
||||
class SubsonicJSONRenderer(renderers.JSONRenderer):
|
||||
def render(self, data, accepted_media_type=None, renderer_context=None):
|
||||
if not data:
|
||||
# when stream view is called, we don't have any data
|
||||
return super().render(data, accepted_media_type, renderer_context)
|
||||
final = {"subsonic-response": {"status": "ok", "version": "1.16.0"}}
|
||||
final = {
|
||||
"subsonic-response": {
|
||||
"status": "ok",
|
||||
"version": "1.16.0",
|
||||
"type": "funkwhale",
|
||||
"funkwhale-version": funkwhale_api.__version__,
|
||||
}
|
||||
}
|
||||
final["subsonic-response"].update(data)
|
||||
if "error" in final:
|
||||
# an error was returned
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue