bookwyrm-mastodon/bookwyrm/connectors/bookwyrm_connector.py

25 lines
799 B
Python
Raw Permalink Normal View History

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