def do(self): for entity in self.entity_list: # Check if blacklisted. If yes, skip to next paper blacklist = Blacklist(entity['unique_id']) if blacklist.is_blacklisted(): logger.debug("Found in blacklisted ones") continue self.desc = entity['desc'] self.name = entity['name'] self._file_path = self._dir_path.joinpath('{}.jpg'.format( entity['unique_id'])) logger.info("{} by {}".format(self.desc, self.name)) if not self._is_exists(): self._dw(entity['dw_link']) self._set() # Interaction ask = input("Save this wallpapers? [Y]es [N]o [E]xit ") if ask.lower() == 'y': # Adding to blacklist is imp so that it doesn't pop up again. self._blacklist(blacklist, silent=True) self._set_perma() exit() elif ask.lower() == 'e': remove(self._file_path) self._blacklist(blacklist) self._restore() exit() elif ask.lower() == 'n': self._blacklist(blacklist) self._restore() remove(self._file_path)
def main(): # Parse the arguments args = parse() if args.clear_cache: clear_cache() exit(0) if args.migrate: migrate_to_new_loc() exit(0) if args.remove_id: blacklist = Blacklist(args.remove_id).remove_blacklist() exit(0) wall = Wall(photo_id=args.id, random=args.random, search=args.search) # Get the wallpaper setter wall_setter = WallSetter(args.setter) setter = wall_setter.get_setter() logger.info("Getting the wallpapers using Unsplash API...") paper_list = wall.get_list() # If the dir is None, update it if args.dir is None: args.dir = "~/.cache/QuickWall" set_paper = SetPaper(paper_list, setter, args.dir, args.disable_blacklist) set_paper.do()
def main(): # Parse the arguments args = parse() if args.list_level: logger.list_available_levels() exit(0) # Update the logger flags, in case those are not the default ones. if args.level.lower != "info": logger.update_level(args.level.upper()) # Log the args passed logger.debug("args passed: ", str(args)) if args.clear_cache: clear_cache() exit(0) if args.migrate: migrate_to_new_loc() exit(0) if args.remove_id: blacklist = Blacklist(args.remove_id).remove_blacklist() exit(0) wall = Wall(photo_id=args.id, random=args.random, search=args.search) # Get the wallpaper setter wall_setter = WallSetter(args.setter, args.set_lockscreen) setter = wall_setter.get_setter() logger.info("Getting the wallpapers using Unsplash API...") paper_list = wall.get_list() # If the dir is None, update it if args.dir is None: args.dir = "~/.cache/QuickWall" set_paper = SetPaper(paper_list, setter, args.dir, args.disable_blacklist, disable_theme=args.disable_theme) set_paper.do()