forked from djib/PDMameUpdate
Allow updating sets that have no torrent
This commit is contained in:
@ -136,7 +136,7 @@ def filter_updatable_torrents():
|
|||||||
"""Checks if newer versions are available and prompt for update"""
|
"""Checks if newer versions are available and prompt for update"""
|
||||||
|
|
||||||
for torrent, data in list(torrents.items()):
|
for torrent, data in list(torrents.items()):
|
||||||
keys_to_check = {'local-version', 'remote-version', 'transmission-id'}
|
keys_to_check = {'local-version', 'remote-version'}
|
||||||
if (
|
if (
|
||||||
keys_to_check.issubset(data.keys())
|
keys_to_check.issubset(data.keys())
|
||||||
and
|
and
|
||||||
@ -173,14 +173,15 @@ 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"""
|
||||||
|
|
||||||
output_header = ["Torrent", "from", "to"]
|
output_header = ["Torrent", "From", "To", "Transmission ID"]
|
||||||
output = []
|
output = []
|
||||||
if len(torrents) > 0:
|
if len(torrents) > 0:
|
||||||
for torrent, data in torrents.items():
|
for torrent, data in torrents.items():
|
||||||
output.append([
|
output.append([
|
||||||
torrent,
|
torrent,
|
||||||
data['local-version'],
|
data['local-version'],
|
||||||
data['remote-version']
|
data['remote-version'],
|
||||||
|
data.get('transmission-id', 'N/A')
|
||||||
])
|
])
|
||||||
print(tabulate(output, headers=output_header, tablefmt="simple"))
|
print(tabulate(output, headers=output_header, tablefmt="simple"))
|
||||||
print('Should I update the torrents listed above? (y/N)')
|
print('Should I update the torrents listed above? (y/N)')
|
||||||
@ -263,8 +264,9 @@ def update_torrents():
|
|||||||
config['torrent-directory'],
|
config['torrent-directory'],
|
||||||
torrent['remote-name']+'.torrent'
|
torrent['remote-name']+'.torrent'
|
||||||
)
|
)
|
||||||
logging.debug('Removing from transmission : %s',torrent['transmission-id'])
|
if 'transmission-id' in torrent:
|
||||||
client.torrent.remove(torrent['transmission-id'])
|
logging.debug('Removing from transmission : %s',torrent['transmission-id'])
|
||||||
|
client.torrent.remove(torrent['transmission-id'])
|
||||||
logging.debug('Renaming %s to %s',old_name, new_name)
|
logging.debug('Renaming %s to %s',old_name, new_name)
|
||||||
os.rename(old_name, new_name)
|
os.rename(old_name, new_name)
|
||||||
logging.debug('Adding to transmission : %s', torrent['remote-link'])
|
logging.debug('Adding to transmission : %s', torrent['remote-link'])
|
||||||
|
Reference in New Issue
Block a user