forked from djib/PDMameUpdate
Merge branch 'master' of sebastian404/PDMameUpdate into master
This commit is contained in:
15
PDMameUpdate.py
Normal file → Executable file
15
PDMameUpdate.py
Normal file → Executable file
@ -22,6 +22,8 @@ Requirements:
|
||||
* A PleasureDome account
|
||||
* A proper config.json file (see config.template.json)
|
||||
* Python3 with the libraries below
|
||||
- feedparser
|
||||
- transmission-clutch
|
||||
* Linux (untested on other OS, but it might work)
|
||||
|
||||
Notes
|
||||
@ -65,8 +67,8 @@ def fetch_local_torrents():
|
||||
for directory in directories:
|
||||
match = re_mame_version.match(directory)
|
||||
if match:
|
||||
torrents[match[2]]['local-version'] = int(match[1])
|
||||
torrents[match[2]]['local-name'] = directory
|
||||
torrents[match.group(2)]['local-version'] = int(match.group(1))
|
||||
torrents[match.group(2)]['local-name'] = directory
|
||||
logging.debug('Found the local torrent versions: %s', pformat(torrents))
|
||||
|
||||
|
||||
@ -78,9 +80,9 @@ def fetch_remote_terrents():
|
||||
for post in d.entries:
|
||||
match = re_mame_version.match(post.title)
|
||||
if match:
|
||||
torrents[match[2]]['remote-version'] = int(match[1])
|
||||
torrents[match[2]]['remote-link'] = post.link
|
||||
torrents[match[2]]['remote-name'] = post.title
|
||||
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
|
||||
logging.debug('Found the remote torrent versions: %s', pformat(torrents))
|
||||
|
||||
|
||||
@ -158,7 +160,7 @@ def fetch_transmission_torrents():
|
||||
for torrent in client.list().values():
|
||||
match = re_mame_version.match(torrent['name'])
|
||||
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))
|
||||
|
||||
|
||||
@ -178,6 +180,7 @@ def update_torrents():
|
||||
os.rename(old_name, new_name)
|
||||
client.torrent.add(
|
||||
filename=torrent['remote-link'],
|
||||
download_dir=config['mame_directory'],
|
||||
cookies=cookies,
|
||||
paused=False
|
||||
)
|
||||
|
Reference in New Issue
Block a user