bookstack #1
@ -1,9 +1,29 @@
|
|||||||
import pymongo
|
import pymongo
|
||||||
import os
|
import os
|
||||||
import json
|
import ijson
|
||||||
import sys
|
import sys
|
||||||
import bookstack
|
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
|
db = pymongo.MongoClient("10.0.0.59", 27017).paperless.content
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user