From b9556506a5bad303f9d415dcf7c0eae5d2088ae0 Mon Sep 17 00:00:00 2001 From: sebastian404 Date: Sun, 9 Apr 2023 15:22:25 +0100 Subject: [PATCH 1/4] Update for direct magnet links, add support for versions with multiple minor versions --- PDMameUpdate.py | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/PDMameUpdate.py b/PDMameUpdate.py index 74d205f..7fe70bd 100755 --- a/PDMameUpdate.py +++ b/PDMameUpdate.py @@ -26,6 +26,7 @@ Requirements: * A proper PDMameUpdate.json file (see PDMameUpdate.template.json) * Python3 with the libraries below - bs4 + - packaging - requests - transmission-clutch - tabulate @@ -53,6 +54,7 @@ from tabulate import tabulate from collections import defaultdict from pprint import pformat from urllib.parse import urlparse +from packaging import version def open_config_file(): @@ -93,16 +95,6 @@ def open_config_file(): return config -def get_magnet_link(link): - page = get(link) - html = bs(page.text, 'html.parser') - - for link in html.find_all('a'): - href = link.get('href') - if urlparse(href).scheme == 'magnet': - return link.string - - def fetch_local_torrents(): """Fetches local torrents versions""" @@ -139,7 +131,7 @@ def fetch_remote_torrents(): for regexp in regexps: match = regexp.search(link.string) if match: - if urlparse(link.get('href')).netloc == 'mgnet.me': + if urlparse(link.get('href')).scheme == 'magnet': matched_version = match.group(0) matched_torrent = torrents[regexp.sub('#', link.string)] remote_version = matched_torrent.get('remote-version', '') @@ -148,8 +140,8 @@ def fetch_remote_torrents(): matched_torrent['remote-link'] = link.get('href') matched_torrent['remote-name'] = link.string else: - logging.info("Skipping '{}' version '{}'".format( - match.group(0), + logging.debug("Skipping '{}' version '{}'".format( + link.string, matched_version )) logging.debug('Found the remote torrent versions: %s', pformat(torrents)) @@ -160,13 +152,11 @@ def filter_updatable_torrents(): for torrent, data in list(torrents.items()): keys_to_check = {'local-version', 'remote-version'} - if ( + if not ( keys_to_check.issubset(data.keys()) and - data['local-version'] < data['remote-version'] + version.parse(data['local-version']) < version.parse(data['remote-version']) ): - data['remote-link'] = get_magnet_link(data['remote-link']) - else: del torrents[torrent] logging.debug( From 12aa0289a9b5b87a63633f9e7cca7d409bd7464a Mon Sep 17 00:00:00 2001 From: Sebastian Robinson Date: Sun, 31 Dec 2023 19:57:13 +0000 Subject: [PATCH 2/4] Update HBMAME github site, add support for Demul, Kawaks, FinalBurnNEO & Raine sets. --- PDMameUpdate.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/PDMameUpdate.py b/PDMameUpdate.py index 7fe70bd..0c99c24 100755 --- a/PDMameUpdate.py +++ b/PDMameUpdate.py @@ -17,6 +17,10 @@ Basically what it does is: Supported Torrents: * MAME * HBMAME + * Demul + * Kawaks + * FBNeo + * Raine Work in progress… * TODO: implement some error handling @@ -121,7 +125,11 @@ def fetch_remote_torrents(): logging.info('Opening PleasureDome github feed') pdurls = [ 'https://pleasuredome.github.io/pleasuredome/mame/index.html', - 'https://pleasuredome.github.io/pleasuredome/hbmame/index.html' + 'https://pleasuredome.github.io/pleasuredome/nonmame/hbmame/index.html', + 'https://pleasuredome.github.io/pleasuredome/nonmame/demul/index.html', + 'https://pleasuredome.github.io/pleasuredome/nonmame/fbneo/index.html', + 'https://pleasuredome.github.io/pleasuredome/nonmame/kawaks/index.html', + 'https://pleasuredome.github.io/pleasuredome/nonmame/raine/index.html' ] for url in pdurls: page = get(url) @@ -304,6 +312,10 @@ if __name__ == '__main__': regexps = [ re.compile(r'(?<=MAME )[\d.]+'), re.compile(r'(?<=HBMAME )[\d.]+'), + re.compile(r'(?<=Demul )[\d.]+'), + re.compile(r'(?<=Kawaks )[\d.]+'), + re.compile(r'(?<=FBNeo )[\d.]+'), + re.compile(r'(?<=Raine )[\d.]+'), ] config = open_config_file() torrents = defaultdict(dict) From 5d2baadfa5f08a708ccd8a4547f88a4b124b86ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Baptiste=20H=C3=A9tier?= Date: Thu, 29 Feb 2024 16:16:13 +0100 Subject: [PATCH 3/4] Fix screenshot --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 41ad977..2de012b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Supported torrents: * MAME * HBMAME -![Sample output](https://djib.fr/djib/PDMameUpdate/raw/branch/master/screenshot.png) +![Sample output](https://djib.fr/git/djib/PDMameUpdate/raw/branch/master/screenshot.png) ## Installation You need to rename `PDMameUpdate.template.json` to `PDMameUpdate.json` and modify it with the proper information. From eb43a2c08119b1261d0679f612fbbeeb2fb25d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Baptiste=20H=C3=A9tier?= Date: Sun, 20 Oct 2024 12:33:05 +0200 Subject: [PATCH 4/4] =?UTF-8?q?Updated=20URL=E2=80=AFafter=20domain=20migr?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2de012b..8c688d3 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Supported torrents: * MAME * HBMAME -![Sample output](https://djib.fr/git/djib/PDMameUpdate/raw/branch/master/screenshot.png) +![Sample output](https://djib.djib.fr/djib/PDMameUpdate/raw/branch/master/screenshot.png) ## Installation You need to rename `PDMameUpdate.template.json` to `PDMameUpdate.json` and modify it with the proper information.