forked from djib/PDMameUpdate
Handle multiple versions in RSS feed
This commit is contained in:
@ -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))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user