remove mysql experiments
This commit is contained in:
parent
ea6e9c198b
commit
816510f4de
9
src/bstack.py
Normal file
9
src/bstack.py
Normal file
@ -0,0 +1,9 @@
|
||||
from lib import *
|
||||
|
||||
|
||||
def retrieve(id_num):
|
||||
result = api.get_pages_read({"id": id_num})
|
||||
print(result)
|
||||
|
||||
def insert(id_num, name, text):
|
||||
pass
|
63
src/bstack_api_calls.json
Normal file
63
src/bstack_api_calls.json
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
'post_books_create',
|
||||
'get_attachments_read',
|
||||
'get_chapters_list',
|
||||
'get_content_permissions_read',
|
||||
'get_chapters_export_markdown',
|
||||
'post_roles_create',
|
||||
'put_recycle_bin_restore',
|
||||
'put_image_gallery_update',
|
||||
'put_books_update',
|
||||
'post_shelves_create',
|
||||
'get_books_read',
|
||||
'get_attachments_list',
|
||||
'put_content_permissions_update',
|
||||
'get_recycle_bin_list',
|
||||
'delete_users_delete',
|
||||
'get_users_list',
|
||||
'get_docs_json',
|
||||
'get_books_export_html',
|
||||
'put_chapters_update',
|
||||
'get_chapters_export_pdf',
|
||||
'get_pages_export_markdown',
|
||||
'delete_pages_delete',
|
||||
'post_attachments_create',
|
||||
'put_attachments_update',
|
||||
'get_roles_read',
|
||||
'get_chapters_export_plain_text',
|
||||
'get_users_read',
|
||||
'delete_chapters_delete',
|
||||
'put_pages_update',
|
||||
'post_chapters_create',
|
||||
'get_chapters_read',
|
||||
'get_pages_list',
|
||||
'get_pages_export_plain_text',
|
||||
'get_roles_list',
|
||||
'get_pages_export_html',
|
||||
'get_image_gallery_read',
|
||||
'delete_attachments_delete',
|
||||
'post_users_create',
|
||||
'get_audit_log_list',
|
||||
'get_pages_export_pdf',
|
||||
'delete_books_delete',
|
||||
'get_shelves_read',
|
||||
'delete_roles_delete',
|
||||
'get_pages_read',
|
||||
'put_shelves_update',
|
||||
'get_books_export_plain_text',
|
||||
'delete_shelves_delete',
|
||||
'get_books_export_markdown',
|
||||
'delete_image_gallery_delete',
|
||||
'get_search_all',
|
||||
'get_books_list',
|
||||
'post_image_gallery_create',
|
||||
'get_books_export_pdf',
|
||||
'post_pages_create',
|
||||
'get_shelves_list',
|
||||
'get_docs_display',
|
||||
'put_users_update',
|
||||
'put_roles_update',
|
||||
'delete_recycle_bin_destroy',
|
||||
'get_chapters_export_html',
|
||||
'get_image_gallery_list'
|
||||
}
|
@ -4,7 +4,7 @@ import lib
|
||||
raw_manifest = open("/mnt/user/media/paperless/media/backup/manifest.json")
|
||||
manifest = lib.json.load(raw_manifest)
|
||||
|
||||
index_num = 1
|
||||
inum = 1
|
||||
|
||||
existing, inserted, big, duplicates = 0, 0, 0, 0
|
||||
|
||||
@ -28,7 +28,7 @@ def exists(r):
|
||||
else: return False
|
||||
|
||||
def parse():
|
||||
global inserted, big, index_num
|
||||
global inserted, big, inum
|
||||
print("Parsing manifest json...")
|
||||
# for every document in the export
|
||||
for document in manifest:
|
||||
@ -37,7 +37,29 @@ def parse():
|
||||
record = {"title": document["fields"]["title"],
|
||||
"content": document["fields"]["content"],
|
||||
"check": document["fields"]["checksum"],
|
||||
"index": index_num}
|
||||
"index": inum}
|
||||
|
||||
if lib.sys.getsizeof(record["content"]) < 16777216:
|
||||
if record["content"] != "" and record["title"] != "":
|
||||
if not exists(record):
|
||||
insert(record)
|
||||
inserted = inserted + 1
|
||||
inum = inum + 1
|
||||
else: big = big + 1
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
def parse():
|
||||
global inserted, big, inum
|
||||
print("Parsing manifest json...")
|
||||
# for every document in the export
|
||||
for document in manifest:
|
||||
#if the title and content tags aren't blank
|
||||
try:
|
||||
record = {"title": document["fields"]["title"],
|
||||
"content": document["fields"]["content"],
|
||||
"check": document["fields"]["checksum"],
|
||||
"index": inum}
|
||||
|
||||
if lib.sys.getsizeof(record["content"]) < 16777216:
|
||||
if record["content"] != "" and record["title"] != "":
|
||||
|
@ -1,2 +0,0 @@
|
||||
import lib
|
||||
|
@ -2,5 +2,14 @@ import pymongo
|
||||
import os
|
||||
import json
|
||||
import sys
|
||||
import bookstack
|
||||
|
||||
db = pymongo.MongoClient("localhost", 27017).paperless.content
|
||||
|
||||
|
||||
url = 'http://10.0.0.59:6875'
|
||||
token = 'RVSO8xZXOjRYJntNYPRd3E9iT2qXm11C'
|
||||
secret = 'qR5r2EyKT09ogz8VSolS12ispAV5QrT0'
|
||||
|
||||
api = bookstack.BookStack(url, token, secret)
|
||||
methods = api.generate_api_methods()
|
@ -1,6 +1,5 @@
|
||||
import extract
|
||||
import search
|
||||
import insert
|
||||
|
||||
def start():
|
||||
extract.parse()
|
||||
|
Loading…
Reference in New Issue
Block a user