internetarchive / internetarchive/openlibrary

Include notes when exporting lists to other formats

Open
#9,650 4 comments 0 reactions 0 assignees View on GitHub
Lead: @cdrini Priority: 2 Theme: Lists Type: Feature Request
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

![adding a note to a book in a list](https://github.com/user-attachments/assets/966f08f7-b293-49b6-850b-669326a51da2)

### 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.