Example #1
0
def goodbye():
    prettystd.out(
        msg='\n{title} / Nov 31, 2012 / {version}0.1 / dbsr{at}moscownights.nl' \
            ' {indent} Thanks for chosing bla, we hope, etc...!\n',
            format_dict={'title': 'NZBCli', 'version': 'v', 'at': '@',
                            'indent': '>>>'},
        indent=0,
        newline=True
    )
Example #2
0
def _present_results(results):
    prettystd.out(msg='{indent} {num} results:\n',
                  format_dict={
                      'indent': '>>',
                      'num': len(results)
                  },
                  indent=0,
                  newline=True)
    prettystd.table(results)
    # Get user picks
    valid_choice = None
    try:
        while not valid_choice:
            raw_choice = raw_input(
                '\n >>> Download: num (eg. 2 or 1,3-5) / (A)ll / (N)one: ')
            valid_choice = _validate_choice(raw_choice, len(results))
        # Exit NZBCli
        if valid_choice == 'N':
            return
    except KeyboardInterrupt:
        # Cleanly exit nzbcli:
        goodbye()
        return

    # Confirm user picks:
    prettystd.out(
        msg=
        '{indent} retrieving links for the following {nzb}(s): {nzb_nums}\n',
        format_dict={
            'indent': '>>>>',
            'nzb': 'nzb',
            'nzb_nums': str(valid_choice).strip('[]')
        },
        indent=0,
        newline=True)

    return [results[x] for x in valid_choice]
Example #3
0
    # Make sure we got a clean config file
    try:
        nzbcli.read_config(args)
    except NZBCliError, e:
        prettystd.err(msg="{cfgError}! {e}\n".format(cfgError='{cfgError}',
                                                     e=e),
                      format_dict={'cfgError': 'NZBCliError'},
                      indent=0,
                      newline=True)
        return 1

    # Simple header
    prettystd.out(
        msg='{title} {version}0.1: A commandline nzb browser/downloader.',
        format_dict={
            'title': 'NZBCli',
            'version': 'v'
        },
        indent=0,
    )
    # Initiating search
    prettystd.out(
        msg=
        "{indent} Starting NZB search for '{query}' (category: {category}).",
        format_dict={
            'indent': '>',
            'query': query,
            'category': args['category']
        },
        indent=0)
    # Query the newznab provider
    try: