Commit b5b36e7e authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Sort, and only download if not already present

parent 44bb8aea
......@@ -42,9 +42,10 @@ def main():
print("Retrieving '{}' ({}) ...".format(title, version))
local_name = "{}.pdf".format(number.replace("/", "-"))
raw_file_name = os.path.abspath(os.path.join(RAW_DIR, local_name))
title_dir = os.path.join(TITLE_DIR, title)
title_file_name = os.path.join(title_dir, f"{version}.pdf")
urllib.request.urlretrieve(baseurl + link, raw_file_name)
title_dir = os.path.join(TITLE_DIR, title.replace("/", "-"))
title_file_name = os.path.join(title_dir, f"{date.strftime('%Y-%m-%d')}-{version}.pdf")
if not os.path.exists(raw_file_name):
urllib.request.urlretrieve(baseurl + link, raw_file_name)
os.makedirs(title_dir, exist_ok=True)
if os.path.exists(title_file_name):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment