def user(api, conf, args): """ Get stats about an user :param api: :param conf: :param args: :return: """ user = api.user(args.uid) print(Fore.LIGHTBLUE_EX, end='') print('Username :'******'username']) print('User ID :', user['uid']) print('Downloaded :', sizeof_fmt(int(user['downloaded']))) print('Uploaded :', sizeof_fmt(int(user['uploaded']))) if not int(user['downloaded']): ratio = 'infinity' else: ratio = '%.2f' % (int(user['uploaded']) / int(user['downloaded'])) print('Ratio :', ratio) print(Fore.RESET, end='')
def user(api, conf, args): """ Get stats about an user :param api: :param conf: :param args: :return: """ user = api.user(args.uid) print(Fore.LIGHTBLUE_EX, end='') print('Username :'******'username']) print('User ID :', user['uid']) print('Uploaded :', sizeof_fmt(int(user['uploaded']))) print('Downloaded :', sizeof_fmt(int(user['downloaded']))) if not int(user['downloaded']): ratio = 'infinity' else: up = int(user['uploaded']) down = int(user['downloaded']) ratio = '%0.2f' % (floor((up / down) * 100) / 100) print('Ratio :', ratio) print(Fore.RESET, end='')
def display_list(torrents, limit): if not len(torrents): print(Fore.LIGHTBLUE_EX, 'Nothing to display.') else: print( Fore.LIGHTWHITE_EX, '%10s %5s %5s %10s %s' % ('Torrent ID', 'Seed', 'Leech', 'Size', 'Name')) for idx in range(min(int(limit), len(torrents))): item = torrents[idx] print( '%s%10s %s %5s %s %5s %s %10s %s %s%s' % (Fore.WHITE, item['id'], Fore.GREEN, item['seeders'], Fore.RED, item['leechers'], Fore.MAGENTA, sizeof_fmt(int(item['size'])), Fore.LIGHTBLUE_EX, item['name'], Fore.RESET))
def display_list(torrents, limit): if not len(torrents): print(Fore.LIGHTBLUE_EX, 'Nothing to display.') else: print(Fore.LIGHTWHITE_EX, '%10s %5s %5s %10s %s' % ('Torrent ID', 'Seed', 'Leech', 'Size', 'Name')) for idx in range(min(int(limit), len(torrents))): item = torrents[idx] print('%s%10s %s %5s %s %5s %s %10s %s %s%s' % ( Fore.WHITE, item['id'], Fore.GREEN, item['seeders'], Fore.RED, item['leechers'], Fore.MAGENTA, sizeof_fmt(int(item['size'])), Fore.LIGHTBLUE_EX, item['name'], Fore.RESET ))