#!/usr/bin/python3 ''' Checks available MAME Torrents on PleasureDome and updates the local versions if more recent versions are detected Work in progress… Requirements: * Python3 with the libraries below * Transmission for Bitorrent * A PleasureDome account /!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\ /!\ Provided with no warranty whatsoever. /!\ /!\ Use with caution. /!\ /!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\/!\ ''' import feedparser import json import logging import os import re if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s') re_mame_version = re.compile('MAME 0.(\d+) (.*)') logging.info('Opening config file: config.json') with open('config.json') as config_file: config = json.load(config_file) logging.info('Fetching current MAME versions') files = os.listdir(config['mame_directory']) torrent_versions = {} for file in files: match = re_mame_version.match(file) if match: torrent_versions[match[2]] = match[1] logging.info('Found the following Torrent version on disk: %s', torrent_versions) logging.info('Opening PleasureDome RSS feed') d = feedparser.parse('http://www.pleasuredome.org.uk/rss.xml') for post in d.entries: match = re_mame_version.match(post.title) if match: print('Torrent {} is available with version {}.'.format(match[2], match[1])) if match[2] in torrent_versions: print('You have version {}'.format(torrent_versions[match[2]])) # TODO: use user input to decide whether the torrent should be updated # TODO: connect to PleasureDome # TODO: remove local torrent from Transmission # TODO: rename local folder # TODO: add new torrent to Transmission # TODO: implement some error handling