Make downloadfilter apply itself to Resources

This commit is contained in:
Serene-Arc
2021-05-03 13:57:06 +10:00
committed by Serene
parent 711f8b0c76
commit eda12e5274
4 changed files with 30 additions and 15 deletions

View File

@@ -394,9 +394,6 @@ class RedditDownloader:
if not isinstance(submission, praw.models.Submission):
logger.warning(f'{submission.id} is not a submission')
return
if not self.download_filter.check_url(submission.url):
logger.debug(f'Download filter removed submission {submission.id} with URL {submission.url}')
return
try:
downloader_class = DownloadFactory.pull_lever(submission.url)
downloader = downloader_class(submission)
@@ -413,6 +410,8 @@ class RedditDownloader:
for destination, res in self.file_name_formatter.format_resource_paths(content, self.download_directory):
if destination.exists():
logger.debug(f'File {destination} already exists, continuing')
elif not self.download_filter.check_resource(res):
logger.debug(f'Download filter removed {submission.id} with URL {submission.url}')
else:
try:
res.download(self.args.max_wait_time)