diff --git a/PDMameUpdate.py b/PDMameUpdate.py index 4ea5572..19b64c1 100755 --- a/PDMameUpdate.py +++ b/PDMameUpdate.py @@ -82,12 +82,17 @@ def fetch_remote_terrents(): for post in d.entries: match = re_mame_version.match(post.title) if match: - try: - torrents[match.group(2)]['remote-version'] - except KeyError: - torrents[match.group(2)]['remote-version'] = int(match.group(1)) - torrents[match.group(2)]['remote-link'] = post.link - torrents[match.group(2)]['remote-name'] = post.title + matched_version = int(match.group(1)) + matched_torrent = torrents[match.group(2)] + if matched_version > matched_torrent.get('remote-version', 0): + matched_torrent['remote-version'] = matched_version + matched_torrent['remote-link'] = post.link + matched_torrent['remote-name'] = post.title + else: + logging.info("Skipping '{}' version '{}'".format( + match.group(0), + matched_version + )) logging.debug('Found the remote torrent versions: %s', pformat(torrents))