From db55933f64b761d573a27e6ba33fc9664e693d5c Mon Sep 17 00:00:00 2001 From: Sebastian Robinson Date: Wed, 27 Nov 2019 11:08:44 +0000 Subject: [PATCH] improve output of torrents to update --- PDMameUpdate.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/PDMameUpdate.py b/PDMameUpdate.py index 9110a80..968ea0c 100755 --- a/PDMameUpdate.py +++ b/PDMameUpdate.py @@ -24,6 +24,7 @@ Requirements: * Python3 with the libraries below - feedparser - transmission-clutch + - tabulate * Linux (untested on other OS, but it might work) Notes @@ -48,6 +49,7 @@ import re import requests import time from clutch.core import Client +from tabulate import tabulate from collections import defaultdict from pprint import pformat from urllib.parse import quote @@ -137,14 +139,17 @@ def check_and_rewrite_download_url(torrent_data): def prompt_for_update(): """Ask for user confirmation before updating""" - + + outputHeader=["Torrent","from","to"] + output=[] if len(torrents) > 0: for torrent, data in torrents.items(): - print('Torrent {}: {} -> {}'.format( + output.append([ torrent, data['local-version'], data['remote-version'] - )) + ]) + print(tabulate(output,headers=outputHeader,tablefmt="simple")) print('Should I update the torrents listed above? (y/N)') answer = input() if answer.lower() != 'y':