Skip to content

Commit

Permalink
On games with random downloads, allow user to control them via local …
Browse files Browse the repository at this point in the history
…date.
  • Loading branch information
AdmiralCurtiss committed Jul 2, 2014
1 parent c6b193c commit 2f29689
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nas_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,15 @@ def safeloadfi(fn, mode='rb'):
ret = self.filter_list(safeloadfi("_list.txt"), attr1, attr2, attr3)

if post["gamecd"] in gamecodes_return_random_file:
ret = self.filter_list_random_files(ret, 1)
# allow user to control which file to receive by setting the local date
# selected file will be the one at index (day of year) mod (file count)
try:
userData = self.server.db.get_nas_login(post['token'])
date = time.strptime(userData['devtime'], '%y%m%d%H%M%S')
files = ret.splitlines()
ret = files[int(date.tm_yday) % len(files)] + '\r\n'
except:
ret = self.filter_list_random_files(ret, 1)

if action == "contents":
# Get only the base filename just in case there is a path involved somewhere in the filename string.
Expand Down

0 comments on commit 2f29689

Please sign in to comment.