Fix to=None in listen url

This commit is contained in:
localhost_frssoft 2022-12-20 04:05:54 +03:00
parent 86bbdcf0ea
commit 348c80973b

View file

@ -74,17 +74,17 @@ def get_instance_settings():
@logger.catch @logger.catch
def get_audio_file(track_uuid, listen_url=False, download=False, def get_audio_file(track_uuid, listen_url=False, download=False,
transcoding=get_config('enable_server_transcoding'), to='ogg'): transcoding=get_config('enable_server_transcoding'), to='ogg'):
if not transcoding:
to = None
params = { params = {
"download": download, "download": download,
"to": to "to": to
} }
if not transcoding:
del params['to']
if listen_url: if listen_url:
url = f'https://{current_instance.instance}{track_uuid}?' url = f'https://{current_instance.instance}{track_uuid}?'
else: else:
url = f'https://{current_instance.instance}/api/v1/listen/{track_uuid}?' url = f'https://{current_instance.instance}/api/v1/listen/{track_uuid}?'
return url + urllib.parse.urlencode(params) return url + urllib.parse.urlencode(params, doseq=True)
@logger.catch @logger.catch