internetarchive / internetarchive/openlibrary
Include notes when exporting lists to other formats
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 138
Description
### Problem
### A clear and concise description of what you want to happen
When exporting lists, they should either include any notes attached to items in the list or provide an option to include the notes.
E.g. Go to https://openlibrary.org/people/ScarTissue/lists/OL233794L/TPL_Treasure_Sale_2023
Click the "HTML" or "JSON" options
### Screenshots

### Additional Context
From @dcapillae on Slack:
> Adding notes to the books included in an Open Library list is great because you can create annotated bibliographies to share with other readers. However, these notes are not exported when you export your lists to HTML, BibTex or JSON format. It would be interesting to be able to export your lists in Open Library including the notes you have added to each book.
### Proposal & Constraints
Rough proposal:
- Update the export endpoint https://github.com/internetarchive/openlibrary/blob/ceb273a02efd2372c6411b0e86e49529c4817c21/openlibrary/plugins/openlibrary/lists.py#L743 to have a new `api` parameter which defaults to `v1`. To avoid a breaking change to these APIs.
- Update the list export method to instead of having the raw OL thing, have an object like `{ thing: THING, notes: notes }`. See https://github.com/internetarchive/openlibrary/blob/f197acb2c3d23575ab9af05b2f27a061685723ba/openlibrary/core/lists/model.py#L212-L218
- For HTML: Update `lists/export_as_html.html` to also display the notes and handle the nested dict
- Handle `api=v1` returning just the `thing` directly; `api=v2` should return the wrapper `{thing: THING, notes: notes}`.
### Leads
### Related files
### Stakeholders
### Instructions for Contributors
- Please [run these commands](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#working-on-your-branch) to ensure your repository is up to date **before** [creating a new branch](https://github.com/internetarchive/openlibrary/wiki/Git-Cheat-Sheet#making-changes-and-creating-a-pull-request) to work on this issue and **each time after** pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.
Contributor guide
Assessment
This issue has not been assessed yet.