improve output of torrents to update

This commit is contained in:
Sebastian Robinson
2019-11-27 11:08:44 +00:00
parent 0fc027c599
commit db55933f64

View File

@ -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':