From d0e0aa9888efebd460db9e5c90c70f777f951651 Mon Sep 17 00:00:00 2001 From: djib Date: Wed, 30 Sep 2020 14:19:55 +0200 Subject: [PATCH] Fix error with updates no longer being detected --- PDMameUpdate.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PDMameUpdate.py b/PDMameUpdate.py index b017c2a..3e5c7ac 100755 --- a/PDMameUpdate.py +++ b/PDMameUpdate.py @@ -106,8 +106,10 @@ def fetch_local_torrents(): for regexp in regexps: match = regexp.match(directory) if match: - torrents[match.group('name')]['local-version'] = match.group('version') - torrents[match.group('name')]['local-name'] = directory + version = match.group('version') + name = match.group(0).replace(version, '#') + torrents[name]['local-version'] = version + torrents[name]['local-name'] = directory logging.debug('Found the local torrent versions: %s', pformat(torrents)) @@ -121,7 +123,7 @@ def fetch_remote_torrents(): match = regexp.match(post.title) if match: matched_version = match.group('version') - matched_torrent = torrents[match.group('name')] + matched_torrent = torrents[match.group(0).replace(matched_version, '#')] if matched_version > matched_torrent.get('remote-version', ''): matched_torrent['remote-version'] = matched_version matched_torrent['remote-link'] = post.link @@ -240,7 +242,7 @@ def fetch_transmission_torrents(): for regexp in regexps: match = regexp.match(torrent['name']) if match: - torrents[match.group('name')]['transmission-id'] = torrent['id'] + torrents[match.group(0).replace(match.group('version'), '#')]['transmission-id'] = torrent['id'] logging.debug('Found the Transmission torrent ids: %s', pformat(torrents)) @@ -326,8 +328,8 @@ if __name__ == '__main__': time.sleep(1) regexps = [ - re.compile(r'(?P(?:HB)?MAME (?P[\d.]+) .*)'), - re.compile(r'(?PNo-Intro \((?P[\d-]+)\) .*)') + re.compile(r'(?:HB)?MAME (?P[\d.]+) .*'), + re.compile(r'No-Intro \((?P[\d-]+)\) .*') ] config = open_config_file() torrents = defaultdict(dict)