aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/resources/views.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-09-03 08:31:23 +0100
committerMatthew Lemon <y@yulqen.org>2024-09-03 08:31:23 +0100
commita7cf8d5d8eca2cf66fddf05ecf00f81e63899906 (patch)
treed20d4247e596e6e48c4a76958f18cd5d048a688a /pyblackbird_cc/resources/views.py
parente727913b9d8e28fccede007aaf5558a5bfa8900c (diff)
Adds a docstring to a view function
Diffstat (limited to 'pyblackbird_cc/resources/views.py')
-rw-r--r--pyblackbird_cc/resources/views.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py
index 4df7208..02985e4 100644
--- a/pyblackbird_cc/resources/views.py
+++ b/pyblackbird_cc/resources/views.py
@@ -153,6 +153,20 @@ def _write_pdf_to_tempdir(f) -> str:
def create_metadata(pdf_files) -> Generator[tuple[services.PDFMetadata, str], None, None]:
+ """
+ Generates PDF metadata and snapshot images for a list of PDF files.
+
+ This function takes a list of PDF file objects, creates temporary files for each one,
+ and then uses the `services.get_pdf_metadata_from_path` and `services.export_pages_as_images` functions to extract metadata and snapshot images for each PDF.
+
+ The function yields a tuple containing the PDF metadata and a list of snapshot image paths for each PDF file.
+
+ Args:
+ pdf_files (list[django.core.files.uploadedfile.InMemoryUploadedFile]): A list of PDF file objects.
+
+ Yields:
+ tuple[services.PDFMetadata, list[str]]: A tuple containing the PDF metadata and a list of snapshot image paths for each PDF file.
+ """
with tempfile.TemporaryDirectory() as temp_dir:
for pdf_file in pdf_files:
file_path = os.path.join(temp_dir, pdf_file.name)