diff --git a/papercall_grabbing.py b/scripts/papercall_grabbing.py
similarity index 91%
rename from papercall_grabbing.py
rename to scripts/papercall_grabbing.py
index 9cb1dc2..ccfaa31 100644
--- a/papercall_grabbing.py
+++ b/scripts/papercall_grabbing.py
@@ -8,7 +8,7 @@
token = 'your_papercall_token' # ,<-- fill this in
-THIS_DIR = os.path.abspath(os.path.dirname(__file__))
+ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
des_template = """
Title: {title}
@@ -34,7 +34,7 @@ def get_reviewer_list():
"""
# Collect submission ids
all_ids = get_submission_ids()
-
+
# Collect all reviewers
reviewers = set()
for id in all_ids:
@@ -42,7 +42,7 @@ def get_reviewer_list():
ratings = requests.get(url % (id, token)).json()
for rating in ratings:
reviewers.add(rating['user']['name'])
-
+
# Print a list
for reviewer in sorted(reviewers):
print(reviewer)
@@ -53,7 +53,7 @@ def get_talk_descriptions():
"""
# Collect submission ids
all_ids = get_submission_ids()
-
+
# Collect descriptions
index = {}
for id in all_ids:
@@ -63,13 +63,13 @@ def get_talk_descriptions():
title = submission['talk']['title']
page = des_template.format(description=submission['talk']['description'],
title=title, id=id)
- fname = os.path.join(THIS_DIR, 'content', 'pages', '2017', 'descriptions', id + '.md')
+ fname = os.path.join(ROOT_DIR, 'content', 'pages', '2017', 'descriptions', id + '.md')
with open(fname, 'wb') as f:
f.write(page.encode())
index[id] = title
time.sleep(0.1)
-
- fname = os.path.join(THIS_DIR, 'content', 'pages', '2017', 'descriptions', 'index.md')
+
+ fname = os.path.join(ROOT_DIR, 'content', 'pages', '2017', 'descriptions', 'index.md')
with open(fname, 'wb') as f:
for id in sorted(index):
line = id + ' - ' + index[id] + '\n'
@@ -80,24 +80,24 @@ def make_links_in_program():
""" Make the talk titles in the program link to description pages,
as far as we can, anyway. The rest should be done by hand by making use of
the descriptions.index.md.
-
+
Beware, this is ugly, and makes all kinds of assumptions about how the program
table is formatted, and it needs manual corrections, and it does not work after
it has applied the changes. We should probably just throw it away.
"""
-
+
# Build reverse index
rindex = {}
- fname = os.path.join(THIS_DIR, 'content', 'pages', '2017', 'descriptions', 'index.md')
+ fname = os.path.join(ROOT_DIR, content', 'pages', '2017', 'descriptions', 'index.md')
with open(fname, 'rb') as f:
for line in f.read().decode().splitlines():
if line.strip():
id, _, title = line.partition('-')
rindex[title.strip().lower()] = 'descriptions/' + id.strip() + '.html'
default_link = 'descriptions/oops.html'
-
+
# Add links
- fname = os.path.join(THIS_DIR, 'content', 'pages', '2017', 'program.md')
+ fname = os.path.join(ROOT_DIR, 'content', 'pages', '2017', 'program.md')
text = open(fname, 'rb').read().decode()
lines = text.splitlines()
for i in range(len(lines)-1):
@@ -112,7 +112,7 @@ def make_links_in_program():
title, _, rest = line.lstrip()[4:].partition('
')
id = rindex.get(title.strip().lower(), default_link)
lines[i] = "