-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdf_processor.py
More file actions
34 lines (24 loc) · 996 Bytes
/
pdf_processor.py
File metadata and controls
34 lines (24 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
"""
PDFProcessor - standalone module for PDF processing.
"""
from pathlib import Path
from typing import List
import utils as U
class PDFProcessor:
"""Specialized processor for PDF files."""
def __init__(self, incoming_dir: Path, destination_dir: Path):
self.incoming_dir = incoming_dir
self.destination_dir = destination_dir
def process_pdfs(self) -> List[Path]:
"""Process PDFs by moving them directly to their destination (no pipeline)."""
print("📚 Processing PDFs...")
# PDFs do not need processing, only moving.
pdfs = U.list_files({".pdf"}, root=self.incoming_dir)
if not pdfs:
print("📚 No PDFs found to process")
return []
moved_pdfs = U.move_files(pdfs, self.destination_dir)
if moved_pdfs:
print(f"📚 {len(moved_pdfs)} PDF(s) moved to {self.destination_dir}")
return moved_pdfs