Backwards Compatability for pre Python 3.6

This commit is contained in:
Sebastian Robinson
2019-09-25 18:11:28 +01:00
parent 30f34e9353
commit 8a3d58e745

12
PDMameUpdate.py Normal file → Executable file
View File

@ -65,8 +65,8 @@ def fetch_local_torrents():
for directory in directories: for directory in directories:
match = re_mame_version.match(directory) match = re_mame_version.match(directory)
if match: if match:
torrents[match[2]]['local-version'] = int(match[1]) torrents[match.group(2)]['local-version'] = int(match.group(1))
torrents[match[2]]['local-name'] = directory torrents[match.group(2)]['local-name'] = directory
logging.debug('Found the local torrent versions: %s', pformat(torrents)) logging.debug('Found the local torrent versions: %s', pformat(torrents))
@ -78,9 +78,9 @@ def fetch_remote_terrents():
for post in d.entries: for post in d.entries:
match = re_mame_version.match(post.title) match = re_mame_version.match(post.title)
if match: if match:
torrents[match[2]]['remote-version'] = int(match[1]) torrents[match.group(2)]['remote-version'] = int(match.group(1))
torrents[match[2]]['remote-link'] = post.link torrents[match.group(2)]['remote-link'] = post.link
torrents[match[2]]['remote-name'] = post.title torrents[match.group(2)]['remote-name'] = post.title
logging.debug('Found the remote torrent versions: %s', pformat(torrents)) logging.debug('Found the remote torrent versions: %s', pformat(torrents))
@ -158,7 +158,7 @@ def fetch_transmission_torrents():
for torrent in client.list().values(): for torrent in client.list().values():
match = re_mame_version.match(torrent['name']) match = re_mame_version.match(torrent['name'])
if match: if match:
torrents[match[2]]['transmission-id'] = torrent['id'] torrents[match.group(2)]['transmission-id'] = torrent['id']
logging.debug('Found the Transmission torrent ids: %s', pformat(torrents)) logging.debug('Found the Transmission torrent ids: %s', pformat(torrents))