def __init__(self, database, candidates, output, filter_type='all', categorize=False, nsfw=False): """ The PluginInterface takes care of reading the plugins, determining which ones are valid, and iterating through them. It is a wrapper around the plugins that makes sure that they are valid subclasses of the BasePlugin class. :param str database: the prefix for the database filename. :param list candidates: a list of candidate json objects from the `class` RedditConnect class :param str output: the location on disk to store your images (note that this can be changed and the database data will handle all duplicate filtering """ self.database = database self.candidates = candidates self.output = output self.type = filter_type self.categorize = categorize self.nsfw = nsfw if self.nsfw: nsfw_flag = 'enabled' else: nsfw_flag = 'disabled' print '\nFetching NSFW Images is %s.\n' % nsfw_flag self.config = get_config() #set up some class variables self.handled_posts = {} self.unhandled_posts = set() self.image_urls_already_fetched = None self.candidates_backup = CandidatesList(set())
def setUp(self): self.base_plugin = BasePlugin(None, [], None, None, get_config(), False, True) self.base_plugin.resp = requests.Response()