2021-03-08 08:49:10 -08:00
|
|
|
""" using another bookwyrm instance as a source of book data """
|
2020-11-24 16:05:00 -08:00
|
|
|
from bookwyrm import activitypub, models
|
2021-09-16 11:30:04 -07:00
|
|
|
from bookwyrm.book_search import SearchResult
|
|
|
|
from .abstract_connector import AbstractMinimalConnector
|
2020-03-28 12:55:53 -07:00
|
|
|
|
|
|
|
|
2020-11-28 18:56:28 -08:00
|
|
|
class Connector(AbstractMinimalConnector):
|
2021-04-26 09:15:42 -07:00
|
|
|
"""this is basically just for search"""
|
2020-11-24 16:05:00 -08:00
|
|
|
|
2021-04-29 13:03:56 -07:00
|
|
|
def get_or_create_book(self, remote_id):
|
2021-04-28 15:19:24 -07:00
|
|
|
return activitypub.resolve_remote_id(remote_id, model=models.Edition)
|
2020-05-08 16:56:49 -07:00
|
|
|
|
2020-11-28 18:46:50 -08:00
|
|
|
def parse_search_data(self, data):
|
|
|
|
return data
|
2020-05-03 17:53:14 -07:00
|
|
|
|
2020-11-28 18:46:50 -08:00
|
|
|
def format_search_result(self, search_result):
|
2021-03-08 08:49:10 -08:00
|
|
|
search_result["connector"] = self
|
2020-11-28 18:46:50 -08:00
|
|
|
return SearchResult(**search_result)
|
2021-03-01 21:09:21 +01:00
|
|
|
|
|
|
|
def parse_isbn_search_data(self, data):
|
|
|
|
return data
|
|
|
|
|
|
|
|
def format_isbn_search_result(self, search_result):
|
2021-03-13 13:55:20 -08:00
|
|
|
return self.format_search_result(search_result)
|