1
0
Fork 0
bookwyrm/bookwyrm/connectors/bookwyrm_connector.py

18 lines
585 B
Python
Raw Normal View History

''' using another bookwyrm instance as a source of book data '''
from bookwyrm import activitypub, models
2020-11-28 18:56:28 -08:00
from .abstract_connector import AbstractMinimalConnector, SearchResult
2020-03-28 12:55:53 -07:00
2020-11-28 18:56:28 -08:00
class Connector(AbstractMinimalConnector):
2020-11-28 18:46:50 -08:00
''' this is basically just for search '''
2020-11-28 18:46:50 -08:00
def get_or_create_book(self, remote_id):
return activitypub.resolve_remote_id(models.Edition, remote_id)
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):
search_result['connector'] = self
2020-11-28 18:46:50 -08:00
return SearchResult(**search_result)