|
@ -4,7 +4,7 @@ from zipfile import ZipFile |
|
|
|
|
|
|
|
|
FS_ROOT = '/srv/www/atr0phy.net/acks/quests' |
|
|
FS_ROOT = '/srv/www/atr0phy.net/acks/quests' |
|
|
URL_ROOT = 'https://atr0phy.net/acks/quests' |
|
|
URL_ROOT = 'https://atr0phy.net/acks/quests' |
|
|
IMG_EXTENSIONS = ('png', 'jpg', 'jpeg') |
|
|
|
|
|
|
|
|
ASSET_EXTENSIONS = ('png', 'jpg', 'jpeg', 'dungeondraft_map', 'wonderdraft_map', 'wxx') |
|
|
|
|
|
|
|
|
def load_quests(): |
|
|
def load_quests(): |
|
|
quest_list = {} |
|
|
quest_list = {} |
|
@ -50,13 +50,18 @@ def get_quest_details(level, quest_name): |
|
|
def urlify(path): |
|
|
def urlify(path): |
|
|
return {'display': path.name, 'url': path.as_posix().replace(FS_ROOT, URL_ROOT)} |
|
|
return {'display': path.name, 'url': path.as_posix().replace(FS_ROOT, URL_ROOT)} |
|
|
|
|
|
|
|
|
|
|
|
def read_coordinates(path): |
|
|
|
|
|
return path.read_text() |
|
|
|
|
|
|
|
|
for e in fs.iterdir(): |
|
|
for e in fs.iterdir(): |
|
|
if e.name.endswith(IMG_EXTENSIONS): |
|
|
|
|
|
|
|
|
if e.name.endswith(ASSET_EXTENSIONS): |
|
|
quest['assets'].append(urlify(e)) |
|
|
quest['assets'].append(urlify(e)) |
|
|
elif e.name == 'info.html': |
|
|
elif e.name == 'info.html': |
|
|
quest['info'] = urlify(e) |
|
|
quest['info'] = urlify(e) |
|
|
elif e.name == 'tsv.txt': |
|
|
elif e.name == 'tsv.txt': |
|
|
quest['tsv'] = urlify(e) |
|
|
quest['tsv'] = urlify(e) |
|
|
|
|
|
elif e.name == 'coordinates.txt': |
|
|
|
|
|
quest['coords'] = read_coordinates(e) |
|
|
|
|
|
|
|
|
print("Quest: {}".format(quest)) |
|
|
print("Quest: {}".format(quest)) |
|
|
return quest |
|
|
return quest |
|
|