Skip to content

Commit

Permalink
Fix Tekkitpack urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor Peet committed Sep 17, 2014
1 parent d2d1d38 commit 3fff04f
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions loader/resources/technic_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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': [
Expand All @@ -63,15 +77,16 @@ def get_versions(self, slug):
}, {
'$id': build,
'resource': 'version',
'version': build
'version': build,
'last_build': build_num
}
],
'$id': build,
'$load': lambda path, url=url, slug=slug: self.load_pack(url, path, slug),
'$patched': True,
'resource': 'build',
'created': datetime.datetime.now(),
'build': re.sub(r'[^0-9]', '', build),
'build': build_num,
'url': url,
})

Expand Down

0 comments on commit 3fff04f

Please sign in to comment.