diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-05-14 13:58:31 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-05-14 13:58:31 +0100 |
commit | 4bea3484d15aa159a7aa3eea6ebd7aeb3d9d6f84 (patch) | |
tree | 2b5a7f0d46a4ff74155df7b1f429213452951279 | |
parent | 46a4bfbcff076c0d34b9e209a5f518547b3c5b40 (diff) | |
download | cheatdb-4bea3484d15aa159a7aa3eea6ebd7aeb3d9d6f84.tar.xz |
Fix crash on mod name not specified
-rw-r--r-- | app/tasks/importtasks.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/tasks/importtasks.py b/app/tasks/importtasks.py index 12b61dd..f39a224 100644 --- a/app/tasks/importtasks.py +++ b/app/tasks/importtasks.py @@ -91,9 +91,9 @@ def getKrockList(): return krock_list_cache, krock_list_cache_by_name def findModInfo(author, name, link): - _, lookup = getKrockList() + list, lookup = getKrockList() - if name in lookup: + if name is not None and name in lookup: if len(lookup[name]) == 1: return lookup[name][0] @@ -101,6 +101,11 @@ def findModInfo(author, name, link): if x["author"] == author: return x + if link is not None and len(link) > 15: + for x in list: + if link in x["link"]: + return x + return None @@ -161,9 +166,9 @@ def getMeta(urlstr, author): cutIdx = min(len(desc), 200 if idx < 5 else idx) result["short_description"] = desc[:cutIdx] - info = findModInfo(author, result["name"], result["repo"]) + info = findModInfo(author, result.get("name"), result["repo"]) if info is not None: - result["forumId"] = info["topicId"] + result["forumId"] = info.get("topicId") return result |