Files
Mind-Expanding-Books/utils/README.MD
2020-10-12 12:53:50 +05:30

22 lines
1.2 KiB
Markdown

`utils/` mainly contains scripts for generating `app/src/books.json` file from `README.md`
## Generating `app/src/books.json`
The website shows name of the book, year, rating, cover, amazon link, etc in book card. Some of the
data like name, year, rating etc is present in the [main README.md](../README.md). Other details
like cover photo, amazon link etc is fetched from various APIs.
The script that fetches all these extra data lives in `utils/update_json_files.py` (utils is present in the parent directory of `app/`)
The script goes through all the books in [main README.md](../README.md) and starts fetching the extra details
from `Goodreads` and `Google Search` API. And the result is stored in `utils/books.json` and `utils/book_name_to_details.json`
(used for caching only).
Once the script completes the run, the `utils/books.json` file is copied to `app/src/books.json`
And the website uses the data from `app/src/books.json` for generating the pages.
In most cases, you don't want to run the `utils/update_json_files.py` or make changes to it while working on the website.
The only time you want to mess with the script is when you want to fetch some extra data from `API` or want to update
the `book.json` file to include a newly added book or category.