def cli(context, **kwargs): """Downloader (not really) for local wallme history""" position = kwargs['position'] year_month = kwargs['year_month'] position_text = 'random' if position is None else position click.echo("setting {} image from local history".format(position_text)) content = LocalNonDownloader.download(year_month, position) context.obj['no_log'] = True set_wallpaper(content, context)
def cli(cli_ctx, **kwargs): """Downloader for image of the day of nationalgeographic.com""" downloader = NatgeoDownloader() if kwargs["list_categories"]: click.echo("Available Categories:") for cat in downloader.get_categories(): click.echo(cat) return position = kwargs["position"] position_text = "random" if not position else position click.echo("setting image {} from category {}".format(position_text, kwargs["category"] or downloader.default_cat)) content = downloader.download(**kwargs, cli_ctx=cli_ctx) set_wallpaper(content, cli_ctx)
def cli(cli_ctx, **kwargs): """Downloader for image of the day of nationalgeographic.com""" downloader = NatgeoDownloader() if kwargs['list_categories']: click.echo("Available Categories:") for cat in downloader.get_categories(): click.echo(cat) return position = kwargs['position'] position_text = 'random' if not position else position click.echo('setting image {} from category {}'.format( position_text, kwargs['category'] or downloader.default_cat)) content = downloader.download(**kwargs, cli_ctx=cli_ctx) set_wallpaper(content, cli_ctx)
def cli(cli_ctx, **kwargs): """Downloader for wallhaven.cc""" logger = logging.getLogger(__name__) logger.debug('Got cli arguments {}'.format(kwargs)) purity = '100' if kwargs.get('nsfw', False): purity = '110' if kwargs.get('nsfw_only', False): purity = '010' categories = extract_categories(kwargs.get('categories', '').lower()) kwargs['categories'] = categories kwargs['purity'] = purity logger.debug('Downloading content using {}'.format(kwargs)) content = WallhavenDownloader().download(**kwargs, cli_ctx=cli_ctx) set_wallpaper(content, cli_ctx)
def cli(cli_ctx, **kwargs): """Downloader for reddit.com""" tab, position, list_tabs, subreddit = [kwargs.get(x, None) for x in ['tab', 'position', 'list_tabs', 'subreddit']] downloader = RedditDownloader() if list_tabs: click.echo('Available Tabs:') for tab in downloader.tabs: click.echo(tab) return if tab not in downloader.tabs: click.echo('Incorrect tab see --list-tabs for viable options', err=True) return click.echo('setting random wallpaper from /r/{} {} tab'.format(subreddit, tab)) content = downloader.download(**kwargs, cli_ctx=cli_ctx) set_wallpaper(content, cli_ctx)
def cli(cli_ctx, **kwargs): """Downloader for reddit.com""" tab, position, list_tabs, subreddit = [ kwargs.get(x, None) for x in ['tab', 'position', 'list_tabs', 'subreddit'] ] downloader = RedditDownloader() if list_tabs: click.echo('Available Tabs:') for tab in downloader.tabs: click.echo(tab) return if tab not in downloader.tabs: click.echo('Incorrect tab see --list-tabs for viable options', err=True) return click.echo('setting random wallpaper from /r/{} {} tab'.format( subreddit, tab)) content = downloader.download(**kwargs, cli_ctx=cli_ctx) set_wallpaper(content, cli_ctx)
def cli(cli_ctx, **kwargs): """Downloader for image of the day of bing.com""" content = BingDownloader().download(**kwargs, cli_ctx=cli_ctx) set_wallpaper(content, cli_ctx)