From b8f922ae6e0d6be6a075cebf65dd3504d07c86de Mon Sep 17 00:00:00 2001 From: Rnhmjoj Date: Thu, 4 Dec 2014 19:50:55 +0100 Subject: [PATCH] Fix column width --- pirate-get.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pirate-get.py b/pirate-get.py index 0bca6c4..eb5a123 100755 --- a/pirate-get.py +++ b/pirate-get.py @@ -282,7 +282,7 @@ def config_to_load(): # enhanced print output with column titles def print_search_results(mags, sizes, uploaded): - columns = int(os.popen('stty size', 'r').read().split()[1]) - 55 + columns = int(os.popen('stty size', 'r').read().split()[1]) - 52 cur_color = 'zebra_0' print('{:>4} {:>5} {:>5} {:>5} {:9} {:11} {:{length}}'.format( @@ -306,9 +306,12 @@ def print_search_results(mags, sizes, uploaded): torrent_name = parse.unquote(name.group(1)).replace('+', ' ') # enhanced print output with justified columns - print('{:4} {:5} {:5} {:5.1f} {:5.1f} {:3} {:>11} {:{length}}'.format( - m, no_seeders, no_leechers, ratio, float(sizes[m][0]), - sizes[m][1], uploaded[m], torrent_name, length=columns), + print('{:4} {:5} {:5} {:5.1f} {:5.1f} {:3}' + ' {:<11} {:{length}}'.format(m, no_seeders, no_leechers, + ratio, float(sizes[m][0]), + sizes[m][1], uploaded[m], + torrent_name[:columns], + length=columns), color=cur_color)