mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
976e7ddf79
Fixes #93
17 lines
534 B
Python
17 lines
534 B
Python
''' Routine tasks for keeping your library tidy '''
|
|
from datetime import timedelta
|
|
from django.utils import timezone
|
|
from fedireads import books_manager
|
|
from fedireads import models
|
|
|
|
def sync_book_data():
|
|
''' update books with any changes to their canonical source '''
|
|
expiry = timezone.now() - timedelta(days=1)
|
|
books = models.Edition.objects.filter(
|
|
sync=True,
|
|
last_sync_date__lte=expiry
|
|
).all()
|
|
for book in books:
|
|
# TODO: create background tasks
|
|
books_manager.update_book(book)
|
|
|