diff --git a/loader/resources/cauldron_loader.py b/loader/resources/cauldron_loader.py index dc2ef1f..ece0eff 100644 --- a/loader/resources/cauldron_loader.py +++ b/loader/resources/cauldron_loader.py @@ -23,6 +23,7 @@ def load_pack(self, path, url): def parse_rows(self, row): version, minecraft, release, downloads = row.find_all('td') url = downloads.find_all('a').pop()['href'] + build = re.sub(r'[^0-9]', '', version.text) return { '$parents': [ @@ -40,7 +41,8 @@ def parse_rows(self, row): '$id': minecraft.text, 'resource': 'version', 'version': minecraft.text, - 'mc_version': minecraft.text + 'mc_version': minecraft.text, + 'last_build': build } ], '$id': version.text, @@ -48,7 +50,7 @@ def parse_rows(self, row): '$patched': False, 'resource': 'build', 'created': datetime.datetime.strptime(release.text, '%m/%d/%Y %I:%M:%S %p'), - 'build': re.sub(r'[^0-9]', '', version.text), + 'build': build, 'url': url, } diff --git a/loader/resources/craftbukkit_loader.py b/loader/resources/craftbukkit_loader.py index 130982f..b08cc49 100644 --- a/loader/resources/craftbukkit_loader.py +++ b/loader/resources/craftbukkit_loader.py @@ -37,7 +37,8 @@ def parse_results(self, result): '$id': result['version'], 'resource': 'version', 'version': result['version'], - 'mc_version': re.search(r'^[0-9\.]+', result['version']).group(0) + 'mc_version': re.search(r'^[0-9\.]+', result['version']).group(0), + 'last_build': result['build_number'] } ], '$id': str(result['build_number']), diff --git a/loader/resources/creeperrepo_loader.py b/loader/resources/creeperrepo_loader.py index 5828cfd..edd18cd 100644 --- a/loader/resources/creeperrepo_loader.py +++ b/loader/resources/creeperrepo_loader.py @@ -43,6 +43,7 @@ def parse_pack(self, elem): url = (self.base_url + urllib.parse.quote_plus('modpacks^{dir}^{version}'.format(**urlparts)) + '/' + elem['url']) + build = re.sub(r'[^0-9]', '', elem['version']) return { '$parents': [ @@ -60,7 +61,8 @@ def parse_pack(self, elem): '$id': elem['version'], 'resource': 'version', 'version': elem['version'], - 'mc_version': elem['mcVersion'] + 'mc_version': elem['mcVersion'], + 'last_build': build } ], '$id': elem['version'], @@ -68,7 +70,7 @@ def parse_pack(self, elem): '$patched': True, 'resource': 'build', 'created': datetime.datetime.now(), - 'build': re.sub(r'[^0-9]', '', elem['version']), + 'build': build, 'url': url, } diff --git a/loader/resources/directs/pixelmon.json b/loader/resources/directs/pixelmon.json index a2ce149..d753bb7 100644 --- a/loader/resources/directs/pixelmon.json +++ b/loader/resources/directs/pixelmon.json @@ -14,9 +14,10 @@ "description": "" }, { - "$id": "3.2.4", - "resource": "version", - "version": "3.2.4" + "$id": "3.2.4", + "resource": "version", + "version": "3.2.4", + "last_build": 324 } ], "$id": "1710", @@ -40,9 +41,10 @@ "description": "" }, { - "$id": "3.1.4", - "resource": "version", - "version": "3.1.4" + "$id": "3.1.4", + "resource": "version", + "version": "3.1.4", + "last_build": 314 } ], "$id": "17", diff --git a/loader/resources/mojang_loader.py b/loader/resources/mojang_loader.py index 9aa4513..4da2e06 100644 --- a/loader/resources/mojang_loader.py +++ b/loader/resources/mojang_loader.py @@ -36,6 +36,8 @@ def parse_version(self, version): url = self.download_url_base.format(version['id']) released = datetime.datetime.strptime(re.sub(r'\+[0-9]{2}:[0-9]{2}$', '', version['releaseTime']), '%Y-%m-%dT%H:%M:%S') + build = math.floor(released.timestamp() / 100) + return { '$parents': [ { @@ -55,7 +57,8 @@ def parse_version(self, version): }, { '$id': version['id'], 'resource': 'version', - 'version': version['id'] + 'version': version['id'], + 'last_build': build, } ], '$id': version['id'], @@ -63,7 +66,7 @@ def parse_version(self, version): '$patched': False, 'resource': 'build', 'created': released, - 'build': math.floor(released.timestamp() / 100), + 'build': build, 'url': url, } diff --git a/loader/resources/technic_loader.py b/loader/resources/technic_loader.py index 0892b18..aa881e3 100644 --- a/loader/resources/technic_loader.py +++ b/loader/resources/technic_loader.py @@ -9,13 +9,23 @@ class Technic(): listing_url = 'http://solder.technicpack.net/api/modpack' pack_url = 'http://solder.technicpack.net/api/modpack/%s' - download_url = 'http://mirror.technicpack.net/Technic/servers/{name}/{cap_name}_Server_v{build}.zip' + download_url = 'http://mirror.technicpack.net/Technic/servers/' descriptions = { 'release': 'An official release of a Minecraft version.', 'snapshot': 'The latest testing snapshot of Minecraft. It may be unstable!' } + mapping = { + 'attack-of-the-bteam': 'bteam/BTeam_Server_v', + 'tekkitmain': 'tekkitmain/Tekkit_Server_v', + 'tekkit': 'tekkit/Tekkit_Server_', + 'bigdig': 'bigdig/BigDigServer-v', + 'hexxit': 'hexxit/Hexxit_Server_v', + 'voltz': 'voltz/Voltz_Server_v', + 'tekkitlite': 'tekkitlite/Tekkit_Lite_Server_' + } + def __init__(self): pass @@ -42,11 +52,15 @@ def get_versions(self, slug): out = [] for build in data['builds']: - url = self.download_url.format(**{ - 'name': data['name'], - 'cap_name': data['name'].capitalize(), - 'build': build - }) + if data['name'] in self.mapping: + name = self.mapping[data['name']] + else: + continue + + url = self.download_url + name + build + '.zip' + + print(url) + build_num = re.sub(r'[^0-9]', '', build) out.append({ '$parents': [ @@ -63,7 +77,8 @@ def get_versions(self, slug): }, { '$id': build, 'resource': 'version', - 'version': build + 'version': build, + 'last_build': build_num } ], '$id': build, @@ -71,7 +86,7 @@ def get_versions(self, slug): '$patched': True, 'resource': 'build', 'created': datetime.datetime.now(), - 'build': re.sub(r'[^0-9]', '', build), + 'build': build_num, 'url': url, }) diff --git a/setup.py b/setup.py index 0371c8b..d9ab340 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='SpaceGDN', - version='2.1.1', + version='2.1.2', url='https://github.com/connor4312/querytree', author='Connor Peet', author_email='connor@connorpeet.com',