Fix overhead get listen_url tracks...

This commit is contained in:
localhost_frssoft 2022-11-21 01:49:19 +03:00
parent d56630b71e
commit de915144b2

View file

@ -1,5 +1,6 @@
from src.mpv_control import set_http_header
import requests, json, time
import urllib.parse
import os
from loguru import logger
@ -67,10 +68,10 @@ def get_audio_file(track_uuid, listen_url=False, download=False, transcoding=Fal
"to": to
}
if listen_url:
r = s.head(f'https://{instance}{track_uuid}', params=params)
url = f'https://{instance}{track_uuid}?'
else:
r = s.head(f'https://{instance}/api/v1/listen/{track_uuid}', params=params)
return r.url
url = f'https://{instance}/api/v1/listen/{track_uuid}?'
return url + urllib.parse.urlencode(params)
@logger.catch