mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-30 03:50:40 +00:00
removes outdated update book code
This commit is contained in:
parent
c9433a3c7e
commit
d8fdc66450
3 changed files with 2 additions and 33 deletions
|
@ -85,12 +85,6 @@ def first_search_result(query, min_confidence=0.1):
|
|||
return None
|
||||
|
||||
|
||||
def update_book(book, data=None):
|
||||
''' re-sync with the original data source '''
|
||||
connector = load_connector(book.connector)
|
||||
connector.update_book(book, data=data)
|
||||
|
||||
|
||||
def get_connectors():
|
||||
''' load all connectors '''
|
||||
for info in models.Connector.objects.order_by('priority').all():
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.http import HttpResponseBadRequest, HttpResponseNotFound
|
|||
from django.views.decorators.csrf import csrf_exempt
|
||||
import requests
|
||||
|
||||
from bookwyrm import activitypub, books_manager, models, outgoing
|
||||
from bookwyrm import activitypub, models, outgoing
|
||||
from bookwyrm import status as status_builder
|
||||
from bookwyrm.tasks import app
|
||||
from bookwyrm.signatures import Signature
|
||||
|
@ -317,13 +317,4 @@ def handle_update_user(activity):
|
|||
@app.task
|
||||
def handle_update_book(activity):
|
||||
''' a remote instance changed a book (Document) '''
|
||||
document = activity['object']
|
||||
# check if we have their copy and care about their updates
|
||||
book = models.Book.objects.select_subclasses().filter(
|
||||
remote_id=document['id'],
|
||||
sync=True,
|
||||
).first()
|
||||
if not book:
|
||||
return
|
||||
|
||||
books_manager.update_book(book, data=document)
|
||||
activitypub.Edition(**activity['object']).to_model(models.Edition)
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
''' Routine tasks for keeping your library tidy '''
|
||||
from datetime import timedelta
|
||||
from django.utils import timezone
|
||||
from bookwyrm import books_manager
|
||||
from bookwyrm 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)
|
Loading…
Reference in a new issue