From 4cb6095c9243f72e224467d9a30b0b09bc9a56ff Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Wed, 15 Jun 2022 22:03:46 +0200 Subject: [PATCH] Added concat full lecture handout generator --- Lecture notes/.gitignore | 1 + Lecture notes/build.py | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 Lecture notes/.gitignore create mode 100644 Lecture notes/build.py diff --git a/Lecture notes/.gitignore b/Lecture notes/.gitignore new file mode 100644 index 0000000..c4f4e03 --- /dev/null +++ b/Lecture notes/.gitignore @@ -0,0 +1 @@ +handout.pdf diff --git a/Lecture notes/build.py b/Lecture notes/build.py new file mode 100644 index 0000000..20a35a7 --- /dev/null +++ b/Lecture notes/build.py @@ -0,0 +1,8 @@ +import os +import pathlib +from glob import glob +import subprocess +files = dict(sorted((int(file.name[4:-12]), file) for file in pathlib.Path('.').rglob('week*-handout.pdf'))) +fileList = map(lambda x: f'\"{str(x)}\"', files.values()) +command = f"pdftk {' '.join(fileList)} cat output handout.pdf" +subprocess.run(command) \ No newline at end of file