Example #1
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
Example #2
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.')
Example #3
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
Example #4
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.')
Example #5
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