23 July 2021
If, like me, you are a book lover who devours books, you are probably also familiar with the problem of bringing enough books while traveling. This is where the e-book entered my life, and it is definitely here to stay. But how to keep track of all my e-books? And how do I remember what they’re about by just seeing their title? And, the worst of all problems, how to pick the next book to read from the huge virtual pile of books?
After struggling with this for years, I finally decided it was time to spend some time solving this problem. Why not create a Python script to list all my books, retrieve their ISBN, and finally find their summary on Google Books, ending up with an Excel file containing all this information? And yes, this is as simple as it sounds! I’ve used the brilliantly simple ISBN tools package and combined this with the urllib package to get the summary from Google Books. Easy does it! And the result looks like this:
If you’re curious on which book to read next now you’ve got such a nice list of all the books you’ve already read, you should definitely check out our fantastic book recommender to help you find your next best book.
Let’s start by importing packages and initializing our input information, like the link to Google Books, the file path where my books can be found, and the desired name of the Excel file we want to create.
Next we want to check if we’ve run this script before and if there is already a list of books. If this is the case we will leave the current list untouched and will only add the new books to the file.
Now we walk through all folders in the given directory and only look for pdf and epub files. In my case, these were the only files that I would consider to be books.
We don’t want to keep searching online for ISBN and summaries of the books we’ve already found before. Therefore we will remove all books from the existing file with the list of books (if this existed). If there wasn’t already such a list, nothing will happen during this step.
For all the new books, we want to search for their ISBN using the book title (name of the file). Using this ISBN, we will try to find the summary of the book in Google Books.
Finally, we combine the existing list of books with all new books we’ve found and store this complete overview in the Excel file. We’re all done now and good to go.
It’s definitely not perfect yet since the ISBN is matched using the title, which won’t be correct all the time, but I had a lot of fun creating this script, and I hope you’ll have fun using it!
This article previously appeared on TheAnalyticsLab.com.
Do you want to know more about this subject? Please contact Jeanine Schoonemann using the details below
7 September 2022
We don’t know if you’ve heard already, but there is yet another crisis on our horizon:... read more
15 September 2021
Project-Friday At Cmotions, we love a challenge. Especially those that make us both think and have... read more
8 September 2021
In May, we kicked off another Project Friday. This time, a group of seven Cmotions colleagues,... read more