mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 10:51:36 -04:00
Download info a set in create_downloads.
This commit is contained in:
parent
8778d53fa1
commit
4a169ba43c
3 changed files with 15 additions and 6 deletions
|
|
@ -15,6 +15,9 @@ logger = logger.getChild(__name__)
|
|||
class ArchiveDownloader(Downloader, ABC):
|
||||
name = 'archive'
|
||||
|
||||
def __repr__(self):
|
||||
return f'<ArchiveDownloader name={self.name}>'
|
||||
|
||||
@classmethod
|
||||
def valid_url(cls, url: str) -> Tuple[bool, None]:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ class ChannelDownloader(Downloader, ABC):
|
|||
"""
|
||||
name = 'video_channel'
|
||||
|
||||
def __repr__(self):
|
||||
return f'<ChannelDownloader name={self.name}>'
|
||||
|
||||
@classmethod
|
||||
def valid_url(cls, url) -> Tuple[bool, None]:
|
||||
for ie in ChannelIEs:
|
||||
|
|
@ -93,6 +96,9 @@ class VideoDownloader(Downloader, ABC):
|
|||
"""
|
||||
name = 'video'
|
||||
|
||||
def __repr__(self):
|
||||
return f'<VideoDownloader name={self.name}>'
|
||||
|
||||
@classmethod
|
||||
def valid_url(cls, url) -> Tuple[bool, Optional[dict]]:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -294,15 +294,14 @@ class DownloadManager:
|
|||
|
||||
downloads = []
|
||||
|
||||
# Verify that all URLs can be downloaded.
|
||||
for url in urls:
|
||||
self.get_downloader(url)
|
||||
|
||||
with session.transaction:
|
||||
for url in urls:
|
||||
downloader, info_json = self.get_downloader(url)
|
||||
download = self.get_or_create_download(url, session)
|
||||
# Download may have failed, try again.
|
||||
download.renew(reset_attempts=reset_attempts)
|
||||
download.downloader = downloader.name
|
||||
download.info_json = info_json
|
||||
downloads.append(download)
|
||||
|
||||
if skip_download is True:
|
||||
|
|
@ -332,9 +331,10 @@ class DownloadManager:
|
|||
url = download.url
|
||||
|
||||
downloader = self.get_downloader_by_name(download.downloader)
|
||||
if not downloader:
|
||||
downloader, _ = self.get_downloader(download.url)
|
||||
if not downloader or not download.info_json:
|
||||
downloader, info_json = self.get_downloader(download.url)
|
||||
download.downloader = downloader.name
|
||||
download.info_json = info_json
|
||||
downloader.clear()
|
||||
|
||||
download.started()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue