Exemple #1
0
def cmd_price(arg):
    """Display the price for a card.

    Required: The card name.
    """
    if not arg:
        raise UsageError("CARD")
    prices = cards.scrape_card_price(arg)
    if prices:
        print("-" * 20)
        print("  Low:\t$%.2f\n" % prices["L"] + "  Avg:\t$%.2f\n" % prices["M"] + "  High:\t$%.2f\n" % prices["H"])
    else:
        print("Unable to find card data.")
def print_deckcardprice(count, card, p='M'):
    """Print the price for a cardset."""
    if p is None:
        return None
    price = cards.scrape_card_price(card.name, p)[1]
    if price is None:
        print('Unable to get price for %s' % card.name)
        return None
    tot = price * count
    mprint(card.color(), ' ' +\
           cards.cutoff_text(card.name, 24).ljust(25) +\
           str('$%.2f x' % price).rjust(8) + str(count).rjust(3) + ' = ' +\
           str('$%.2f' % tot).rjust(8))
    return tot
def cmd_price(arg):
    """Display the price for a given card."""
    if not arg:
        raise UsageError('CARD')
    (name, prices) = cards.scrape_card_price(arg)
    if name:
        print('')
        print('{0:^25}'.format(cards.cutoff_text(name, 25)))
        print('-' * 25)
        print('  Low:\t$%.2f\n' % prices['L']
                + '  Mean:\t$%.2f\n' % prices['M']
                + '  High:\t$%.2f\n' % prices['H'])
    else:
        print('Unable to find card data.')
Exemple #4
0
def print_deckcardprice(count, card, p='M'):
    """Print the price for a cardset."""
    if p is None:
        return None
    price = cards.scrape_card_price(card.name, p)[1]
    if price is None:
        print('Unable to get price for %s' % card.name)
        return None
    tot = price * count
    mprint(card.color(), ' ' +\
           cards.cutoff_text(card.name, 24).ljust(25) +\
           str('$%.2f x' % price).rjust(8) + str(count).rjust(3) + ' = ' +\
           str('$%.2f' % tot).rjust(8))
    return tot
Exemple #5
0
def cmd_price(arg):
    """Display the price for a given card."""
    if not arg:
        raise UsageError('CARD')
    (name, prices) = cards.scrape_card_price(arg)
    if name:
        print('')
        print('{0:^25}'.format(cards.cutoff_text(name, 25)))
        print('-' * 25)
        print('  Low:\t$%.2f\n' % prices['L'] +
              '  Mean:\t$%.2f\n' % prices['M'] +
              '  High:\t$%.2f\n' % prices['H'])
    else:
        print('Unable to find card data.')
Exemple #6
0
def print_deckcardprice(count, card, p="avg"):
    """Print the price for a cardset in the active deck."""
    if p is None:
        return None
    price = cards.scrape_card_price(card.name, p)
    if price is None:
        print("Unable to get price for %s" % card.name)
        return None
    tot = price * count
    mprint(
        card.color(),
        " "
        + cards.cutoff_text(card.name, 24).ljust(25)
        + str("$%.2f x" % price).rjust(8)
        + str(count).rjust(3)
        + " = "
        + str("$%.2f" % tot).rjust(8),
    )
    return tot