forked from djib/PDMameUpdate
improve output of torrents to update
This commit is contained in:
@ -24,6 +24,7 @@ Requirements:
|
|||||||
* Python3 with the libraries below
|
* Python3 with the libraries below
|
||||||
- feedparser
|
- feedparser
|
||||||
- transmission-clutch
|
- transmission-clutch
|
||||||
|
- tabulate
|
||||||
* Linux (untested on other OS, but it might work)
|
* Linux (untested on other OS, but it might work)
|
||||||
|
|
||||||
Notes
|
Notes
|
||||||
@ -48,6 +49,7 @@ import re
|
|||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
from clutch.core import Client
|
from clutch.core import Client
|
||||||
|
from tabulate import tabulate
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
@ -137,14 +139,17 @@ def check_and_rewrite_download_url(torrent_data):
|
|||||||
|
|
||||||
def prompt_for_update():
|
def prompt_for_update():
|
||||||
"""Ask for user confirmation before updating"""
|
"""Ask for user confirmation before updating"""
|
||||||
|
|
||||||
|
outputHeader=["Torrent","from","to"]
|
||||||
|
output=[]
|
||||||
if len(torrents) > 0:
|
if len(torrents) > 0:
|
||||||
for torrent, data in torrents.items():
|
for torrent, data in torrents.items():
|
||||||
print('Torrent {}: {} -> {}'.format(
|
output.append([
|
||||||
torrent,
|
torrent,
|
||||||
data['local-version'],
|
data['local-version'],
|
||||||
data['remote-version']
|
data['remote-version']
|
||||||
))
|
])
|
||||||
|
print(tabulate(output,headers=outputHeader,tablefmt="simple"))
|
||||||
print('Should I update the torrents listed above? (y/N)')
|
print('Should I update the torrents listed above? (y/N)')
|
||||||
answer = input()
|
answer = input()
|
||||||
if answer.lower() != 'y':
|
if answer.lower() != 'y':
|
||||||
|
Reference in New Issue
Block a user