Merge branch '867-subsonic-default-transcoding-again' into 'master'
Resolve "Provide a default format when transcoding via Subsonic" See merge request funkwhale/funkwhale!819
This commit is contained in:
commit
be561c0ca0
|
@ -256,7 +256,7 @@ class SubsonicViewSet(viewsets.GenericViewSet):
|
||||||
if max_bitrate:
|
if max_bitrate:
|
||||||
max_bitrate = max_bitrate * 1000
|
max_bitrate = max_bitrate * 1000
|
||||||
|
|
||||||
format = data.get("format", "raw") or None
|
format = data.get("format") or None
|
||||||
if max_bitrate and not format:
|
if max_bitrate and not format:
|
||||||
# specific bitrate requested, but no format specified
|
# specific bitrate requested, but no format specified
|
||||||
# so we use a default one, cf #867. This helps with clients
|
# so we use a default one, cf #867. This helps with clients
|
||||||
|
|
|
@ -288,15 +288,16 @@ def test_stream_transcode(
|
||||||
mocker,
|
mocker,
|
||||||
settings,
|
settings,
|
||||||
):
|
):
|
||||||
|
upload = factories["music.Upload"](playable=True)
|
||||||
|
params = {"id": upload.track.pk, "maxBitRate": max_bitrate}
|
||||||
|
if format:
|
||||||
|
params["format"] = format
|
||||||
settings.SUBSONIC_DEFAULT_TRANSCODING_FORMAT = default_transcoding_format
|
settings.SUBSONIC_DEFAULT_TRANSCODING_FORMAT = default_transcoding_format
|
||||||
url = reverse("api:subsonic-stream")
|
url = reverse("api:subsonic-stream")
|
||||||
mocked_serve = mocker.patch.object(
|
mocked_serve = mocker.patch.object(
|
||||||
music_views, "handle_serve", return_value=Response()
|
music_views, "handle_serve", return_value=Response()
|
||||||
)
|
)
|
||||||
upload = factories["music.Upload"](playable=True)
|
response = logged_in_api_client.get(url, params)
|
||||||
response = logged_in_api_client.get(
|
|
||||||
url, {"id": upload.track.pk, "maxBitRate": max_bitrate, "format": format}
|
|
||||||
)
|
|
||||||
|
|
||||||
mocked_serve.assert_called_once_with(
|
mocked_serve.assert_called_once_with(
|
||||||
upload=upload,
|
upload=upload,
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fixed remaining transcoding issue with Subsonic API (#867)
|
Loading…
Reference in New Issue