diff --git a/Dockerfile b/Dockerfile index 83f05e3..7ec92f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update \ lib32stdc++6 \ lib32gcc1 \ wget \ + rename \ ca-certificates \ && \ apt-get remove --purge -y \ diff --git a/launch.py b/launch.py index 12fcc80..7929bae 100644 --- a/launch.py +++ b/launch.py @@ -7,7 +7,7 @@ def mod_param(name, mods): - return ' -{}="{}" '.format(name, ";".join(mods)) + return ' -{}="{}" '.format(name, ";".join(mods)).replace('/arma3/', '') def env_defined(key): diff --git a/workshop.py b/workshop.py index b8c900f..19a2eb0 100644 --- a/workshop.py +++ b/workshop.py @@ -9,8 +9,10 @@ WORKSHOP = "/arma3/steamapps/workshop/content/107410/" USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36" # noqa: E501 +def lowercase_workshop_dir(path: str): + os.system("(cd {} && find . -depth -exec rename -v 's/(.*)\/([^\/]*)/$1\/\L$2/' {{}} \;)".format(path)) -def mod(id): +def download_mod(id): steamcmd = ["/steamcmd/steamcmd.sh"] steamcmd.extend(["+login", os.environ["STEAM_USER"], os.environ["STEAM_PASSWORD"]]) steamcmd.extend(["+force_install_dir", "/arma3"]) @@ -35,8 +37,9 @@ def preset(mod_file): regex = r"filedetails\/\?id=(\d+)\"" matches = re.finditer(regex, html, re.MULTILINE) for _, match in enumerate(matches, start=1): - mod(match.group(1)) + download_mod(match.group(1)) moddir = WORKSHOP + match.group(1) + lowercase_workshop_dir(moddir) mods.append(moddir) keys.copy(moddir) return mods