Browse Source

Initial commit.

Currently recovers remote versions and local versions.
No comparison or automation is implemented yet.
pull/1/head
djib 5 months ago
parent
commit
b00bcb9834
3 changed files with 62 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +56
    -0
      PDMameUpdate.py
  3. +3
    -0
      config.template.json

+ 3
- 0
.gitignore View File

@@ -0,0 +1,3 @@
config.json
.project
.pydevproject

+ 56
- 0
PDMameUpdate.py View File

@@ -0,0 +1,56 @@
#!/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

+ 3
- 0
config.template.json View File

@@ -0,0 +1,3 @@
{
"mame_directory":"/path/to/your/locol/mame/torrent/target/folders"
}

Loading…
Cancel
Save