def fill_queue_from_rss(self): logger.info(lambda: "Filling APOD queue from RSS") s = self.fetch(self.location, xml=True) urls = [_str(x.find("link").contents[0]) for x in s.findAll("item")] urls = [x for x in urls if x not in self.parent.banned] self.queue.extend(urls) logger.info(lambda: "APOD queue populated with %d URLs" % len(self.queue))
def fix_outdated(self, config): changed = False for key, outdated_hashes in Options.OUTDATED_HASHES.items(): if key in config: current_hash = hashlib.md5(_str(config[key])).hexdigest() if current_hash in outdated_hashes: # entry is outdated: delete it and use the default logger.warning(lambda: "Option " + key + " has an outdated value, using the new default") changed = True del config[key] return changed
def fix_outdated(self, config): changed = False for key, outdated_hashes in Options.OUTDATED_HASHES.items(): if key in config: current_hash = hashlib.md5(_str(config[key])).hexdigest() if current_hash in outdated_hashes: # entry is outdated: delete it and use the default logger.warning( lambda: "Option " + key + " has an outdated value, using the new default") changed = True del config[key] return changed
def superuser_exec(*command_args): logger.warning(lambda: "Executing as superuser: %s" % _str(command_args)) subprocess.check_call(["pkexec"] + list(command_args))