mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 20:51:55 +02:00
Fix #867: Added a SUBSONIC_DEFAULT_TRANSCODING_FORMAT env var to support clients that don't provide the format parameter
This commit is contained in:
parent
31478ea605
commit
bfff79301d
4 changed files with 44 additions and 9 deletions
|
@ -247,10 +247,6 @@ class SubsonicViewSet(viewsets.GenericViewSet):
|
|||
if not upload:
|
||||
return response.Response(status=404)
|
||||
|
||||
format = data.get("format", "raw")
|
||||
if format == "raw":
|
||||
format = None
|
||||
|
||||
max_bitrate = data.get("maxBitRate")
|
||||
try:
|
||||
max_bitrate = min(max(int(max_bitrate), 0), 320) or None
|
||||
|
@ -259,6 +255,16 @@ class SubsonicViewSet(viewsets.GenericViewSet):
|
|||
|
||||
if max_bitrate:
|
||||
max_bitrate = max_bitrate * 1000
|
||||
|
||||
format = data.get("format", "raw") or None
|
||||
if max_bitrate and not format:
|
||||
# specific bitrate requested, but no format specified
|
||||
# so we use a default one, cf #867. This helps with clients
|
||||
# that don't send the format parameter, such as DSub.
|
||||
format = settings.SUBSONIC_DEFAULT_TRANSCODING_FORMAT
|
||||
elif format == "raw":
|
||||
format = None
|
||||
|
||||
return music_views.handle_serve(
|
||||
upload=upload,
|
||||
user=request.user,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue