Fix downloading
This commit is contained in:
parent
69ef01d05f
commit
3d461850f7
22
scdl/scdl.py
22
scdl/scdl.py
@ -574,17 +574,25 @@ def download_hls(client: SoundCloud, track: BasicTrack, title: str, playlist_inf
|
|||||||
|
|
||||||
logger.debug(f"Trancodings: {track.media.transcodings}")
|
logger.debug(f"Trancodings: {track.media.transcodings}")
|
||||||
|
|
||||||
transcodings = {t.preset: t for t in track.media.transcodings if t.format.protocol == "hls"}
|
aac_transcoding = None
|
||||||
transcoding = None
|
mp3_transcoding = None
|
||||||
|
|
||||||
|
for t in track.media.transcodings:
|
||||||
|
if t.format.protocol == "hls" and "aac" in t.preset:
|
||||||
|
aac_transcoding = t
|
||||||
|
elif t.format.protocol == "hls" and "mp3" in t.preset:
|
||||||
|
mp3_transcoding = t
|
||||||
|
|
||||||
aac = False
|
aac = False
|
||||||
if not kwargs.get("onlymp3") and "aac_hq" in transcodings:
|
transcoding = None
|
||||||
transcoding = transcodings["aac_hq"]
|
if not kwargs.get("onlymp3") and aac_transcoding:
|
||||||
|
transcoding = aac_transcoding
|
||||||
aac = True
|
aac = True
|
||||||
elif "mp3_0_0" in transcodings:
|
elif mp3_transcoding:
|
||||||
transcoding = transcodings["mp3_0_0"]
|
transcoding = mp3_transcoding
|
||||||
|
|
||||||
if not transcoding:
|
if not transcoding:
|
||||||
raise SoundCloudException(f"Could not find mp3_0_0 or aac_hq transcoding. Available transcodings: {list(transcodings)}")
|
raise SoundCloudException(f"Could not find mp3 or aac transcoding. Available transcodings: {[t.preset for t in track.media.transcodings if t.format.protocol == 'hls']}")
|
||||||
|
|
||||||
filename = get_filename(track, None, aac, playlist_info, **kwargs)
|
filename = get_filename(track, None, aac, playlist_info, **kwargs)
|
||||||
logger.debug(f"filename : {filename}")
|
logger.debug(f"filename : {filename}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user