Do not attempt to download episodes without an URL.

This commit is contained in:
auouymous 2021-03-28 05:54:16 -06:00
parent 09f7dd4d5e
commit 1c0bf62afd
1 changed files with 9 additions and 0 deletions

View File

@ -188,6 +188,9 @@ class ContentRange(object):
class DownloadCancelledException(Exception): pass
class DownloadNoURLException(Exception): pass
class gPodderDownloadHTTPError(Exception):
def __init__(self, url, error_code, error_message):
self.url = url
@ -777,6 +780,9 @@ class DownloadTask(object):
url = self.__episode.url
try:
if url == '':
raise DownloadNoURLException()
if self.downloader:
downloader = self.downloader.custom_downloader(self._config, self.episode)
else:
@ -853,6 +859,9 @@ class DownloadTask(object):
util.delete_file(self.tempname)
self.progress = 0.0
self.speed = 0.0
except DownloadNoURLException:
self.status = DownloadTask.FAILED
self.error_message = _('Episode has no URL to download')
except urllib.error.ContentTooShortError as ctse:
self.status = DownloadTask.FAILED
self.error_message = _('Missing content from server')