got ijson working

This commit is contained in:
Daniel Cronin 2024-10-05 02:03:26 -05:00
parent c3cd29430f
commit 1afd622196

View File

@ -1,9 +1,29 @@
import pymongo
import os
import json
import ijson
import sys
import bookstack
# import paperless database export
# manifest_path = "/mnt/user/media/paperless/media/manifest.json"
f = open("/mnt/tower/media/paperless/media/backup/manifest.json")
manifest = ijson.items(f, 'item')
paperless_docs = {}
for doc in manifest:
fields = doc['fields']
if 'title' in fields and 'content' in fields:
pk = doc['pk']
title = fields['title']
content = fields['content']
check = fields['checksum']
paperless_docs[pk] = {'checksum': check, 'title': title, 'content': content}
db = pymongo.MongoClient("10.0.0.59", 27017).paperless.content