blubbblülüllü
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import pymupdf
|
||||
import os
|
||||
import lib
|
||||
import json
|
||||
|
||||
def retrieve_file_contents(path):
|
||||
file_extraction_functions = {
|
||||
"pdf": lambda path: lib.extract_pdf_content(path),
|
||||
"jpg": lambda path: "",
|
||||
"png": lambda path: "",
|
||||
"txt": lambda path: lib.extract_pdf_content(path),
|
||||
"mp3": lambda path: "test mp3"
|
||||
}
|
||||
|
||||
lib.read_files(path, files := [])
|
||||
|
||||
contents = []
|
||||
|
||||
for file in files:
|
||||
content = file_extraction_functions[file[0]](file[1])
|
||||
contents.append({
|
||||
"type": file[0],
|
||||
"path": file[1],
|
||||
"content": content
|
||||
})
|
||||
|
||||
return contents
|
||||
|
||||
contents = retrieve_file_contents("C:\\SoftwareEng")
|
||||
|
||||
print(json.dumps(contents, indent="\t"))
|
||||
Reference in New Issue
Block a user