Fix a failed download leaving temp file.

This commit is contained in:
Matthew Stratford 2021-09-25 19:26:37 +01:00
parent 1b6b3aa9c8
commit 49590dcc6c

View file

@ -276,6 +276,8 @@ class MyRadioAPI:
request = await self.async_api_call(url, api_version="non") request = await self.async_api_call(url, api_version="non")
if not request or not isinstance(request, (bytes, bytearray)): if not request or not isinstance(request, (bytes, bytearray)):
# Remove the .downloading temp file given we gave up trying to download.
os.remove(filename + dl_suffix)
return (None, False) if did_download else None return (None, False) if did_download else None
try: try: