This commit is contained in:
Admiral H. Curtiss
2015-04-24 20:46:49 +02:00
parent 09aecb8bb1
commit 55c8264cd7

View File

@@ -239,17 +239,18 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
# Look for a list file first.
# If the list file exists, send the entire thing back to the client.
if os.path.isfile(os.path.join(dlcpath, "_list.txt")):
ret = self.filter_list(safeloadfi("_list.txt"), attr1, attr2, attr3, num, offset)
# Don't try to filter any further if the list is empty.
if ret.strip() != "":
# this is super game-specific, but we need to handle gen 5 mystery gifts properly somehow
if post["gamecd"].startswith("IRA") and attr1.startswith("MYSTERY"):
ret = self.filter_list_g5_mystery_gift(ret, post["rhgamecd"])
ret = self.filter_list_by_date(ret, post["token"])
if post["gamecd"] in gamecodes_return_random_file:
ret = self.filter_list_by_date(ret, post["token"])
if post["gamecd"].startswith("IRA") and attr1.startswith("MYSTERY"):
# Pokemon BW Mystery Gifts, until we have a better solution for that
ret = self.filter_list(safeloadfi("_list.txt"), attr1, attr2, attr3)
ret = self.filter_list_g5_mystery_gift(ret, post["rhgamecd"])
ret = self.filter_list_by_date(ret, post["token"])
elif post["gamecd"] in gamecodes_return_random_file:
# Pokemon Gen 4 Mystery Gifts, same here
ret = self.filter_list(safeloadfi("_list.txt"), attr1, attr2, attr3)
ret = self.filter_list_by_date(ret, post["token"])
else:
# default case for most games
ret = self.filter_list(safeloadfi("_list.txt"), attr1, attr2, attr3, num, offset)
if action == "contents":
# Get only the base filename just in case there is a path involved somewhere in the filename string.