Skip to content

Commit

Permalink
bugfix and switch huntnum to 2
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Sep 30, 2015
1 parent d33646d commit 08dc181
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions huntserver/puzzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,21 @@ def unlock_puzzles(team):
# Has to also get number of pages so that the whole pdf doesn't become one image
def download_puzzles(hunt):
directory = "/home/hunt/puzzlehunt_server/huntserver/static/huntserver/puzzles"
# TODO: maybe move folder, see if success, then delete.
# maybe overwrite files with wget?

# Remove old folder
call(["rm", "-r", directory])
call(["mkdir", directory])

curr_hunt = Hunt.objects.get(hunt_number=settings.CURRENT_HUNT_NUM)
for puzzle in curr_hunt.puzzle_set.all():
# Get the file
file_str = directory + "/" + puzzle.puzzle_id + ".pdf"
call(["wget", puzzle.link, "-O", file_str])
# get file info
pages = int(check_output("pdfinfo " + file_str + " | grep Pages | awk '{print $2}'", shell=True))
# convert file page by page
for i in range(pages):
call(["convert", "-density", "200", "-scale", "x1000", file_str + "[" + str(i) + "]", directory + "/" + puzzle.puzzle_id + "-" + str(i) + ".png"])

Expand Down
2 changes: 1 addition & 1 deletion huntserver/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def send_status_update(puzzle, team, status_type):
# Displays a chat message to the relevant users
def send_chat_message(message):
redis_publisher = RedisPublisher(facility='chat_message',
users=[settings.ADMIN_ACCT[0], message.team.login_info.username])
users=[settings.ADMIN_ACCTS[0], message.team.login_info.username])
packet = dict()
packet['team_pk'] = message.team.pk
packet['team_name'] = message.team.team_name
Expand Down
2 changes: 1 addition & 1 deletion puzzlehunt_server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from secret_settings import *

""" PLEASE UPDATE BEFORE STARTING HUNT DEVELOPMENT """
CURRENT_HUNT_NUM = 1
CURRENT_HUNT_NUM = 2

""" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! """

Expand Down

0 comments on commit 08dc181

Please sign in to comment.