Compare commits

..

No commits in common. "8b8aefc40350fa40fc5e83a9c0e2531e1fa66317" and "6ddc108d72e4794732a93b5aaac85ecbf409cda0" have entirely different histories.

2 changed files with 7 additions and 8 deletions

View File

@ -16,13 +16,13 @@ def insert_tag(r):
def insert(r): def insert(r):
global inserted global inserted
doc_type = "document" type = "document"
pk = r['pk'] pk = r['pk']
check = r['check'] check = r['check']
content = r['content'] content = r['content']
title = r['title'] title = r['title']
lib.db.insert_one({'type': doc_type, lib.db.insert_one({'type': type,
'title': title, 'title': title,
"content": content, "content": content,
"checksum": check, "checksum": check,
@ -103,8 +103,7 @@ def parse():
if 'title' in fields and 'content' in fields \ if 'title' in fields and 'content' in fields \
and doc['model'] == 'documents.document' \ and doc['model'] == 'documents.document' \
and 50 < lib.sys.getsizeof(fields['content']) < 16777216\ and lib.sys.getsizeof(fields['content']) < 16777216:
and fields['content'] != "":
r['tags'] = doc['fields']['tags'] r['tags'] = doc['fields']['tags']
r['pk'] = doc['pk'] r['pk'] = doc['pk']
@ -114,9 +113,9 @@ def parse():
create_page(r) create_page(r)
if rec_exists(r): if rec_exists(r):
continue continue
else: else:
insert(r) insert(r)
f.close() f.close()

View File

@ -10,14 +10,14 @@ def json_file():
def json_cursor(f): def json_cursor(f):
items = ijson.items(f, 'item') items = ijson.items(f, 'item')
return (doc for doc in items) return (doc for doc in items )
db = pymongo.MongoClient("10.0.0.59", 27017).paperless.content db = pymongo.MongoClient("10.0.0.59", 27017).paperless.content
url = 'http://10.0.0.59:6875' url = 'http://10.0.0.59:6875'
token = 'hd5H8OTYamMmKTh4LDamJrGDNk1MGdDk' token = 'RVSO8xZXOjRYJntNYPRd3E9iT2qXm11C'
secret = 'tUG7ZQIBCTczzZ5fqAeHj1Uh6rRzZIu9' secret = 'qR5r2EyKT09ogz8VSolS12ispAV5QrT0'
api = bookstack.BookStack(url, token, secret) api = bookstack.BookStack(url, token, secret)
methods = api.generate_api_methods() methods = api.generate_api_methods()