sync cleanup

This commit is contained in:
tmshv committed 2020-02-29 01:19:04 +03:00
1 parent 263f18a1df
commit de20ed726f
4 files changed
+2 -43

No files matched your search

+1 -7
View File
@@ -3,7 +3,7 @@ from tempfile import mkstemp
import settings
from db import collection
from sync.data import scan_subdirs, request
from sync.data import request
from sync.models import Model
from sync.models.DocumentPreviewImage import DocumentPreviewImage
from utils.hash import hash_str, md5
@@ -25,12 +25,6 @@ class Document(Model):
async def delete(query):
return store.find_one_and_delete(query)
@staticmethod
async def scan(provider):
scan_dir = settings.dir_documents
paths = scan_subdirs(provider, '.pdf', scan_dir)
return [Document.read_path(provider, path) for path in paths]
@staticmethod
def read_path(provider, path):
name = os.path.basename(path)
+1 -8
View File
@@ -7,7 +7,7 @@ from typing import Optional, List
import settings
from db import collection
from sync.data import request, list_images
from sync.data import request
from sync.models import Model
from utils.hash import md5, hash_str
from utils.image import image_magick_resize
@@ -54,13 +54,6 @@ class Image(Model):
return img
@staticmethod
async def scan(provider):
scan_path = settings.dir_images
documents = list_images(provider, scan_path)
return [Image.read_path(provider, i) for i in documents]
@staticmethod
def read_path(provider, path):
return Image(