diff --git a/modules/sync/settings.py b/modules/sync/settings.py index 65475075..547f70a1 100644 --- a/modules/sync/settings.py +++ b/modules/sync/settings.py @@ -91,7 +91,6 @@ provider_root = value('provider')['root'] # env('SYNC_PROVIDER', 'fs') f = abs_fn(provider_root) -dir_documents = './Documents' dir_articles = './Articles' dir_pages = './Pages' diff --git a/modules/sync/sync/models/Document.py b/modules/sync/sync/models/Document.py index 2eeb30ba..5c04d327 100644 --- a/modules/sync/sync/models/Document.py +++ b/modules/sync/sync/models/Document.py @@ -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) diff --git a/modules/sync/sync/models/Image.py b/modules/sync/sync/models/Image.py index 0d0eb911..c4954474 100644 --- a/modules/sync/sync/models/Image.py +++ b/modules/sync/sync/models/Image.py @@ -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( diff --git a/modules/sync/test/sync/test_document.py b/modules/sync/test/sync/test_document.py deleted file mode 100644 index 4db32b89..00000000 --- a/modules/sync/test/sync/test_document.py +++ /dev/null @@ -1,27 +0,0 @@ -import unittest - -import settings -from sync.data import scan_subdirs -from sync.data.fs import FSProvider - - -class MyTestCase(unittest.TestCase): - def test_document(self): - p = FSProvider(settings.dir_documents) - - documents = scan_subdirs(p, '.pdf') - # documents = lmap( - # lambda document: create_document(p, document), - # documents - # ) - - self.assertEqual(True, True) - - def test_scan(self): - p = FSProvider(settings.dir_documents) - documents = scan_subdirs(p, '.pdf') - self.assertIsInstance(documents, list) - - -if __name__ == '__main__': - unittest.main()