diff options
| author | Fulgen301 <tokmajigeorge@gmailc.om> | 2017-07-10 21:30:18 +0200 |
|---|---|---|
| committer | Fulgen301 <tokmajigeorge@gmail.com> | 2017-07-11 11:10:43 +0200 |
| commit | c6d02d9085ea38cf7bc2e49488da15a9cc0e3c3b (patch) | |
| tree | cfad15e6316336073fca1ef791694705afc92881 | |
| parent | 30c302e72d23da40d90d45bf4865fe809ec20371 (diff) | |
| download | pycrctrl-c6d02d9085ea38cf7bc2e49488da15a9cc0e3c3b.tar.gz pycrctrl-c6d02d9085ea38cf7bc2e49488da15a9cc0e3c3b.zip | |
PyCRCtrl.setupConfig: Fix commandline parsing
| -rw-r--r-- | pycrctrl/pycrctrl.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pycrctrl/pycrctrl.py b/pycrctrl/pycrctrl.py index 19a482b..584341f 100644 --- a/pycrctrl/pycrctrl.py +++ b/pycrctrl/pycrctrl.py @@ -312,7 +312,16 @@ class PyCRCtrl(object): def setupConfig(self, config): #commandline sep = ":" if config["Clonk"]["commandlinePrefix"] == "/" else "=" - config["Clonk"]["commandline"] = " ".join("{}{}".format(config["Clonk"]["commandlinePrefix"], (sep.join(entry) if isinstance(entry, list) else str(entry))) for entry in config["Clonk"]["commandline"]) + + res = "" + for entry in config["Clonk"]["commandline"]: + if isinstance(entry, dict): + for i in entry.items(): + res += "{}{}{}{} ".format(config["Clonk"]["commandlinePrefix"], (i[0]), sep, str(i[1])) + else: + res += "{}{} ".format(config["Clonk"]["commandlinePrefix"], entry) + + config["Clonk"]["commandline"] = res #regexps @@ -329,11 +338,11 @@ class PyCRCtrl(object): def host(self, scenario=None, user=None) -> str: if scenario == None: return (CmdResult.SyntaxFail, "Bitte gib einen Szenarionamen an!") - if type(scenario) in [bytes, QByteArray]: + if hasattr(scenario, "decode"): try: - scenario = scenario.decode(self.config["Clonk"]["encoding"]) + scenario = scenario.decode(self.config["Clonk"]["encoding"], "replace") except: - return (CmdResult.SyntaxFail, "Unbekannter Datentyp!") + return (CmdResult.RuntimeError, "Dekodierfehler. Bitte kontaktiere den Hoster dieses Servers.") scenario = scenario.splitlines()[0] if scenario == "random": |
