diff --git a/PDMameUpdate.py b/PDMameUpdate.py index 4e5cefa..9982f33 100755 --- a/PDMameUpdate.py +++ b/PDMameUpdate.py @@ -136,7 +136,7 @@ def filter_updatable_torrents(): """Checks if newer versions are available and prompt for update""" for torrent, data in list(torrents.items()): - keys_to_check = {'local-version', 'remote-version', 'transmission-id'} + keys_to_check = {'local-version', 'remote-version'} if ( keys_to_check.issubset(data.keys()) and @@ -173,14 +173,15 @@ def check_and_rewrite_download_url(torrent_data): def prompt_for_update(): """Ask for user confirmation before updating""" - output_header = ["Torrent", "from", "to"] + output_header = ["Torrent", "From", "To", "Transmission ID"] output = [] if len(torrents) > 0: for torrent, data in torrents.items(): output.append([ torrent, data['local-version'], - data['remote-version'] + data['remote-version'], + data.get('transmission-id', 'N/A') ]) print(tabulate(output, headers=output_header, tablefmt="simple")) print('Should I update the torrents listed above? (y/N)') @@ -263,8 +264,9 @@ def update_torrents(): config['torrent-directory'], torrent['remote-name']+'.torrent' ) - logging.debug('Removing from transmission : %s',torrent['transmission-id']) - client.torrent.remove(torrent['transmission-id']) + if 'transmission-id' in torrent: + 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) os.rename(old_name, new_name) logging.debug('Adding to transmission : %s', torrent['remote-link'])