diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-05-19 02:31:49 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-05-19 02:31:49 -0300 |
commit | 1d288fb3f1ac63605781b116b732d4555e01d01f (patch) | |
tree | 2d10b364e9c3e3b7ccba324e1df55e250e55f0c8 | |
parent | c366be7c87374a1f84b8be5843e3a7e53997e526 (diff) | |
download | renpy-1d288fb3f1ac63605781b116b732d4555e01d01f.tar.gz renpy-1d288fb3f1ac63605781b116b732d4555e01d01f.tar.bz2 renpy-1d288fb3f1ac63605781b116b732d4555e01d01f.tar.xz renpy-1d288fb3f1ac63605781b116b732d4555e01d01f.zip |
Add support to download localized server lists
-rw-r--r-- | game/update.rpy | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/game/update.rpy b/game/update.rpy index 54c1bd2..4ca520f 100644 --- a/game/update.rpy +++ b/game/update.rpy @@ -58,7 +58,18 @@ init python: def update_serverlist(host): try: - r=requests.get("%s/server_list.json" % host, timeout=10.0) + r=None + ## Attempt for a localized version first + if _preferences.language is not None: + r=requests.get("%s/server_list.%s.json" % (host, _preferences.language), timeout=10.0) + + if (r.status_code == 404): + stdout("No server list for language: %s" % _preferences.language) + r=None + + ## Obtain regular version if localized version failed/skipped + if r is None: + r=requests.get("%s/server_list.json" % host, timeout=10.0) if (r.status_code != 200): raise AssertionError("Mirror %s seems to be down!\nReturned error %03d\n" % (host.replace("https://", "").replace("http://", ""), r.status_code)) |