Maintaining a Reading List with Vim and Open Library
I tend to accrue about 10-30 book recommendations a year, mostly from articles or comments I read online. I paste them in a plain markdown file within a vimwiki that I sync to github. Generally I'll either have a title and author, or a url to the publisher's website, Amazon, Goodreads or some other site.
When I have a list of urls, its often hard to pick out the title. And when I'm scrolling through looking for a book to read sometimes I want to know how many pages it is so I know what I'm getting into. Using vim filters, a python script and open library I can easily replace these pasted in entries with these extra details.
As shown above, the flow is: Use visual mode to select some books I've pasted in and use a vim filter command (!bookup) with a script that opens those urls, extracts some data and uses open library to fill in the rest. After a short wait, it overwrites them, formatted as markdown table rows.
If I find new domains, I can add a new "extractor" in a few minutes. If the script encounters something it can't find, it moves it to the bottom and outputs it in its original form.
If I don't have vim handy when I find a new recommendation, I can drop it directly into github using the github editor, or into a note app on my phone that works like a queue to get things into more permanant places. Then I can use this tool to convert them next time I'm editing in vim.
2020-12-17