[sync] updated: config based; async loop; Documents adopted to new system
This commit is contained in:
1 parent
b0b518fd8c
commit
06965bebee
23 files changed
+1078
-346
No files matched your search
@@ -135,6 +135,17 @@ def create_page(provider: Provider, img: ImageCreator, document):
|
||||
return document
|
||||
|
||||
|
||||
def check_url(documents):
|
||||
urls = list(map(
|
||||
lambda i: i['url'],
|
||||
documents
|
||||
))
|
||||
|
||||
unique_urls = set(urls)
|
||||
if len(urls) != len(unique_urls):
|
||||
raise Exception('URL of pages should be unique')
|
||||
|
||||
|
||||
def sync_pages(provider, collection, update=True, delete=True, skip_unchanged=True):
|
||||
img_sizes = settings.album_image_sizes
|
||||
output_dir = settings.dir_static_images
|
||||
@@ -170,6 +181,8 @@ def sync_pages(provider, collection, update=True, delete=True, skip_unchanged=Tr
|
||||
lambda i: i['id']
|
||||
)
|
||||
|
||||
check_url(documents)
|
||||
|
||||
# SKIP UNTOUCHED DOCUMENTS
|
||||
if skip_unchanged:
|
||||
documents = untouched(documents, sync)
|
||||
|
||||
Reference in new issue
Block a user