Initial commit
This commit is contained in:
21
importers/file_scan.py
Normal file
21
importers/file_scan.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Dict, Iterator
|
||||
|
||||
RESUME_EXTS = {".pdf", ".docx", ".doc", ".txt", ".html", ".htm"}
|
||||
|
||||
def iter_files(root: Path) -> Iterator[Dict]:
|
||||
for p in root.rglob("*"):
|
||||
if p.is_file() and p.suffix.lower() in RESUME_EXTS:
|
||||
yield {
|
||||
"origin_type": "file_scan",
|
||||
"export_path": str(root),
|
||||
"chat_title": None,
|
||||
"message_id": None,
|
||||
"message_date": None,
|
||||
"message_text": "",
|
||||
"file_path": str(p.resolve()),
|
||||
"original_name": p.name,
|
||||
"extra": {},
|
||||
}
|
||||
Reference in New Issue
Block a user