aboutsummaryrefslogtreecommitdiff
path: root/update.py
diff options
context:
space:
mode:
Diffstat (limited to 'update.py')
-rwxr-xr-xupdate.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/update.py b/update.py
index 28ee252..bca3cbc 100755
--- a/update.py
+++ b/update.py
@@ -8,6 +8,7 @@ import re
import collections
import urllib.parse
import multiprocessing
+from configparser import ConfigParser
import requests
@@ -48,6 +49,25 @@ parser.add_argument("--game-version",
## loaded from version.txt
VERSION = 0
+def load_config():
+ config = ConfigParser()
+ config.read("pack.ini")
+ config["pack"]["sanitized_name"] = sanitize_text(config["pack"]["name"])
+ # return the whole config file, pack configuration and modlist
+ return config
+
+# take a string and only keep filename-friendly parts
+def sanitize_text(text):
+ sanitized = ""
+ replacement_map = {" ": "-"}
+ for char in text:
+ if char.isalnum():
+ sanitized += char.lower()
+ elif char in replacement_map:
+ sanitized += replacement_map[char]
+ return sanitized
+
+
def read_file(fil):
"""
Given a filename, read its contents in as a list of tuples.