We'd like to move to a feed generation strategy where all we need to do is pass in a LennyAPI.Item db object and then the search method can centralize and DRY the process for fetching Lenny records, searching Open Library, and then attaching the Lenny record to the right Open Library record:
Catalog.create(LennyDataProvider.search(limit=25, Item=LennyAPI.Item))
If there's no query present, we:
• lenny_records = fetch limit items from LennyAPI.Item
• search_records = we construct an Open Library search from the openlibrary_edition of these lenny_records
• We then loop over the search_records and and attach the appropriate lenny_record
If the is a query present... In the future (we can't do this yet), we:
• search Open Library for the query and our instance's Lenny ID as a provider
• We then parse the results to extract all the openlibrary_edition keys out into a list
• We use this list of openlibrary_edition keys to then get lenny_records from the LennyAPI.Item db
• We then loop over the search_records and and attach the appropriate lenny_record
This requires a significant refactor to https://github.com/ArchiveLabs/pyopds2_lenny
We'd like to move to a feed generation strategy where all we need to do is pass in a
LennyAPI.Itemdb object and then thesearchmethod can centralize and DRY the process for fetching Lenny records, searching Open Library, and then attaching the Lenny record to the right Open Library record:If there's no query present, we:
•
lenny_records= fetchlimititems fromLennyAPI.Item•
search_records= we construct an Open Library search from theopenlibrary_editionof theselenny_records• We then loop over the
search_recordsand and attach the appropriatelenny_recordIf the is a query present... In the future (we can't do this yet), we:
• search Open Library for the
queryand our instance's Lenny ID as aprovider• We then parse the results to extract all the
openlibrary_editionkeys out into a list• We use this list of
openlibrary_editionkeys to then getlenny_recordsfrom theLennyAPI.Itemdb• We then loop over the
search_recordsand and attach the appropriatelenny_recordThis requires a significant refactor to https://github.com/ArchiveLabs/pyopds2_lenny