fix 'whitelist' option for BaseExtractor instances

pull/1331/head
Mike Fährmann 4 years ago
parent fbfcbcbf57
commit 65ca923b4e
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2019-2020 Mike Fährmann
# Copyright 2019-2021 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@ -24,6 +24,7 @@ class ReactorExtractor(Extractor):
basecategory = "reactor"
filename_fmt = "{post_id}_{num:>02}{title[:100]:?_//}.{extension}"
archive_fmt = "{post_id}_{num}"
instances = ()
def __init__(self, match):
Extractor.__init__(self, match)

@ -10,6 +10,7 @@ import sys
import time
import errno
import logging
import operator
import collections
from . import extractor, downloader, postprocessor
from . import config, text, util, output, exception
@ -440,7 +441,21 @@ class DownloadJob(Job):
if wlist is not None:
if isinstance(wlist, str):
wlist = wlist.split(",")
blist = {e.category for e in extractor._list_classes()}
# build a set of all categories
blist = set()
add = blist.add
update = blist.update
get = operator.itemgetter(0)
for extr in extractor._list_classes():
category = extr.category
if category:
add(category)
else:
update(map(get, extr.instances))
# remove whitelisted categories
blist.difference_update(wlist)
return blist

Loading…
Cancel
Save