def enable(self, config=None): self.log = yarss2.util.logger.Logger() self.torrent_handler = TorrentHandler(self.log) if config is None: self.yarss_config = YARSSConfig(self.log) else: self.yarss_config = config self.rssfeed_scheduler = RSSFeedScheduler(self.yarss_config, self.log) self.rssfeed_scheduler.enable_timers() self.log.info("Enabled YaRSS2 %s" % yarss2.util.common.get_version())
def setUp(self): # NOQA self.rssfeeds = test_common.get_default_rssfeeds(5) self.rssfeeds["0"]["update_interval"] = 1 self.rssfeeds["1"]["update_interval"] = 3 self.rssfeeds["2"]["update_interval"] = 10 self.rssfeeds["3"]["update_interval"] = 30 self.rssfeeds["4"]["update_interval"] = 120 self.config = test_common.get_test_config() self.config.set_config({ "rssfeeds": self.rssfeeds, "email_configurations": { "send_email_on_torrent_events": False } }) self.scheduler = RSSFeedScheduler(self.config, log) test_component = TestComponent() self.scheduler.torrent_handler.download_torrent_file = test_component.download_torrent_file self.scheduler.enable_timers()